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

Unified Diff: chrome/browser/omnibox_search_hint.h

Issue 10951008: Switch OmniboxSearchHint 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
« no previous file with comments | « no previous file | chrome/browser/omnibox_search_hint.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/omnibox_search_hint.h
diff --git a/chrome/browser/omnibox_search_hint.h b/chrome/browser/omnibox_search_hint.h
index 90fd9b4667622d10b203391df9eefffca85db2c6..2364669fe33b47af7b3a2f5649eeb2f4e69c2a36 100644
--- a/chrome/browser/omnibox_search_hint.h
+++ b/chrome/browser/omnibox_search_hint.h
@@ -9,20 +9,24 @@
#include <string>
#include "base/compiler_specific.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"
class Profile;
-class TabContents;
+
+namespace content {
+class WebContents;
+}
// This class is responsible for showing an info-bar that tells the user she
// can type her search query directly in the omnibox.
// It is displayed when the user visits a known search engine URL and has not
// searched from the omnibox before, or has not previously dismissed a similar
// info-bar.
-class OmniboxSearchHint : public content::NotificationObserver {
+class OmniboxSearchHint : public content::NotificationObserver,
+ public WebContentsUserData<OmniboxSearchHint> {
public:
- explicit OmniboxSearchHint(TabContents* tab);
virtual ~OmniboxSearchHint();
// content::NotificationObserver method:
@@ -34,8 +38,6 @@ class OmniboxSearchHint : public content::NotificationObserver {
// queries can be typed directly in there.
void ShowEnteringQuery();
- TabContents* tab() { return tab_; }
-
// Disables the hint infobar permanently, so that it does not show ever again.
void DisableHint();
@@ -44,12 +46,16 @@ class OmniboxSearchHint : public content::NotificationObserver {
static bool IsEnabled(Profile* profile);
private:
+ explicit OmniboxSearchHint(content::WebContents* web_contents);
+ static int kUserDataKey;
+ friend class WebContentsUserData<OmniboxSearchHint>;
+
void ShowInfoBar();
content::NotificationRegistrar notification_registrar_;
- // The tab we are associated with.
- TabContents* tab_;
+ // The contents we are associated with.
+ content::WebContents* web_contents_;
// A map containing the URLs of the search engine for which we want to
// trigger the hint.
« no previous file with comments | « no previous file | chrome/browser/omnibox_search_hint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698