diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-18 19:05:07 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-18 19:05:07 +0000 |
commit | ef01920da052e2e52acd193c93792a11744295ab (patch) | |
tree | eabe4a35e3a9e49479d31ed6d1caad1bbab34142 /chrome/browser/omnibox_search_hint.h | |
parent | 1dd534aedf5661cdc4703a57124c902b39d6f2b0 (diff) | |
download | chromium_src-ef01920da052e2e52acd193c93792a11744295ab.zip chromium_src-ef01920da052e2e52acd193c93792a11744295ab.tar.gz chromium_src-ef01920da052e2e52acd193c93792a11744295ab.tar.bz2 |
Switch OmniboxSearchHint to use WebContentsUserData.
BUG=107201
TEST=no visible change
Review URL: https://chromiumcodereview.appspot.com/10951008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/omnibox_search_hint.h')
-rw-r--r-- | chrome/browser/omnibox_search_hint.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/chrome/browser/omnibox_search_hint.h b/chrome/browser/omnibox_search_hint.h index 90fd9b4..2364669 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. |