Bug 1731994: part 7) Update documentation of `nsIContentPermissionPrompt`. r=edgar...
[gecko.git] / dom / interfaces / base / nsIContentPermissionPrompt.idl
blob856671fc9556d0af26c73d971e00ac1e1c126b2c
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/. */
5 #include "nsISupports.idl"
7 interface nsIPrincipal;
8 interface mozIDOMWindow;
9 interface nsIArray;
11 webidl Element;
13 /**
14 * Interface provides the request type and its access.
16 [scriptable, uuid(ef4db3b8-ca9c-4b1d-8f81-fd88ec32af13)]
17 interface nsIContentPermissionType : nsISupports {
18 /**
19 * The type of the permission request, such as
20 * "geolocation".
22 readonly attribute ACString type;
24 /**
25 * The array of available options.
27 readonly attribute nsIArray options; // ["choice1", "choice2"]
30 /**
31 * Interface allows access to a content to request
32 * permission to perform a privileged operation such as
33 * geolocation.
35 [scriptable, uuid(875733da-0ac0-4a26-8c76-70a30876be46)]
36 interface nsIContentPermissionRequest : nsISupports {
37 /**
38 * The array will include the request types. Elements of this array are
39 * nsIContentPermissionType object.
41 readonly attribute nsIArray types;
44 * The principal of the permission request.
46 readonly attribute nsIPrincipal principal;
49 * The principal of the top-level page the permission request comes from.
51 readonly attribute nsIPrincipal topLevelPrincipal;
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.
59 readonly attribute mozIDOMWindow window;
60 readonly attribute Element element;
62 readonly attribute boolean isHandlingUserInput;
64 /**
65 * See nsIPermissionDelegateHandler.maybeUnsafePermissionDelegate.
67 readonly attribute boolean isRequestDelegatedToUnsafeThirdParty;
70 * Get delegate principal of the permission request. This will return nullptr,
71 * or request's principal or top level principal based on the delegate policy
72 * will be applied for a given type.
74 * @param aType the permission type to get
76 nsIPrincipal getDelegatePrincipal(in ACString aType);
78 /**
79 * allow or cancel the request
81 [can_run_script]
82 void cancel();
83 [can_run_script]
84 void allow([optional] in jsval choices); // {"type1": "choice1", "type2": "choiceA"}
87 /**
88 * Allows to show permission prompts via the UI for different types of requests,
89 * e.g. geolocation.
91 [scriptable, function, uuid(F72DE90D-E954-4E69-9A61-917303029301)]
92 interface nsIContentPermissionPrompt : nsISupports {
93 /**
94 * Called when a request has been made to access
95 * privileged content apis
97 void prompt(in nsIContentPermissionRequest request);
100 %{C++
101 #define NS_CONTENT_PERMISSION_PROMPT_CONTRACTID "@mozilla.org/content-permission/prompt;1"