1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 // vim: ft=cpp ts=8 sw=2 et tw=80
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
{
20 NS_DECL_NSICONTENTPOLICY
25 virtual ~nsContentPolicy();
29 nsCategoryCache
<nsIContentPolicy
> mPolicies
;
31 // Helper type for CheckPolicy
32 using CPMethod
= decltype(&nsIContentPolicy::ShouldProcess
);
34 // Helper method that applies policyMethod across all policies in mPolicies
35 // with the given parameters
36 nsresult
CheckPolicy(CPMethod policyMethod
, nsIURI
* aURI
,
37 nsILoadInfo
* aLoadInfo
, int16_t* decision
);
40 nsresult
NS_NewContentPolicy(nsIContentPolicy
** aResult
);
42 #endif /* __nsContentPolicy_h__ */