OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_ | 5 #ifndef CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_ |
6 #define CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_ | 6 #define CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
| 12 #include "base/compiler_specific.h" |
12 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
14 | 15 |
15 class Profile; | 16 class Profile; |
16 class TabContentsWrapper; | 17 class TabContentsWrapper; |
17 | 18 |
18 // This class is responsible for showing an info-bar that tells the user she | 19 // This class is responsible for showing an info-bar that tells the user she |
19 // can type her search query directly in the omnibox. | 20 // can type her search query directly in the omnibox. |
20 // It is displayed when the user visits a known search engine URL and has not | 21 // It is displayed when the user visits a known search engine URL and has not |
21 // searched from the omnibox before, or has not previously dismissed a similar | 22 // searched from the omnibox before, or has not previously dismissed a similar |
22 // info-bar. | 23 // info-bar. |
23 class OmniboxSearchHint : public content::NotificationObserver { | 24 class OmniboxSearchHint : public content::NotificationObserver { |
24 public: | 25 public: |
25 explicit OmniboxSearchHint(TabContentsWrapper* tab); | 26 explicit OmniboxSearchHint(TabContentsWrapper* tab); |
26 virtual ~OmniboxSearchHint(); | 27 virtual ~OmniboxSearchHint(); |
27 | 28 |
28 // content::NotificationObserver method: | 29 // content::NotificationObserver method: |
29 virtual void Observe(int type, | 30 virtual void Observe(int type, |
30 const content::NotificationSource& source, | 31 const content::NotificationSource& source, |
31 const content::NotificationDetails& details); | 32 const content::NotificationDetails& details) OVERRIDE; |
32 | 33 |
33 // Focus the location bar and displays a message instructing that search | 34 // Focus the location bar and displays a message instructing that search |
34 // queries can be typed directly in there. | 35 // queries can be typed directly in there. |
35 void ShowEnteringQuery(); | 36 void ShowEnteringQuery(); |
36 | 37 |
37 TabContentsWrapper* tab() { return tab_; } | 38 TabContentsWrapper* tab() { return tab_; } |
38 | 39 |
39 // Disables the hint infobar permanently, so that it does not show ever again. | 40 // Disables the hint infobar permanently, so that it does not show ever again. |
40 void DisableHint(); | 41 void DisableHint(); |
41 | 42 |
(...skipping 10 matching lines...) Expand all Loading... |
52 TabContentsWrapper* tab_; | 53 TabContentsWrapper* tab_; |
53 | 54 |
54 // A map containing the URLs of the search engine for which we want to | 55 // A map containing the URLs of the search engine for which we want to |
55 // trigger the hint. | 56 // trigger the hint. |
56 std::map<std::string, int> search_engine_urls_; | 57 std::map<std::string, int> search_engine_urls_; |
57 | 58 |
58 DISALLOW_COPY_AND_ASSIGN(OmniboxSearchHint); | 59 DISALLOW_COPY_AND_ASSIGN(OmniboxSearchHint); |
59 }; | 60 }; |
60 | 61 |
61 #endif // CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_ | 62 #endif // CHROME_BROWSER_OMNIBOX_SEARCH_HINT_H_ |
OLD | NEW |