Source code

Revision control

Other Tools

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 bool 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
/**
44
* Returns the time difference between NOW and the last time a request was
45
* completed in milliseconds.
46
*/
47
readonly attribute unsigned long long lastChecked;
48
};
49
50
%{C++
51
/**
52
* This observer notification will be emitted when the captive portal state
53
* changes. After receiving it, the ContentParent will send an IPC message
54
* to the ContentChild, which will set the state in the captive portal service
55
* in the child.
56
*/
57
#define NS_IPC_CAPTIVE_PORTAL_SET_STATE "ipc:network:captive-portal-set-state"
58
59
/**
60
* This notification will be emitted when the captive portal service has
61
* determined that we can connect to the internet.
62
* The service will pass either "captive" if there is an unlocked captive portal
63
* present, or "clear" if no captive portal was detected.
64
* Note: this notification only gets sent in the parent process.
65
*/
66
#define NS_CAPTIVE_PORTAL_CONNECTIVITY "network:captive-portal-connectivity"
67
68
%}