OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/browser/captive_portal/captive_portal_login_detector.h" |
| 6 |
| 7 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" |
| 8 |
| 9 namespace captive_portal { |
| 10 |
| 11 CaptivePortalLoginDetector::CaptivePortalLoginDetector( |
| 12 Profile* profile) |
| 13 : profile_(profile), |
| 14 is_login_tab_(false) { |
| 15 } |
| 16 |
| 17 CaptivePortalLoginDetector::~CaptivePortalLoginDetector() { |
| 18 } |
| 19 |
| 20 void CaptivePortalLoginDetector::OnStoppedLoading() { |
| 21 if (!is_login_tab_) |
| 22 return; |
| 23 // The service is guaranteed to exist if |is_login_tab_| is true, since it's |
| 24 // only set to true once a captive portal is detected. |
| 25 CaptivePortalServiceFactory::GetForProfile(profile_)->DetectCaptivePortal(); |
| 26 } |
| 27 |
| 28 void CaptivePortalLoginDetector::OnCaptivePortalResults( |
| 29 Result previous_result, |
| 30 Result result) { |
| 31 if (result != RESULT_BEHIND_CAPTIVE_PORTAL) |
| 32 is_login_tab_ = false; |
| 33 } |
| 34 |
| 35 } // namespace captive_portal |
OLD | NEW |