tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsContentPolicy.h (1207B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 // vim: ft=cpp ts=8 sw=2 et tw=80
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef __nsContentPolicy_h__
      8 #define __nsContentPolicy_h__
      9 
     10 #include "nsCategoryCache.h"
     11 #include "nsIContentPolicy.h"
     12 
     13 /*
     14 * Implementation of the "@mozilla.org/layout/content-policy;1" contract.
     15 */
     16 
     17 class nsContentPolicy : public nsIContentPolicy {
     18 public:
     19  NS_DECL_ISUPPORTS
     20  NS_DECL_NSICONTENTPOLICY
     21 
     22  nsContentPolicy();
     23 
     24 protected:
     25  virtual ~nsContentPolicy();
     26 
     27 private:
     28  // Array of policies
     29  nsCategoryCache<nsIContentPolicy> mPolicies;
     30 
     31  // Helper type for CheckPolicy
     32  using CPMethod = decltype(&nsIContentPolicy::ShouldProcess);
     33 
     34  // Helper method that applies policyMethod across all policies in mPolicies
     35  // with the given parameters
     36  nsresult CheckPolicy(CPMethod policyMethod, nsIURI* aURI,
     37                       nsILoadInfo* aLoadInfo, int16_t* decision);
     38 };
     39 
     40 nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
     41 
     42 #endif /* __nsContentPolicy_h__ */