2018-11-30 19:52:05 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2018-11-30 15:39:55 +00:00
|
|
|
// vim: ft=cpp ts=8 sw=2 et tw=80
|
2012-05-21 11:12:37 +00: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 05:28:49 +00:00
|
|
|
|
|
|
|
#ifndef __nsContentPolicy_h__
|
|
|
|
#define __nsContentPolicy_h__
|
|
|
|
|
2004-05-13 18:34:18 +00:00
|
|
|
#include "nsIContentPolicy.h"
|
2006-03-22 15:26:35 +00:00
|
|
|
#include "nsCategoryCache.h"
|
2004-05-13 18:34:18 +00:00
|
|
|
|
2006-03-30 08:03:04 +00:00
|
|
|
/*
|
|
|
|
* Implementation of the "@mozilla.org/layout/content-policy;1" contract.
|
|
|
|
*/
|
|
|
|
|
2000-05-05 05:28:49 +00:00
|
|
|
class nsContentPolicy : public nsIContentPolicy {
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSICONTENTPOLICY
|
2004-05-13 18:34:18 +00:00
|
|
|
|
2000-05-05 05:28:49 +00:00
|
|
|
nsContentPolicy();
|
2014-06-25 02:09:15 +00:00
|
|
|
|
|
|
|
protected:
|
2000-05-05 05:28:49 +00:00
|
|
|
virtual ~nsContentPolicy();
|
2014-06-25 02:09:15 +00:00
|
|
|
|
2000-05-05 05:28:49 +00:00
|
|
|
private:
|
2006-03-22 15:26:35 +00:00
|
|
|
// Array of policies
|
|
|
|
nsCategoryCache<nsIContentPolicy> mPolicies;
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2004-05-13 18:34:18 +00:00
|
|
|
// Helper type for CheckPolicy
|
2017-05-09 13:00:37 +00:00
|
|
|
typedef decltype(&nsIContentPolicy::ShouldProcess) CPMethod;
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2004-05-13 18:34:18 +00:00
|
|
|
// Helper method that applies policyMethod across all policies in mPolicies
|
|
|
|
// with the given parameters
|
2017-08-03 08:50:00 +00:00
|
|
|
nsresult CheckPolicy(CPMethod policyMethod, nsIURI* aURI,
|
2018-03-29 10:16:23 +00:00
|
|
|
nsILoadInfo* aLoadInfo, const nsACString& mimeGuess,
|
2012-08-22 15:56:38 +00:00
|
|
|
int16_t* decision);
|
2000-05-05 05:28:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
|
|
|
|
|
|
|
|
#endif /* __nsContentPolicy_h__ */
|