Fix build break
[chromium-blink-merge.git] / chrome / browser / captive_portal / captive_portal_login_detector.cc
blobf4737ca23abc9ba7d7f63c578d5bedfcecd3855c
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/captive_portal/captive_portal_login_detector.h"
7 #include "chrome/browser/captive_portal/captive_portal_service_factory.h"
9 namespace captive_portal {
11 CaptivePortalLoginDetector::CaptivePortalLoginDetector(
12 Profile* profile)
13 : profile_(profile),
14 is_login_tab_(false),
15 first_login_tab_load_(false) {
18 CaptivePortalLoginDetector::~CaptivePortalLoginDetector() {
21 void CaptivePortalLoginDetector::OnStoppedLoading() {
22 // Do nothing if this is not a login tab, or if this is a login tab's first
23 // load.
24 if (!is_login_tab_ || first_login_tab_load_) {
25 first_login_tab_load_ = false;
26 return;
29 // The service is guaranteed to exist if |is_login_tab_| is true, since it's
30 // only set to true once a captive portal is detected.
31 CaptivePortalServiceFactory::GetForProfile(profile_)->DetectCaptivePortal();
34 void CaptivePortalLoginDetector::OnCaptivePortalResults(
35 Result previous_result,
36 Result result) {
37 if (result != RESULT_BEHIND_CAPTIVE_PORTAL)
38 is_login_tab_ = false;
41 void CaptivePortalLoginDetector::SetIsLoginTab() {
42 is_login_tab_ = true;
43 first_login_tab_load_ = true;
46 } // namespace captive_portal