dom/base/nsContentPermissionHelper.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef nsContentPermissionHelper_h
     6 #define nsContentPermissionHelper_h
     8 #include "nsIContentPermissionPrompt.h"
     9 #include "nsTArray.h"
    10 #include "nsIMutableArray.h"
    12 class nsContentPermissionRequestProxy;
    14 // Forward declare IPC::Principal here which is defined in
    15 // PermissionMessageUtils.h. Include this file will transitively includes
    16 // "windows.h" and it defines
    17 //   #define CreateEvent CreateEventW
    18 //   #define LoadImage LoadImageW
    19 // That will mess up windows build.
    20 namespace IPC {
    21 class Principal;
    22 }
    24 namespace mozilla {
    25 namespace dom {
    27 class Element;
    28 class PermissionRequest;
    29 class ContentPermissionRequestParent;
    30 class PContentPermissionRequestParent;
    32 class ContentPermissionType : public nsIContentPermissionType
    33 {
    34 public:
    35   NS_DECL_ISUPPORTS
    36   NS_DECL_NSICONTENTPERMISSIONTYPE
    38   ContentPermissionType(const nsACString& aType,
    39                         const nsACString& aAccess,
    40                         const nsTArray<nsString>& aOptions);
    41   virtual ~ContentPermissionType();
    43 protected:
    44   nsCString mType;
    45   nsCString mAccess;
    46   nsTArray<nsString> mOptions;
    47 };
    49 uint32_t ConvertPermissionRequestToArray(nsTArray<PermissionRequest>& aSrcArray,
    50                                          nsIMutableArray* aDesArray);
    52 nsresult CreatePermissionArray(const nsACString& aType,
    53                                const nsACString& aAccess,
    54                                const nsTArray<nsString>& aOptions,
    55                                nsIArray** aTypesArray);
    57 PContentPermissionRequestParent*
    58 CreateContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
    59                                      Element* element,
    60                                      const IPC::Principal& principal);
    62 } // namespace dom
    63 } // namespace mozilla
    65 class nsContentPermissionRequestProxy : public nsIContentPermissionRequest
    66 {
    67  public:
    68   NS_DECL_ISUPPORTS
    69   NS_DECL_NSICONTENTPERMISSIONREQUEST
    71   nsContentPermissionRequestProxy();
    72   virtual ~nsContentPermissionRequestProxy();
    74   nsresult Init(const nsTArray<mozilla::dom::PermissionRequest>& requests,
    75                 mozilla::dom::ContentPermissionRequestParent* parent);
    76   void OnParentDestroyed();
    78  private:
    79   // Non-owning pointer to the ContentPermissionRequestParent object which owns this proxy.
    80   mozilla::dom::ContentPermissionRequestParent* mParent;
    81   nsTArray<mozilla::dom::PermissionRequest> mPermissionRequests;
    82 };
    84 #endif // nsContentPermissionHelper_h

mercurial