OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 5 #ifndef CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class SearchBox : public content::RenderViewObserver, | 25 class SearchBox : public content::RenderViewObserver, |
26 public content::RenderViewObserverTracker<SearchBox> { | 26 public content::RenderViewObserverTracker<SearchBox> { |
27 public: | 27 public: |
28 explicit SearchBox(content::RenderView* render_view); | 28 explicit SearchBox(content::RenderView* render_view); |
29 virtual ~SearchBox(); | 29 virtual ~SearchBox(); |
30 | 30 |
31 // Sends ChromeViewHostMsg_LogEvent to the browser. | 31 // Sends ChromeViewHostMsg_LogEvent to the browser. |
32 void LogEvent(NTPLoggingEventType event); | 32 void LogEvent(NTPLoggingEventType event); |
33 | 33 |
34 // Sends ChromeViewHostMsg_ChromeIdentityCheck to the browser. | 34 // Sends ChromeViewHostMsg_ChromeIdentityCheck to the browser. |
35 void CheckIsUserSignedInToChromeAs(const string16& identity); | 35 void CheckIsUserSignedInToChromeAs(const base::string16& identity); |
36 | 36 |
37 // Sends ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem to the browser. | 37 // Sends ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem to the browser. |
38 void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); | 38 void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); |
39 | 39 |
40 // Generates the favicon URL of the most visited item specified by the | 40 // Generates the favicon URL of the most visited item specified by the |
41 // |transient_url|. If the |transient_url| is valid, returns true and fills in | 41 // |transient_url|. If the |transient_url| is valid, returns true and fills in |
42 // |url|. If the |transient_url| is invalid, returns true and |url| is set to | 42 // |url|. If the |transient_url| is invalid, returns true and |url| is set to |
43 // "chrome-search://favicon/" in order to prevent the invalid URL to be | 43 // "chrome-search://favicon/" in order to prevent the invalid URL to be |
44 // requested. | 44 // requested. |
45 // | 45 // |
(...skipping 24 matching lines...) Expand all Loading... |
70 | 70 |
71 // Sends ChromeViewHostMsg_FocusOmnibox to the browser. | 71 // Sends ChromeViewHostMsg_FocusOmnibox to the browser. |
72 void Focus(); | 72 void Focus(); |
73 | 73 |
74 // Sends ChromeViewHostMsg_SearchBoxNavigate to the browser. | 74 // Sends ChromeViewHostMsg_SearchBoxNavigate to the browser. |
75 void NavigateToURL(const GURL& url, | 75 void NavigateToURL(const GURL& url, |
76 WindowOpenDisposition disposition, | 76 WindowOpenDisposition disposition, |
77 bool is_most_visited_item_url); | 77 bool is_most_visited_item_url); |
78 | 78 |
79 // Sends ChromeViewHostMsg_SearchBoxPaste to the browser. | 79 // Sends ChromeViewHostMsg_SearchBoxPaste to the browser. |
80 void Paste(const string16& text); | 80 void Paste(const base::string16& text); |
81 | 81 |
82 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); | 82 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); |
83 | 83 |
84 // Sends ChromeViewHostMsg_SetVoiceSearchSupported to the browser. | 84 // Sends ChromeViewHostMsg_SetVoiceSearchSupported to the browser. |
85 void SetVoiceSearchSupported(bool supported); | 85 void SetVoiceSearchSupported(bool supported); |
86 | 86 |
87 // Sends ChromeViewHostMsg_StartCapturingKeyStrokes to the browser. | 87 // Sends ChromeViewHostMsg_StartCapturingKeyStrokes to the browser. |
88 void StartCapturingKeyStrokes(); | 88 void StartCapturingKeyStrokes(); |
89 | 89 |
90 // Sends ChromeViewHostMsg_StopCapturingKeyStrokes to the browser. | 90 // Sends ChromeViewHostMsg_StopCapturingKeyStrokes to the browser. |
91 void StopCapturingKeyStrokes(); | 91 void StopCapturingKeyStrokes(); |
92 | 92 |
93 // Sends ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions to the | 93 // Sends ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions to the |
94 // browser. | 94 // browser. |
95 void UndoAllMostVisitedDeletions(); | 95 void UndoAllMostVisitedDeletions(); |
96 | 96 |
97 // Sends ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion to the browser. | 97 // Sends ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion to the browser. |
98 void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); | 98 void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); |
99 | 99 |
100 bool app_launcher_enabled() const { return app_launcher_enabled_; } | 100 bool app_launcher_enabled() const { return app_launcher_enabled_; } |
101 bool is_focused() const { return is_focused_; } | 101 bool is_focused() const { return is_focused_; } |
102 bool is_input_in_progress() const { return is_input_in_progress_; } | 102 bool is_input_in_progress() const { return is_input_in_progress_; } |
103 bool is_key_capture_enabled() const { return is_key_capture_enabled_; } | 103 bool is_key_capture_enabled() const { return is_key_capture_enabled_; } |
104 bool display_instant_results() const { return display_instant_results_; } | 104 bool display_instant_results() const { return display_instant_results_; } |
105 const string16& query() const { return query_; } | 105 const base::string16& query() const { return query_; } |
106 int start_margin() const { return start_margin_; } | 106 int start_margin() const { return start_margin_; } |
107 const InstantSuggestion& suggestion() const { return suggestion_; } | 107 const InstantSuggestion& suggestion() const { return suggestion_; } |
108 | 108 |
109 private: | 109 private: |
110 // Overridden from content::RenderViewObserver: | 110 // Overridden from content::RenderViewObserver: |
111 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 111 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
112 | 112 |
113 void OnChromeIdentityCheckResult(const string16& identity, | 113 void OnChromeIdentityCheckResult(const base::string16& identity, |
114 bool identity_match); | 114 bool identity_match); |
115 void OnDetermineIfPageSupportsInstant(); | 115 void OnDetermineIfPageSupportsInstant(); |
116 void OnFocusChanged(OmniboxFocusState new_focus_state, | 116 void OnFocusChanged(OmniboxFocusState new_focus_state, |
117 OmniboxFocusChangeReason reason); | 117 OmniboxFocusChangeReason reason); |
118 void OnMarginChange(int margin, int width); | 118 void OnMarginChange(int margin, int width); |
119 void OnMostVisitedChanged( | 119 void OnMostVisitedChanged( |
120 const std::vector<InstantMostVisitedItem>& items); | 120 const std::vector<InstantMostVisitedItem>& items); |
121 void OnPromoInformationReceived(bool is_app_launcher_enabled); | 121 void OnPromoInformationReceived(bool is_app_launcher_enabled); |
122 void OnSetDisplayInstantResults(bool display_instant_results); | 122 void OnSetDisplayInstantResults(bool display_instant_results); |
123 void OnSetInputInProgress(bool input_in_progress); | 123 void OnSetInputInProgress(bool input_in_progress); |
124 void OnSetSuggestionToPrefetch(const InstantSuggestion& suggestion); | 124 void OnSetSuggestionToPrefetch(const InstantSuggestion& suggestion); |
125 void OnSubmit(const string16& query); | 125 void OnSubmit(const base::string16& query); |
126 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); | 126 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); |
127 void OnToggleVoiceSearch(); | 127 void OnToggleVoiceSearch(); |
128 | 128 |
129 // Returns the current zoom factor of the render view or 1 on failure. | 129 // Returns the current zoom factor of the render view or 1 on failure. |
130 double GetZoom() const; | 130 double GetZoom() const; |
131 | 131 |
132 // Sets the searchbox values to their initial value. | 132 // Sets the searchbox values to their initial value. |
133 void Reset(); | 133 void Reset(); |
134 | 134 |
135 // Returns the URL of the Most Visited item specified by the |item_id|. | 135 // Returns the URL of the Most Visited item specified by the |item_id|. |
136 GURL GetURLForMostVisitedItem(InstantRestrictedID item_id) const; | 136 GURL GetURLForMostVisitedItem(InstantRestrictedID item_id) const; |
137 | 137 |
138 bool app_launcher_enabled_; | 138 bool app_launcher_enabled_; |
139 bool is_focused_; | 139 bool is_focused_; |
140 bool is_input_in_progress_; | 140 bool is_input_in_progress_; |
141 bool is_key_capture_enabled_; | 141 bool is_key_capture_enabled_; |
142 bool display_instant_results_; | 142 bool display_instant_results_; |
143 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_; | 143 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_; |
144 ThemeBackgroundInfo theme_info_; | 144 ThemeBackgroundInfo theme_info_; |
145 string16 query_; | 145 base::string16 query_; |
146 int start_margin_; | 146 int start_margin_; |
147 InstantSuggestion suggestion_; | 147 InstantSuggestion suggestion_; |
148 int width_; | 148 int width_; |
149 | 149 |
150 DISALLOW_COPY_AND_ASSIGN(SearchBox); | 150 DISALLOW_COPY_AND_ASSIGN(SearchBox); |
151 }; | 151 }; |
152 | 152 |
153 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 153 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
OLD | NEW |