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