2000-05-05 09:28:49 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2004-05-13 22:34:18 +04:00
|
|
|
// vim: ft=cpp ts=8 sw=4 et tw=78
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2000-05-05 09:28:49 +04:00
|
|
|
|
|
|
|
#ifndef __nsContentPolicy_h__
|
|
|
|
#define __nsContentPolicy_h__
|
|
|
|
|
2004-05-13 22:34:18 +04:00
|
|
|
#include "nsIContentPolicy.h"
|
2015-02-20 19:54:12 +03:00
|
|
|
#include "nsISimpleContentPolicy.h"
|
2006-03-22 18:26:35 +03:00
|
|
|
#include "nsCategoryCache.h"
|
2004-05-13 22:34:18 +04:00
|
|
|
|
2006-03-30 12:03:04 +04:00
|
|
|
/*
|
|
|
|
* Implementation of the "@mozilla.org/layout/content-policy;1" contract.
|
|
|
|
*/
|
|
|
|
|
2000-05-05 09:28:49 +04:00
|
|
|
class nsContentPolicy : public nsIContentPolicy
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSICONTENTPOLICY
|
2004-05-13 22:34:18 +04:00
|
|
|
|
2000-05-05 09:28:49 +04:00
|
|
|
nsContentPolicy();
|
2014-06-25 06:09:15 +04:00
|
|
|
|
|
|
|
protected:
|
2000-05-05 09:28:49 +04:00
|
|
|
virtual ~nsContentPolicy();
|
2014-06-25 06:09:15 +04:00
|
|
|
|
2000-05-05 09:28:49 +04:00
|
|
|
private:
|
2006-03-22 18:26:35 +03:00
|
|
|
//Array of policies
|
|
|
|
nsCategoryCache<nsIContentPolicy> mPolicies;
|
2015-02-20 19:54:12 +03:00
|
|
|
nsCategoryCache<nsISimpleContentPolicy> mSimplePolicies;
|
2004-05-13 22:34:18 +04:00
|
|
|
|
|
|
|
//Helper type for CheckPolicy
|
2004-05-14 01:52:12 +04:00
|
|
|
typedef
|
|
|
|
NS_STDCALL_FUNCPROTO(nsresult, CPMethod, nsIContentPolicy,
|
|
|
|
ShouldProcess,
|
2012-08-22 19:56:38 +04:00
|
|
|
(uint32_t, nsIURI*, nsIURI*, nsISupports*,
|
2012-07-03 03:16:11 +04:00
|
|
|
const nsACString &, nsISupports*, nsIPrincipal*,
|
2012-08-22 19:56:38 +04:00
|
|
|
int16_t*));
|
2004-05-13 22:34:18 +04:00
|
|
|
|
2015-02-20 19:54:12 +03:00
|
|
|
typedef
|
|
|
|
NS_STDCALL_FUNCPROTO(nsresult, SCPMethod, nsISimpleContentPolicy,
|
|
|
|
ShouldProcess,
|
|
|
|
(uint32_t, nsIURI*, nsIURI*, nsIDOMElement*, bool,
|
|
|
|
const nsACString &, nsISupports*, nsIPrincipal*,
|
|
|
|
int16_t*));
|
|
|
|
|
2004-05-13 22:34:18 +04:00
|
|
|
//Helper method that applies policyMethod across all policies in mPolicies
|
|
|
|
// with the given parameters
|
2015-02-20 19:54:12 +03:00
|
|
|
nsresult CheckPolicy(CPMethod policyMethod, SCPMethod simplePolicyMethod,
|
2015-06-12 23:52:07 +03:00
|
|
|
nsContentPolicyType contentType,
|
2004-05-13 22:34:18 +04:00
|
|
|
nsIURI *aURI, nsIURI *origURI,
|
2004-07-27 21:15:53 +04:00
|
|
|
nsISupports *requestingContext,
|
2004-05-13 22:34:18 +04:00
|
|
|
const nsACString &mimeGuess, nsISupports *extra,
|
2012-07-03 03:16:11 +04:00
|
|
|
nsIPrincipal *requestPrincipal,
|
2012-08-22 19:56:38 +04:00
|
|
|
int16_t *decision);
|
2000-05-05 09:28:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
NS_NewContentPolicy(nsIContentPolicy **aResult);
|
|
|
|
|
|
|
|
#endif /* __nsContentPolicy_h__ */
|