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

Unified Diff: chrome/browser/ui/search/search_tab_helper.h

Issue 10944016: Switch SearchTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/ui/search/search_tab_helper.h
diff --git a/chrome/browser/ui/search/search_tab_helper.h b/chrome/browser/ui/search/search_tab_helper.h
index 8eb96d2144fd230e422976bb9f745d85b2f39d6c..d9c061036415e893a67405c3a5becf6fcf6c0058 100644
--- a/chrome/browser/ui/search/search_tab_helper.h
+++ b/chrome/browser/ui/search/search_tab_helper.h
@@ -6,13 +6,13 @@
#define CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_
#include "base/basictypes.h"
+#include "chrome/browser/tab_contents/web_contents_user_data.h"
#include "chrome/browser/ui/search/search_model.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
class OmniboxEditModel;
-class TabContents;
namespace content {
class RenderViewHost;
@@ -26,9 +26,9 @@ namespace search {
// Per-tab search "helper". Acts as the owner and controller of the tab's
// search UI model.
class SearchTabHelper : public content::WebContentsObserver,
- public content::NotificationObserver {
+ public content::NotificationObserver,
+ public WebContentsUserData<SearchTabHelper> {
public:
- SearchTabHelper(TabContents* contents, bool is_search_enabled);
virtual ~SearchTabHelper();
SearchModel* model() {
@@ -59,6 +59,10 @@ class SearchTabHelper : public content::WebContentsObserver,
const content::NotificationDetails& details) OVERRIDE;
private:
+ explicit SearchTabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
+ friend class WebContentsUserData<SearchTabHelper>;
+
// Enum of the load states for the NTP.
//
// Once the user loads the NTP the |ntp_load_state_| changes to
@@ -94,12 +98,12 @@ class SearchTabHelper : public content::WebContentsObserver,
void UpdateModelBasedOnURL(const GURL& url, NTPLoadState state, bool animate);
// Returns the web contents associated with the tab that owns this helper.
- content::WebContents* web_contents();
+ const content::WebContents* web_contents() const;
// Returns the current RenderWidgetHost of the |web_contents()|.
content::RenderWidgetHost* GetRenderWidgetHost();
- const bool is_search_enabled_;
+ bool is_search_enabled_;
bool is_initial_navigation_commit_;

Powered by Google App Engine
This is Rietveld 408576698