content/base/src/nsContentPolicy.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:e4042beffb51
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 // vim: ft=cpp ts=8 sw=4 et tw=78
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #ifndef __nsContentPolicy_h__
8 #define __nsContentPolicy_h__
9
10 #include "nsIContentPolicy.h"
11 #include "nsCategoryCache.h"
12
13 /*
14 * Implementation of the "@mozilla.org/layout/content-policy;1" contract.
15 */
16
17 class nsContentPolicy : public nsIContentPolicy
18 {
19 public:
20 NS_DECL_ISUPPORTS
21 NS_DECL_NSICONTENTPOLICY
22
23 nsContentPolicy();
24 virtual ~nsContentPolicy();
25 private:
26 //Array of policies
27 nsCategoryCache<nsIContentPolicy> mPolicies;
28
29 //Helper type for CheckPolicy
30 typedef
31 NS_STDCALL_FUNCPROTO(nsresult, CPMethod, nsIContentPolicy,
32 ShouldProcess,
33 (uint32_t, nsIURI*, nsIURI*, nsISupports*,
34 const nsACString &, nsISupports*, nsIPrincipal*,
35 int16_t*));
36
37 //Helper method that applies policyMethod across all policies in mPolicies
38 // with the given parameters
39 nsresult CheckPolicy(CPMethod policyMethod, uint32_t contentType,
40 nsIURI *aURI, nsIURI *origURI,
41 nsISupports *requestingContext,
42 const nsACString &mimeGuess, nsISupports *extra,
43 nsIPrincipal *requestPrincipal,
44 int16_t *decision);
45 };
46
47 nsresult
48 NS_NewContentPolicy(nsIContentPolicy **aResult);
49
50 #endif /* __nsContentPolicy_h__ */

mercurial