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

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

Issue 10946011: Switch CaptivePortalTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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_tab_helper.h
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.h b/chrome/browser/captive_portal/captive_portal_tab_helper.h
index ac117b08377797131a679d42b68a9e4cc1383ff0..70e94c0bdbcc431e81ad4ec7cb577573fa433930 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.h
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.h
@@ -10,6 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "chrome/browser/captive_portal/captive_portal_service.h"
+#include "chrome/browser/tab_contents/web_contents_user_data.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
@@ -51,12 +52,12 @@ class CaptivePortalTabReloader;
//
// For the design doc, see:
// https://docs.google.com/document/d/1k-gP2sswzYNvryu9NcgN7q5XrsMlUdlUdoW9WRaEmfM/edit
-class CaptivePortalTabHelper : public content::WebContentsObserver,
- public content::NotificationObserver,
- public base::NonThreadSafe {
+class CaptivePortalTabHelper
+ : public content::WebContentsObserver,
+ public content::NotificationObserver,
+ public base::NonThreadSafe,
+ public WebContentsUserData<CaptivePortalTabHelper> {
public:
- CaptivePortalTabHelper(Profile* profile,
- content::WebContents* web_contents);
virtual ~CaptivePortalTabHelper();
// content::WebContentsObserver:
@@ -102,6 +103,10 @@ class CaptivePortalTabHelper : public content::WebContentsObserver,
friend class CaptivePortalBrowserTest;
friend class CaptivePortalTabHelperTest;
+ friend class WebContentsUserData<CaptivePortalTabHelper>;
+ static int kUserDataKey;
+ explicit CaptivePortalTabHelper(content::WebContents* web_contents);
+
// Called by Observe in response to the corresponding event.
void OnRedirect(int child_id,
ResourceType::Type resource_type,
@@ -128,12 +133,12 @@ class CaptivePortalTabHelper : public content::WebContentsObserver,
// Opens a login tab if the profile's active window doesn't have one already.
void OpenLoginTab();
+ Profile* profile_;
+
// Neither of these will ever be NULL.
scoped_ptr<CaptivePortalTabReloader> tab_reloader_;
scoped_ptr<CaptivePortalLoginDetector> login_detector_;
- Profile* profile_;
-
// If a provisional load has failed, and the tab is loading an error page, the
// error code associated with the error page we're loading.
// net::OK, otherwise.

Powered by Google App Engine
This is Rietveld 408576698