1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/interfaces/base/nsIContentPermissionPrompt.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,85 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 + 1.10 +interface nsIPrincipal; 1.11 +interface nsIDOMWindow; 1.12 +interface nsIDOMElement; 1.13 +interface nsIArray; 1.14 + 1.15 +/** 1.16 + * Interface provides the request type and its access. 1.17 + */ 1.18 +[scriptable, uuid(ef4db3b8-ca9c-4b1d-8f81-fd88ec32af13)] 1.19 +interface nsIContentPermissionType : nsISupports { 1.20 + /** 1.21 + * The type of the permission request, such as 1.22 + * "geolocation". 1.23 + */ 1.24 + readonly attribute ACString type; 1.25 + 1.26 + /** 1.27 + * The access of the permission request, such as 1.28 + * "read". 1.29 + */ 1.30 + readonly attribute ACString access; 1.31 + 1.32 + /** 1.33 + * The array of available options. 1.34 + */ 1.35 + readonly attribute nsIArray options; // ["choice1", "choice2"] 1.36 +}; 1.37 + 1.38 +/** 1.39 + * Interface allows access to a content to request 1.40 + * permission to perform a privileged operation such as 1.41 + * geolocation. 1.42 + */ 1.43 +[scriptable, uuid(69a39d88-d1c4-4ba9-9b19-bafc7a1bb783)] 1.44 +interface nsIContentPermissionRequest : nsISupports { 1.45 + /** 1.46 + * The array will include the request types. Elements of this array are 1.47 + * nsIContentPermissionType object. 1.48 + */ 1.49 + readonly attribute nsIArray types; 1.50 + 1.51 + /* 1.52 + * The principal of the permission request. 1.53 + */ 1.54 + readonly attribute nsIPrincipal principal; 1.55 + 1.56 + /** 1.57 + * The window or element that the permission request was 1.58 + * originated in. Typically the element will be non-null 1.59 + * in when using out of process content. window or 1.60 + * element can be null but not both. 1.61 + */ 1.62 + readonly attribute nsIDOMWindow window; 1.63 + readonly attribute nsIDOMElement element; 1.64 + 1.65 + /** 1.66 + * allow or cancel the request 1.67 + */ 1.68 + 1.69 + void cancel(); 1.70 + void allow([optional] in jsval choices); // {"type1": "choice1", "type2": "choiceA"} 1.71 +}; 1.72 + 1.73 +/** 1.74 + * Interface provides a way for the application to handle 1.75 + * the UI prompts associated with geo position. 1.76 + */ 1.77 +[scriptable, function, uuid(F72DE90D-E954-4E69-9A61-917303029301)] 1.78 +interface nsIContentPermissionPrompt : nsISupports { 1.79 + /** 1.80 + * Called when a request has been made to access 1.81 + * privileged content apis 1.82 + */ 1.83 + void prompt(in nsIContentPermissionRequest request); 1.84 +}; 1.85 + 1.86 +%{C++ 1.87 +#define NS_CONTENT_PERMISSION_PROMPT_CONTRACTID "@mozilla.org/content-permission/prompt;1" 1.88 +%}