Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: chrome/browser/captive_portal/captive_portal_login_detector.h

Issue 10020051: Open a login tab on captive portal detection on SSL loads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix typo in comment, forward declare CaptivePortalTabReloader in the TabHelper Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/captive_portal/captive_portal_login_detector.h
===================================================================
--- chrome/browser/captive_portal/captive_portal_login_detector.h (revision 0)
+++ chrome/browser/captive_portal/captive_portal_login_detector.h (revision 0)
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_LOGIN_DETECTOR_H_
+#define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_LOGIN_DETECTOR_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "chrome/browser/captive_portal/captive_portal_service.h"
+
+class Profile;
+
+namespace captive_portal {
+
+// Triggers a captive portal test on navigations that may indicate a captive
+// portal has been logged into. Currently only tracks if a page was opened
+// at a captive portal tab's login page, and triggers checks every navigation
+// until there's no longer a captive portal, relying on the
+// CaptivePortalService's throttling to prevent excessive server load.
+//
+// TODO(mmenke): If a page has been broken by a captive portal, and it's
+// successfully reloaded, trigger a captive portal check.
+class CaptivePortalLoginDetector {
+ public:
+ explicit CaptivePortalLoginDetector(Profile* profile);
+
+ ~CaptivePortalLoginDetector();
+
+ void OnStoppedLoading();
+ void OnCaptivePortalResults(Result previous_result, Result result);
+
+ bool is_login_tab() const { return is_login_tab_; }
+ void set_is_login_tab() { is_login_tab_ = true; }
+
+ private:
+ Profile* profile_;
+
+ // True if this is a login tab. Set manually, automatically cleared once
+ // login is detected.
+ bool is_login_tab_;
+
+ DISALLOW_COPY_AND_ASSIGN(CaptivePortalLoginDetector);
+};
+
+} // namespace captive_portal
+
+#endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_LOGIN_DETECTOR_H_

Powered by Google App Engine
This is Rietveld 408576698