forked from mirrors/gecko-dev
Bug 1422277 - Add an observer notification for when the captive portal detection is "done" r=bagder
MozReview-Commit-ID: D9Qr0CuUJiQ --HG-- extra : rebase_source : 74ecc449bee263d27af83fa101e6ef59166fecab
This commit is contained in:
parent
64e1bd8242
commit
d093ecbe77
3 changed files with 23 additions and 0 deletions
|
|
@ -335,6 +335,17 @@ CaptivePortalService::Observe(nsISupports *aSubject,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CaptivePortalService::NotifyConnectivityAvailable(bool aCaptive)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
|
||||||
|
if (observerService) {
|
||||||
|
nsCOMPtr<nsICaptivePortalService> cps(this);
|
||||||
|
observerService->NotifyObservers(cps, NS_CAPTIVE_PORTAL_CONNECTIVITY,
|
||||||
|
aCaptive ? u"captive" : u"clear");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// CaptivePortalService::nsICaptivePortalCallback
|
// CaptivePortalService::nsICaptivePortalCallback
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -364,8 +375,10 @@ CaptivePortalService::Complete(bool success)
|
||||||
if (success) {
|
if (success) {
|
||||||
if (mEverBeenCaptive) {
|
if (mEverBeenCaptive) {
|
||||||
mState = UNLOCKED_PORTAL;
|
mState = UNLOCKED_PORTAL;
|
||||||
|
NotifyConnectivityAvailable(true);
|
||||||
} else {
|
} else {
|
||||||
mState = NOT_CAPTIVE;
|
mState = NOT_CAPTIVE;
|
||||||
|
NotifyConnectivityAvailable(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ private:
|
||||||
virtual ~CaptivePortalService();
|
virtual ~CaptivePortalService();
|
||||||
nsresult PerformCheck();
|
nsresult PerformCheck();
|
||||||
nsresult RearmTimer();
|
nsresult RearmTimer();
|
||||||
|
void NotifyConnectivityAvailable(bool aCaptive);
|
||||||
|
|
||||||
nsCOMPtr<nsICaptivePortalDetector> mCaptivePortalDetector;
|
nsCOMPtr<nsICaptivePortalDetector> mCaptivePortalDetector;
|
||||||
int32_t mState;
|
int32_t mState;
|
||||||
|
|
|
||||||
|
|
@ -56,4 +56,13 @@ interface nsICaptivePortalService : nsISupports
|
||||||
*/
|
*/
|
||||||
#define NS_IPC_CAPTIVE_PORTAL_SET_STATE "ipc:network:captive-portal-set-state"
|
#define NS_IPC_CAPTIVE_PORTAL_SET_STATE "ipc:network:captive-portal-set-state"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This notification will be emitted when the captive portal service has
|
||||||
|
* determined that we can connect to the internet.
|
||||||
|
* The service will pass either "captive" if there is an unlocked captive portal
|
||||||
|
* present, or "clear" if no captive portal was detected.
|
||||||
|
* Note: this notification only gets sent in the parent process.
|
||||||
|
*/
|
||||||
|
#define NS_CAPTIVE_PORTAL_CONNECTIVITY "network:captive-portal-connectivity"
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue