content/base/src/nsContentPolicy.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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