content/base/src/nsContentPolicy.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 // vim: ft=cpp ts=8 sw=4 et tw=78
     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/. */
     7 #ifndef __nsContentPolicy_h__
     8 #define __nsContentPolicy_h__
    10 #include "nsIContentPolicy.h"
    11 #include "nsCategoryCache.h"
    13 /* 
    14  * Implementation of the "@mozilla.org/layout/content-policy;1" contract.
    15  */
    17 class nsContentPolicy : public nsIContentPolicy
    18 {
    19  public:
    20     NS_DECL_ISUPPORTS
    21     NS_DECL_NSICONTENTPOLICY
    23     nsContentPolicy();
    24     virtual ~nsContentPolicy();
    25  private:
    26     //Array of policies
    27     nsCategoryCache<nsIContentPolicy> mPolicies;
    29     //Helper type for CheckPolicy
    30     typedef
    31     NS_STDCALL_FUNCPROTO(nsresult, CPMethod, nsIContentPolicy,
    32                          ShouldProcess,
    33                          (uint32_t, nsIURI*, nsIURI*, nsISupports*,
    34                            const nsACString &, nsISupports*, nsIPrincipal*,
    35                            int16_t*));
    37     //Helper method that applies policyMethod across all policies in mPolicies
    38     // with the given parameters
    39     nsresult CheckPolicy(CPMethod policyMethod, uint32_t contentType,
    40                          nsIURI *aURI, nsIURI *origURI,
    41                          nsISupports *requestingContext,
    42                          const nsACString &mimeGuess, nsISupports *extra,
    43                          nsIPrincipal *requestPrincipal,
    44                          int16_t *decision);
    45 };
    47 nsresult
    48 NS_NewContentPolicy(nsIContentPolicy **aResult);
    50 #endif /* __nsContentPolicy_h__ */

mercurial