2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2018-11-30 18:39:55 +03:00
|
|
|
// vim: ft=cpp ts=8 sw=2 et tw=80
|
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"
|
2006-03-22 18:26:35 +03:00
|
|
|
#include "nsCategoryCache.h"
|
2004-05-13 22:34:18 +04:00
|
|
|
|
2017-07-06 15:00:35 +03: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;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2004-05-13 22:34:18 +04:00
|
|
|
// Helper type for CheckPolicy
|
2017-05-09 16:00:37 +03:00
|
|
|
typedef decltype(&nsIContentPolicy::ShouldProcess) CPMethod;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2004-05-13 22:34:18 +04:00
|
|
|
// Helper method that applies policyMethod across all policies in mPolicies
|
|
|
|
// with the given parameters
|
2017-08-03 11:50:00 +03:00
|
|
|
nsresult CheckPolicy(CPMethod policyMethod, nsIURI *aURI,
|
2018-03-29 13:16:23 +03:00
|
|
|
nsILoadInfo *aLoadInfo, const nsACString &mimeGuess,
|
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__ */
|