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 [scriptable
, uuid(b5fd5629
-d04c
-4138-9529-9311f291ecd4
)]
8 interface nsICaptivePortalServiceCallback
: nsISupports
11 * Invoke callbacks after captive portal detection finished.
13 void complete
(in bool success
, in nsresult error
);
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
22 [scriptable
, uuid(bdbe0555
-fc3d
-4f7b
-9205-c309ceb2d641
)]
23 interface nsICaptivePortalService
: nsISupports
25 const long UNKNOWN
= 0;
26 const long NOT_CAPTIVE
= 1;
27 const long UNLOCKED_PORTAL
= 2;
28 const long LOCKED_PORTAL
= 3;
31 * Called from XPCOM to trigger a captive portal recheck.
32 * A network request will only be performed if no other checks are currently
34 * Will not do anything if called in the content process.
36 void recheckCaptivePortal
();
39 * Returns the state of the captive portal.
41 readonly attribute
long state
;
45 int32_t result
= nsICaptivePortalService
::UNKNOWN
;
52 * Returns the time difference between NOW and the last time a request was
53 * completed in milliseconds.
55 readonly attribute
unsigned long long lastChecked
;
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
65 #define NS_IPC_CAPTIVE_PORTAL_SET_STATE
"ipc:network:captive-portal-set-state"
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.
74 #define NS_CAPTIVE_PORTAL_CONNECTIVITY
"network:captive-portal-connectivity"
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
81 #define NS_CAPTIVE_PORTAL_CONNECTIVITY_CHANGED
"network:captive-portal-connectivity-changed"