blob: 82d8a2145d0b8ba64d58b73a86144fec79bdb145 [file] [log] [blame]
[email protected]871dc682012-06-11 19:35:331// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]c8865482009-07-23 20:40:102// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]11f4857282009-11-13 19:56:175#ifndef CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_
6#define CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_
[email protected]c8865482009-07-23 20:40:107
[email protected]49fd7e22011-11-21 16:52:218#include "base/compiler_specific.h"
[email protected]6c2381d2011-10-19 02:52:539#include "content/public/browser/notification_observer.h"
10#include "content/public/browser/notification_registrar.h"
[email protected]46b3c982012-10-09 18:38:3011#include "content/public/browser/web_contents_user_data.h"
[email protected]c8865482009-07-23 20:40:1012
13class Profile;
[email protected]ef01920d2012-09-18 19:05:0714
15namespace content {
16class WebContents;
17}
[email protected]c8865482009-07-23 20:40:1018
19// This class is responsible for showing an info-bar that tells the user she
20// can type her search query directly in the omnibox.
21// It is displayed when the user visits a known search engine URL and has not
22// searched from the omnibox before, or has not previously dismissed a similar
23// info-bar.
[email protected]46b3c982012-10-09 18:38:3024class OmniboxSearchHint
25 : public content::NotificationObserver,
26 public content::WebContentsUserData<OmniboxSearchHint> {
[email protected]c8865482009-07-23 20:40:1027 public:
[email protected]3690ebe02011-05-25 09:08:1928 virtual ~OmniboxSearchHint();
[email protected]c8865482009-07-23 20:40:1029
[email protected]6c2381d2011-10-19 02:52:5330 // content::NotificationObserver method:
[email protected]432115822011-07-10 15:52:2731 virtual void Observe(int type,
[email protected]6c2381d2011-10-19 02:52:5332 const content::NotificationSource& source,
[email protected]49fd7e22011-11-21 16:52:2133 const content::NotificationDetails& details) OVERRIDE;
[email protected]c8865482009-07-23 20:40:1034
35 // Focus the location bar and displays a message instructing that search
36 // queries can be typed directly in there.
37 void ShowEnteringQuery();
38
[email protected]c8865482009-07-23 20:40:1039 // Disables the hint infobar permanently, so that it does not show ever again.
40 void DisableHint();
41
42 // Returns true if the profile and current environment make the showing of the
43 // hint infobar possible.
44 static bool IsEnabled(Profile* profile);
45
46 private:
[email protected]ef01920d2012-09-18 19:05:0747 explicit OmniboxSearchHint(content::WebContents* web_contents);
[email protected]46b3c982012-10-09 18:38:3048 friend class content::WebContentsUserData<OmniboxSearchHint>;
[email protected]ef01920d2012-09-18 19:05:0749
[email protected]6c2381d2011-10-19 02:52:5350 content::NotificationRegistrar notification_registrar_;
[email protected]c8865482009-07-23 20:40:1051
[email protected]ef01920d2012-09-18 19:05:0752 // The contents we are associated with.
53 content::WebContents* web_contents_;
[email protected]c8865482009-07-23 20:40:1054
[email protected]c8865482009-07-23 20:40:1055 DISALLOW_COPY_AND_ASSIGN(OmniboxSearchHint);
56};
57
[email protected]11f4857282009-11-13 19:56:1758#endif // CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_