OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_ | |
6 #define CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "content/public/browser/notification_observer.h" | |
10 #include "content/public/browser/notification_registrar.h" | |
11 #include "content/public/browser/web_contents_user_data.h" | |
12 | |
13 class Profile; | |
14 | |
15 namespace content { | |
16 class WebContents; | |
17 } | |
18 | |
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. | |
24 class OmniboxSearchHint | |
25 : public content::NotificationObserver, | |
26 public content::WebContentsUserData<OmniboxSearchHint> { | |
27 public: | |
28 virtual ~OmniboxSearchHint(); | |
29 | |
30 // content::NotificationObserver method: | |
31 virtual void Observe(int type, | |
32 const content::NotificationSource& source, | |
33 const content::NotificationDetails& details) OVERRIDE; | |
34 | |
35 // Focus the location bar and displays a message instructing that search | |
36 // queries can be typed directly in there. | |
37 void ShowEnteringQuery(); | |
38 | |
39 // 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: | |
47 explicit OmniboxSearchHint(content::WebContents* web_contents); | |
48 friend class content::WebContentsUserData<OmniboxSearchHint>; | |
49 | |
50 content::NotificationRegistrar notification_registrar_; | |
51 | |
52 // The contents we are associated with. | |
53 content::WebContents* web_contents_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(OmniboxSearchHint); | |
56 }; | |
57 | |
58 #endif // CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_ | |
OLD | NEW |