dom/base/nsContentPermissionHelper.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:3b3f16f709b8
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/. */
4
5 #ifndef nsContentPermissionHelper_h
6 #define nsContentPermissionHelper_h
7
8 #include "nsIContentPermissionPrompt.h"
9 #include "nsTArray.h"
10 #include "nsIMutableArray.h"
11
12 class nsContentPermissionRequestProxy;
13
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 }
23
24 namespace mozilla {
25 namespace dom {
26
27 class Element;
28 class PermissionRequest;
29 class ContentPermissionRequestParent;
30 class PContentPermissionRequestParent;
31
32 class ContentPermissionType : public nsIContentPermissionType
33 {
34 public:
35 NS_DECL_ISUPPORTS
36 NS_DECL_NSICONTENTPERMISSIONTYPE
37
38 ContentPermissionType(const nsACString& aType,
39 const nsACString& aAccess,
40 const nsTArray<nsString>& aOptions);
41 virtual ~ContentPermissionType();
42
43 protected:
44 nsCString mType;
45 nsCString mAccess;
46 nsTArray<nsString> mOptions;
47 };
48
49 uint32_t ConvertPermissionRequestToArray(nsTArray<PermissionRequest>& aSrcArray,
50 nsIMutableArray* aDesArray);
51
52 nsresult CreatePermissionArray(const nsACString& aType,
53 const nsACString& aAccess,
54 const nsTArray<nsString>& aOptions,
55 nsIArray** aTypesArray);
56
57 PContentPermissionRequestParent*
58 CreateContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
59 Element* element,
60 const IPC::Principal& principal);
61
62 } // namespace dom
63 } // namespace mozilla
64
65 class nsContentPermissionRequestProxy : public nsIContentPermissionRequest
66 {
67 public:
68 NS_DECL_ISUPPORTS
69 NS_DECL_NSICONTENTPERMISSIONREQUEST
70
71 nsContentPermissionRequestProxy();
72 virtual ~nsContentPermissionRequestProxy();
73
74 nsresult Init(const nsTArray<mozilla::dom::PermissionRequest>& requests,
75 mozilla::dom::ContentPermissionRequestParent* parent);
76 void OnParentDestroyed();
77
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 };
83
84 #endif // nsContentPermissionHelper_h

mercurial