michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIPrincipal; michael@0: interface nsIDOMWindow; michael@0: interface nsIDOMElement; michael@0: interface nsIArray; michael@0: michael@0: /** michael@0: * Interface provides the request type and its access. michael@0: */ michael@0: [scriptable, uuid(ef4db3b8-ca9c-4b1d-8f81-fd88ec32af13)] michael@0: interface nsIContentPermissionType : nsISupports { michael@0: /** michael@0: * The type of the permission request, such as michael@0: * "geolocation". michael@0: */ michael@0: readonly attribute ACString type; michael@0: michael@0: /** michael@0: * The access of the permission request, such as michael@0: * "read". michael@0: */ michael@0: readonly attribute ACString access; michael@0: michael@0: /** michael@0: * The array of available options. michael@0: */ michael@0: readonly attribute nsIArray options; // ["choice1", "choice2"] michael@0: }; michael@0: michael@0: /** michael@0: * Interface allows access to a content to request michael@0: * permission to perform a privileged operation such as michael@0: * geolocation. michael@0: */ michael@0: [scriptable, uuid(69a39d88-d1c4-4ba9-9b19-bafc7a1bb783)] michael@0: interface nsIContentPermissionRequest : nsISupports { michael@0: /** michael@0: * The array will include the request types. Elements of this array are michael@0: * nsIContentPermissionType object. michael@0: */ michael@0: readonly attribute nsIArray types; michael@0: michael@0: /* michael@0: * The principal of the permission request. michael@0: */ michael@0: readonly attribute nsIPrincipal principal; michael@0: michael@0: /** michael@0: * The window or element that the permission request was michael@0: * originated in. Typically the element will be non-null michael@0: * in when using out of process content. window or michael@0: * element can be null but not both. michael@0: */ michael@0: readonly attribute nsIDOMWindow window; michael@0: readonly attribute nsIDOMElement element; michael@0: michael@0: /** michael@0: * allow or cancel the request michael@0: */ michael@0: michael@0: void cancel(); michael@0: void allow([optional] in jsval choices); // {"type1": "choice1", "type2": "choiceA"} michael@0: }; michael@0: michael@0: /** michael@0: * Interface provides a way for the application to handle michael@0: * the UI prompts associated with geo position. michael@0: */ michael@0: [scriptable, function, uuid(F72DE90D-E954-4E69-9A61-917303029301)] michael@0: interface nsIContentPermissionPrompt : nsISupports { michael@0: /** michael@0: * Called when a request has been made to access michael@0: * privileged content apis michael@0: */ michael@0: void prompt(in nsIContentPermissionRequest request); michael@0: }; michael@0: michael@0: %{C++ michael@0: #define NS_CONTENT_PERMISSION_PROMPT_CONTRACTID "@mozilla.org/content-permission/prompt;1" michael@0: %}