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_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 // If the preview is showing search results, commits the preview, calling | 80 // If the preview is showing search results, commits the preview, calling |
81 // CommitInstant() on the browser, and returns true. Else, returns false. | 81 // CommitInstant() on the browser, and returns true. Else, returns false. |
82 bool CommitIfCurrent(InstantCommitType type); | 82 bool CommitIfCurrent(InstantCommitType type); |
83 | 83 |
84 // The omnibox has lost focus. Commit or discard the preview accordingly. | 84 // The omnibox has lost focus. Commit or discard the preview accordingly. |
85 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); | 85 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); |
86 | 86 |
87 // The omnibox has gained focus. Preload the default search engine, in | 87 // The omnibox has gained focus. Preload the default search engine, in |
88 // anticipation of the user typing a query. | 88 // anticipation of the user typing a query. |
89 void OmniboxGotFocus(); | 89 void OmniboxGotFocus(bool focus_is_visible); |
90 | 90 |
91 // The search mode in the active tab has changed. Pass the message down to | 91 // The search mode in the active tab has changed. Pass the message down to |
92 // the loader which will notify the renderer. | 92 // the loader which will notify the renderer. |
93 void SearchModeChanged(const chrome::search::Mode& old_mode, | 93 void SearchModeChanged(const chrome::search::Mode& old_mode, |
94 const chrome::search::Mode& new_mode); | 94 const chrome::search::Mode& new_mode); |
95 | 95 |
96 // The user switched tabs. Hide the preview if needed. | 96 // The user switched tabs. Hide the preview if needed. |
97 void ActiveTabChanged(); | 97 void ActiveTabChanged(); |
98 | 98 |
99 // Sets whether Instant should show result previews. | 99 // Sets whether Instant should show result previews. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // out results for any old queries. | 176 // out results for any old queries. |
177 void Hide(bool clear_query); | 177 void Hide(bool clear_query); |
178 | 178 |
179 // Counterpart to Hide(). Asks the |browser_| to display the preview with | 179 // Counterpart to Hide(). Asks the |browser_| to display the preview with |
180 // the given |height|. | 180 // the given |height|. |
181 void Show(InstantShownReason reason, int height, InstantSizeUnits units); | 181 void Show(InstantShownReason reason, int height, InstantSizeUnits units); |
182 | 182 |
183 // Send the omnibox dropdown bounds to the page. | 183 // Send the omnibox dropdown bounds to the page. |
184 void SendBoundsToPage(); | 184 void SendBoundsToPage(); |
185 | 185 |
| 186 // Helper to send key capture mode to the page. |
| 187 void SendKeyCaptureModeToPage(); |
| 188 |
186 // If |template_url| is a valid TemplateURL for use with Instant, fills in | 189 // If |template_url| is a valid TemplateURL for use with Instant, fills in |
187 // |instant_url| and returns true; returns false otherwise. | 190 // |instant_url| and returns true; returns false otherwise. |
188 // Note: If the command-line switch kInstantURL is set, this method uses its | 191 // Note: If the command-line switch kInstantURL is set, this method uses its |
189 // value for |instant_url| and returns true without examining |template_url|. | 192 // value for |instant_url| and returns true without examining |template_url|. |
190 bool GetInstantURL(const TemplateURL* template_url, | 193 bool GetInstantURL(const TemplateURL* template_url, |
191 std::string* instant_url) const; | 194 std::string* instant_url) const; |
192 | 195 |
193 chrome::BrowserInstantController* const browser_; | 196 chrome::BrowserInstantController* const browser_; |
194 | 197 |
195 // Whether the extended API and regular API are enabled. If both are false, | 198 // Whether the extended API and regular API are enabled. If both are false, |
(...skipping 17 matching lines...) Expand all Loading... |
213 // The most recent suggestion received from the page, minus any prefix that | 216 // The most recent suggestion received from the page, minus any prefix that |
214 // the user has typed. | 217 // the user has typed. |
215 InstantSuggestion last_suggestion_; | 218 InstantSuggestion last_suggestion_; |
216 | 219 |
217 // See comments on the getter above. | 220 // See comments on the getter above. |
218 content::PageTransition last_transition_type_; | 221 content::PageTransition last_transition_type_; |
219 | 222 |
220 // True if the last match passed to Update() was a search (versus a URL). | 223 // True if the last match passed to Update() was a search (versus a URL). |
221 bool last_match_was_search_; | 224 bool last_match_was_search_; |
222 | 225 |
223 // True if the omnibox is focused, false otherwise. | 226 // Omnibox focus state. |
224 bool is_omnibox_focused_; | 227 enum OmniboxFocusState { |
| 228 NONE = 0, // Not focused |
| 229 VISIBLE = 1, // Visibly focused |
| 230 INVISIBLE = 2 // Invisibly focused |
| 231 }; |
| 232 OmniboxFocusState omnibox_focus_state_; |
225 | 233 |
226 // The search model mode for the active tab. | 234 // The search model mode for the active tab. |
227 chrome::search::Mode search_mode_; | 235 chrome::search::Mode search_mode_; |
228 | 236 |
229 // Current omnibox bounds. | 237 // Current omnibox bounds. |
230 gfx::Rect omnibox_bounds_; | 238 gfx::Rect omnibox_bounds_; |
231 | 239 |
232 // Last bounds passed to the page. | 240 // Last bounds passed to the page. |
233 gfx::Rect last_omnibox_bounds_; | 241 gfx::Rect last_omnibox_bounds_; |
234 | 242 |
(...skipping 18 matching lines...) Expand all Loading... |
253 | 261 |
254 // The timestamp at which query editing began. This value is used when the | 262 // The timestamp at which query editing began. This value is used when the |
255 // first set of suggestions is processed and cleared when the overlay is | 263 // first set of suggestions is processed and cleared when the overlay is |
256 // hidden. | 264 // hidden. |
257 base::Time first_interaction_time_; | 265 base::Time first_interaction_time_; |
258 | 266 |
259 DISALLOW_COPY_AND_ASSIGN(InstantController); | 267 DISALLOW_COPY_AND_ASSIGN(InstantController); |
260 }; | 268 }; |
261 | 269 |
262 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 270 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
OLD | NEW |