Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / content / base / src / nsContentPolicy.h
bloba33747665b55de1120b2ed296a06019406cbd0bb
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"
13 /*
14 * Implementation of the "@mozilla.org/layout/content-policy;1" contract.
17 class nsContentPolicy : public nsIContentPolicy
19 public:
20 NS_DECL_ISUPPORTS
21 NS_DECL_NSICONTENTPOLICY
23 nsContentPolicy();
25 protected:
26 virtual ~nsContentPolicy();
28 private:
29 //Array of policies
30 nsCategoryCache<nsIContentPolicy> mPolicies;
32 //Helper type for CheckPolicy
33 typedef
34 NS_STDCALL_FUNCPROTO(nsresult, CPMethod, nsIContentPolicy,
35 ShouldProcess,
36 (uint32_t, nsIURI*, nsIURI*, nsISupports*,
37 const nsACString &, nsISupports*, nsIPrincipal*,
38 int16_t*));
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,
47 int16_t *decision);
50 nsresult
51 NS_NewContentPolicy(nsIContentPolicy **aResult);
53 #endif /* __nsContentPolicy_h__ */