|
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 #include "nsISupports.idl" |
|
6 |
|
7 interface nsIPrincipal; |
|
8 interface nsIDOMWindow; |
|
9 interface nsIDOMElement; |
|
10 interface nsIArray; |
|
11 |
|
12 /** |
|
13 * Interface provides the request type and its access. |
|
14 */ |
|
15 [scriptable, uuid(ef4db3b8-ca9c-4b1d-8f81-fd88ec32af13)] |
|
16 interface nsIContentPermissionType : nsISupports { |
|
17 /** |
|
18 * The type of the permission request, such as |
|
19 * "geolocation". |
|
20 */ |
|
21 readonly attribute ACString type; |
|
22 |
|
23 /** |
|
24 * The access of the permission request, such as |
|
25 * "read". |
|
26 */ |
|
27 readonly attribute ACString access; |
|
28 |
|
29 /** |
|
30 * The array of available options. |
|
31 */ |
|
32 readonly attribute nsIArray options; // ["choice1", "choice2"] |
|
33 }; |
|
34 |
|
35 /** |
|
36 * Interface allows access to a content to request |
|
37 * permission to perform a privileged operation such as |
|
38 * geolocation. |
|
39 */ |
|
40 [scriptable, uuid(69a39d88-d1c4-4ba9-9b19-bafc7a1bb783)] |
|
41 interface nsIContentPermissionRequest : nsISupports { |
|
42 /** |
|
43 * The array will include the request types. Elements of this array are |
|
44 * nsIContentPermissionType object. |
|
45 */ |
|
46 readonly attribute nsIArray types; |
|
47 |
|
48 /* |
|
49 * The principal of the permission request. |
|
50 */ |
|
51 readonly attribute nsIPrincipal principal; |
|
52 |
|
53 /** |
|
54 * The window or element that the permission request was |
|
55 * originated in. Typically the element will be non-null |
|
56 * in when using out of process content. window or |
|
57 * element can be null but not both. |
|
58 */ |
|
59 readonly attribute nsIDOMWindow window; |
|
60 readonly attribute nsIDOMElement element; |
|
61 |
|
62 /** |
|
63 * allow or cancel the request |
|
64 */ |
|
65 |
|
66 void cancel(); |
|
67 void allow([optional] in jsval choices); // {"type1": "choice1", "type2": "choiceA"} |
|
68 }; |
|
69 |
|
70 /** |
|
71 * Interface provides a way for the application to handle |
|
72 * the UI prompts associated with geo position. |
|
73 */ |
|
74 [scriptable, function, uuid(F72DE90D-E954-4E69-9A61-917303029301)] |
|
75 interface nsIContentPermissionPrompt : nsISupports { |
|
76 /** |
|
77 * Called when a request has been made to access |
|
78 * privileged content apis |
|
79 */ |
|
80 void prompt(in nsIContentPermissionRequest request); |
|
81 }; |
|
82 |
|
83 %{C++ |
|
84 #define NS_CONTENT_PERMISSION_PROMPT_CONTRACTID "@mozilla.org/content-permission/prompt;1" |
|
85 %} |