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