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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 // update is accepted (i.e., if |match| is a search rather than a URL). | 55 // update is accepted (i.e., if |match| is a search rather than a URL). |
56 bool Update(const AutocompleteMatch& match, | 56 bool Update(const AutocompleteMatch& match, |
57 const string16& user_text, | 57 const string16& user_text, |
58 const string16& full_text, | 58 const string16& full_text, |
59 size_t selection_start, | 59 size_t selection_start, |
60 size_t selection_end, | 60 size_t selection_end, |
61 bool verbatim, | 61 bool verbatim, |
62 bool user_input_in_progress, | 62 bool user_input_in_progress, |
63 bool omnibox_popup_is_open); | 63 bool omnibox_popup_is_open); |
64 | 64 |
65 // Sets the bounds of the omnibox dropdown, in screen coordinates. | 65 // Sets the bounds of the omnibox popup, in screen coordinates. |
66 void SetOmniboxBounds(const gfx::Rect& bounds); | 66 void SetPopupBounds(const gfx::Rect& bounds); |
67 | |
68 // Sets the widths of the start and end margins of the Instant page. | |
samarth
2012/12/07 01:44:49
nit: this isn't quite right. Something like "Sets
melevin
2012/12/08 00:04:09
Done.
| |
69 void SetMarginSize(int start, int end); | |
67 | 70 |
68 // Send autocomplete results from |providers| to the preview page. | 71 // Send autocomplete results from |providers| to the preview page. |
69 void HandleAutocompleteResults( | 72 void HandleAutocompleteResults( |
70 const std::vector<AutocompleteProvider*>& providers); | 73 const std::vector<AutocompleteProvider*>& providers); |
71 | 74 |
72 // Called when the user presses up or down. |count| is a repeat count, | 75 // Called when the user presses up or down. |count| is a repeat count, |
73 // negative for moving up, positive for moving down. Returns true if Instant | 76 // negative for moving up, positive for moving down. Returns true if Instant |
74 // handled the key press. | 77 // handled the key press. |
75 bool OnUpOrDownKeyPressed(int count); | 78 bool OnUpOrDownKeyPressed(int count); |
76 | 79 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() | 182 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() |
180 // unless you are going to call loader_.reset() yourself subsequently. | 183 // unless you are going to call loader_.reset() yourself subsequently. |
181 void HideInternal(); | 184 void HideInternal(); |
182 | 185 |
183 // Counterpart to HideLoader(). Asks the |browser_| to display the preview | 186 // Counterpart to HideLoader(). Asks the |browser_| to display the preview |
184 // with the given |height|. | 187 // with the given |height|. |
185 void ShowLoader(InstantShownReason reason, | 188 void ShowLoader(InstantShownReason reason, |
186 int height, | 189 int height, |
187 InstantSizeUnits units); | 190 InstantSizeUnits units); |
188 | 191 |
189 // Send the omnibox dropdown bounds to the page. | 192 // Send the omnibox popup bounds to the page. |
190 void SendBoundsToPage(); | 193 void SendPopupBoundsToPage(); |
191 | 194 |
192 // If |template_url| is a valid TemplateURL for use with Instant, fills in | 195 // If |template_url| is a valid TemplateURL for use with Instant, fills in |
193 // |instant_url| and returns true; returns false otherwise. | 196 // |instant_url| and returns true; returns false otherwise. |
194 // Note: If the command-line switch kInstantURL is set, this method uses its | 197 // Note: If the command-line switch kInstantURL is set, this method uses its |
195 // value for |instant_url| and returns true without examining |template_url|. | 198 // value for |instant_url| and returns true without examining |template_url|. |
196 bool GetInstantURL(const TemplateURL* template_url, | 199 bool GetInstantURL(const TemplateURL* template_url, |
197 std::string* instant_url) const; | 200 std::string* instant_url) const; |
198 | 201 |
199 chrome::BrowserInstantController* const browser_; | 202 chrome::BrowserInstantController* const browser_; |
200 | 203 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 // True if the last match passed to Update() was a search (versus a URL). | 239 // True if the last match passed to Update() was a search (versus a URL). |
237 // Used to ensure that the preview page is committable. | 240 // Used to ensure that the preview page is committable. |
238 bool last_match_was_search_; | 241 bool last_match_was_search_; |
239 | 242 |
240 // True if the omnibox is focused, false otherwise. | 243 // True if the omnibox is focused, false otherwise. |
241 bool is_omnibox_focused_; | 244 bool is_omnibox_focused_; |
242 | 245 |
243 // The search model mode for the active tab. | 246 // The search model mode for the active tab. |
244 chrome::search::Mode search_mode_; | 247 chrome::search::Mode search_mode_; |
245 | 248 |
246 // Current omnibox bounds. | 249 // Current omnibox popup bounds. |
247 gfx::Rect omnibox_bounds_; | 250 gfx::Rect popup_bounds_; |
248 | 251 |
249 // Last bounds passed to the page. | 252 // Last popup bounds passed to the page. |
250 gfx::Rect last_omnibox_bounds_; | 253 gfx::Rect last_popup_bounds_; |
251 | 254 |
252 // Timer used to update the bounds of the omnibox. | 255 // Size of the start-edge omnibox text area margin. |
256 int start_margin_; | |
257 | |
258 // Size of the end-edge omnibox text area margin. | |
259 int end_margin_; | |
260 | |
261 // Timer used to update the bounds of the omnibox popup. | |
253 base::OneShotTimer<InstantController> update_bounds_timer_; | 262 base::OneShotTimer<InstantController> update_bounds_timer_; |
254 | 263 |
255 // Timer used to ensure that the Instant page does not get too stale. | 264 // Timer used to ensure that the Instant page does not get too stale. |
256 base::OneShotTimer<InstantController> stale_loader_timer_; | 265 base::OneShotTimer<InstantController> stale_loader_timer_; |
257 | 266 |
258 // For each key K => value N, the map says that we found that the search | 267 // For each key K => value N, the map says that we found that the search |
259 // engine identified by Instant URL K didn't support the Instant API in each | 268 // engine identified by Instant URL K didn't support the Instant API in each |
260 // of the last N times that we loaded it. If an Instant URL isn't present in | 269 // of the last N times that we loaded it. If an Instant URL isn't present in |
261 // the map at all or has a value 0, it means that search engine supports the | 270 // the map at all or has a value 0, it means that search engine supports the |
262 // Instant API (or we assume it does, since we haven't determined it doesn't). | 271 // Instant API (or we assume it does, since we haven't determined it doesn't). |
(...skipping 12 matching lines...) Expand all Loading... | |
275 | 284 |
276 // Whether to allow the preview to show search suggestions. In general, the | 285 // Whether to allow the preview to show search suggestions. In general, the |
277 // preview is allowed to show search suggestions whenever |search_mode_| is | 286 // preview is allowed to show search suggestions whenever |search_mode_| is |
278 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. | 287 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. |
279 bool allow_preview_to_show_search_suggestions_; | 288 bool allow_preview_to_show_search_suggestions_; |
280 | 289 |
281 DISALLOW_COPY_AND_ASSIGN(InstantController); | 290 DISALLOW_COPY_AND_ASSIGN(InstantController); |
282 }; | 291 }; |
283 | 292 |
284 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 293 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
OLD | NEW |