Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / captive_portal / captive_portal_login_detector.h
blob1324e3eb492f7de97848114e7ee644bb8755213b
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 #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_LOGIN_DETECTOR_H_
6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_LOGIN_DETECTOR_H_
8 #include "base/basictypes.h"
9 #include "chrome/browser/captive_portal/captive_portal_service.h"
11 class Profile;
13 // Triggers a captive portal test on navigations that may indicate a captive
14 // portal has been logged into. Currently only tracks if a page was opened
15 // at a captive portal tab's login page, and triggers checks every navigation
16 // until there's no longer a captive portal, relying on the
17 // CaptivePortalService's throttling to prevent excessive server load.
19 // TODO(mmenke): If a page has been broken by a captive portal, and it's
20 // successfully reloaded, trigger a captive portal check.
21 class CaptivePortalLoginDetector {
22 public:
23 explicit CaptivePortalLoginDetector(Profile* profile);
25 ~CaptivePortalLoginDetector();
27 void OnStoppedLoading();
28 void OnCaptivePortalResults(
29 captive_portal::CaptivePortalResult previous_result,
30 captive_portal::CaptivePortalResult result);
32 bool is_login_tab() const { return is_login_tab_; }
33 void SetIsLoginTab();
35 private:
36 Profile* profile_;
38 // True if this is a login tab. Set manually, automatically cleared once
39 // login is detected.
40 bool is_login_tab_;
42 // Page is on its first load since being tagged as a login tab. Used to
43 // prevent a second captive portal check on the first load of the login page.
44 bool first_login_tab_load_;
46 DISALLOW_COPY_AND_ASSIGN(CaptivePortalLoginDetector);
49 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_LOGIN_DETECTOR_H_