michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: // vim: ft=cpp ts=8 sw=4 et tw=78 michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef __nsContentPolicy_h__ michael@0: #define __nsContentPolicy_h__ michael@0: michael@0: #include "nsIContentPolicy.h" michael@0: #include "nsCategoryCache.h" michael@0: michael@0: /* michael@0: * Implementation of the "@mozilla.org/layout/content-policy;1" contract. michael@0: */ michael@0: michael@0: class nsContentPolicy : public nsIContentPolicy michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSICONTENTPOLICY michael@0: michael@0: nsContentPolicy(); michael@0: virtual ~nsContentPolicy(); michael@0: private: michael@0: //Array of policies michael@0: nsCategoryCache mPolicies; michael@0: michael@0: //Helper type for CheckPolicy michael@0: typedef michael@0: NS_STDCALL_FUNCPROTO(nsresult, CPMethod, nsIContentPolicy, michael@0: ShouldProcess, michael@0: (uint32_t, nsIURI*, nsIURI*, nsISupports*, michael@0: const nsACString &, nsISupports*, nsIPrincipal*, michael@0: int16_t*)); michael@0: michael@0: //Helper method that applies policyMethod across all policies in mPolicies michael@0: // with the given parameters michael@0: nsresult CheckPolicy(CPMethod policyMethod, uint32_t contentType, michael@0: nsIURI *aURI, nsIURI *origURI, michael@0: nsISupports *requestingContext, michael@0: const nsACString &mimeGuess, nsISupports *extra, michael@0: nsIPrincipal *requestPrincipal, michael@0: int16_t *decision); michael@0: }; michael@0: michael@0: nsresult michael@0: NS_NewContentPolicy(nsIContentPolicy **aResult); michael@0: michael@0: #endif /* __nsContentPolicy_h__ */