extensions/permissions/nsContentBlocker.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extensions/permissions/nsContentBlocker.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +#ifndef nsContentBlocker_h__
     1.8 +#define nsContentBlocker_h__
     1.9 +
    1.10 +#include "nsIContentPolicy.h"
    1.11 +#include "nsIObserver.h"
    1.12 +#include "nsWeakReference.h"
    1.13 +#include "nsIPermissionManager.h"
    1.14 +#include "nsIPrefBranch.h"
    1.15 +#include "mozilla/Attributes.h"
    1.16 +
    1.17 +class nsIPrefBranch;
    1.18 +
    1.19 +////////////////////////////////////////////////////////////////////////////////
    1.20 +
    1.21 +class nsContentBlocker MOZ_FINAL : public nsIContentPolicy,
    1.22 +                                   public nsIObserver,
    1.23 +                                   public nsSupportsWeakReference
    1.24 +{
    1.25 +public:
    1.26 +
    1.27 +  // nsISupports
    1.28 +  NS_DECL_ISUPPORTS
    1.29 +  NS_DECL_NSICONTENTPOLICY
    1.30 +  NS_DECL_NSIOBSERVER
    1.31 +
    1.32 +  nsContentBlocker();
    1.33 +  nsresult Init();
    1.34 +
    1.35 +private:
    1.36 +  ~nsContentBlocker() {}
    1.37 +
    1.38 +  void PrefChanged(nsIPrefBranch *, const char *);
    1.39 +  nsresult TestPermission(nsIURI *aCurrentURI,
    1.40 +                          nsIURI *aFirstURI,
    1.41 +                          int32_t aContentType,
    1.42 +                          bool *aPermission,
    1.43 +                          bool *aFromPrefs);
    1.44 +
    1.45 +  nsCOMPtr<nsIPermissionManager> mPermissionManager;
    1.46 +  nsCOMPtr<nsIPrefBranch> mPrefBranchInternal;
    1.47 +  static uint8_t mBehaviorPref[];
    1.48 +};
    1.49 +
    1.50 +#define NS_CONTENTBLOCKER_CID \
    1.51 +{ 0x4ca6b67b, 0x5cc7, 0x4e71, \
    1.52 +  { 0xa9, 0x8a, 0x97, 0xaf, 0x1c, 0x13, 0x48, 0x62 } }
    1.53 +
    1.54 +#define NS_CONTENTBLOCKER_CONTRACTID "@mozilla.org/permissions/contentblocker;1"
    1.55 +
    1.56 +#endif /* nsContentBlocker_h__ */

mercurial