tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsIContentPermissionPrompt.idl (3115B)


      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 mozIDOMWindow;
      9 interface nsIArray;
     10 
     11 webidl Element;
     12 
     13 /**
     14 *  Interface provides the request type and its access.
     15 */
     16 [scriptable, uuid(ef4db3b8-ca9c-4b1d-8f81-fd88ec32af13)]
     17 interface nsIContentPermissionType : nsISupports {
     18  /**
     19   *  The type of the permission request, such as
     20   *  "geolocation".
     21   */
     22  readonly attribute ACString type;
     23 
     24  /**
     25   * The array of available options.
     26   */
     27  readonly attribute nsIArray options; // ["choice1", "choice2"]
     28 };
     29 
     30 /**
     31 * Interface allows access to a content to request
     32 * permission to perform a privileged operation such as
     33 * geolocation.
     34 */
     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.
     40   */
     41  readonly attribute nsIArray types;
     42 
     43  /*
     44   *  The principal of the permission request.
     45   */
     46  readonly attribute nsIPrincipal principal;
     47 
     48  /*
     49   *  The principal of the top-level page the permission request comes from.
     50   */
     51  readonly attribute nsIPrincipal topLevelPrincipal;
     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 mozIDOMWindow window;
     60  readonly attribute Element element;
     61 
     62  readonly attribute boolean hasValidTransientUserGestureActivation;
     63 
     64  /**
     65   * See nsIPermissionDelegateHandler.maybeUnsafePermissionDelegate.
     66   */
     67  readonly attribute boolean isRequestDelegatedToUnsafeThirdParty;
     68 
     69  /*
     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.
     73   *
     74   * @param aType the permission type to get
     75   */
     76  nsIPrincipal getDelegatePrincipal(in ACString aType);
     77 
     78  /**
     79   * Notify that the permission prompt has been shown to the user.
     80   * This is called when the prompt UI is displayed, before the user
     81   * makes a decision to allow or deny.
     82   */
     83  void notifyShown();
     84 
     85  /**
     86   * allow or cancel the request
     87   */
     88  [can_run_script]
     89  void cancel();
     90  [can_run_script]
     91  void allow([optional] in jsval choices); // {"type1": "choice1", "type2": "choiceA"}
     92 };
     93 
     94 /**
     95 * Allows to show permission prompts via the UI for different types of requests,
     96 * e.g. geolocation.
     97 */
     98 [scriptable, function, uuid(F72DE90D-E954-4E69-9A61-917303029301)]
     99 interface nsIContentPermissionPrompt : nsISupports {
    100  /**
    101   * Called when a request has been made to access
    102   * privileged content apis
    103   */
    104  void prompt(in nsIContentPermissionRequest request);
    105 };
    106 
    107 %{C++
    108 #define NS_CONTENT_PERMISSION_PROMPT_CONTRACTID   "@mozilla.org/content-permission/prompt;1"
    109 %}