tor-browser

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

nsICaptivePortalService.idl (2649B)


      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 [scriptable, uuid(b5fd5629-d04c-4138-9529-9311f291ecd4)]
      8 interface nsICaptivePortalServiceCallback : nsISupports
      9 {
     10  /**
     11   * Invoke callbacks after captive portal detection finished.
     12   */
     13  void complete(in boolean success, in nsresult error);
     14 };
     15 
     16 /**
     17 * Service used for captive portal detection.
     18 * The service is only active in the main process. It is also available in the
     19 * content process, but only to mirror the captive portal state from the main
     20 * process.
     21 */
     22 [scriptable, uuid(bdbe0555-fc3d-4f7b-9205-c309ceb2d641)]
     23 interface nsICaptivePortalService : nsISupports
     24 {
     25  const long UNKNOWN          = 0;
     26  const long NOT_CAPTIVE      = 1;
     27  const long UNLOCKED_PORTAL  = 2;
     28  const long LOCKED_PORTAL    = 3;
     29 
     30  /**
     31   * Called from XPCOM to trigger a captive portal recheck.
     32   * A network request will only be performed if no other checks are currently
     33   * ongoing.
     34   * Will not do anything if called in the content process.
     35   */
     36  void recheckCaptivePortal();
     37 
     38  /**
     39   * Returns the state of the captive portal.
     40   */
     41  readonly attribute long state;
     42 
     43 %{C++
     44  int32_t State() {
     45    int32_t result = nsICaptivePortalService::UNKNOWN;
     46    GetState(&result);
     47    return result;
     48  }
     49 %}
     50 
     51  /**
     52   * Returns the time difference between NOW and the last time a request was
     53   * completed in milliseconds.
     54   */
     55  readonly attribute unsigned long long lastChecked;
     56 };
     57 
     58 %{C++
     59 /**
     60 * This observer notification will be emitted when the captive portal state
     61 * changes. After receiving it, the ContentParent will send an IPC message
     62 * to the ContentChild, which will set the state in the captive portal service
     63 * in the child.
     64 */
     65 #define NS_IPC_CAPTIVE_PORTAL_SET_STATE "ipc:network:captive-portal-set-state"
     66 
     67 /**
     68 * This notification will be emitted when the captive portal service has
     69 * determined that we can connect to the internet.
     70 * The service will pass either "captive" if there is an unlocked captive portal
     71 * present, or "clear" if no captive portal was detected.
     72 * Note: this notification only gets sent in the parent process.
     73 */
     74 #define NS_CAPTIVE_PORTAL_CONNECTIVITY "network:captive-portal-connectivity"
     75 
     76 /**
     77 * Similar to NS_CAPTIVE_PORTAL_CONNECTIVITY but only gets dispatched when
     78 * the connectivity changes from UNKNOWN to NOT_CAPTIVE or from LOCKED_PORTAL
     79 * to UNLOCKED_PORTAL.
     80 */
     81 #define NS_CAPTIVE_PORTAL_CONNECTIVITY_CHANGED "network:captive-portal-connectivity-changed"
     82 
     83 %}