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/. */
7 #ifndef __nsContentPolicy_h__
8 #define __nsContentPolicy_h__
10 #include "nsIContentPolicy.h"
11 #include "nsCategoryCache.h"
14 * Implementation of the "@mozilla.org/layout/content-policy;1" contract.
17 class nsContentPolicy
: public nsIContentPolicy
21 NS_DECL_NSICONTENTPOLICY
26 virtual ~nsContentPolicy();
30 nsCategoryCache
<nsIContentPolicy
> mPolicies
;
32 //Helper type for CheckPolicy
34 NS_STDCALL_FUNCPROTO(nsresult
, CPMethod
, nsIContentPolicy
,
36 (uint32_t, nsIURI
*, nsIURI
*, nsISupports
*,
37 const nsACString
&, nsISupports
*, nsIPrincipal
*,
40 //Helper method that applies policyMethod across all policies in mPolicies
41 // with the given parameters
42 nsresult
CheckPolicy(CPMethod policyMethod
, uint32_t contentType
,
43 nsIURI
*aURI
, nsIURI
*origURI
,
44 nsISupports
*requestingContext
,
45 const nsACString
&mimeGuess
, nsISupports
*extra
,
46 nsIPrincipal
*requestPrincipal
,
51 NS_NewContentPolicy(nsIContentPolicy
**aResult
);
53 #endif /* __nsContentPolicy_h__ */