Chromium Code Reviews| 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. | |
| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() | 178 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() |
| 176 // unless you are going to call loader_.reset() yourself subsequently. | 179 // unless you are going to call loader_.reset() yourself subsequently. |
| 177 void HideInternal(); | 180 void HideInternal(); |
| 178 | 181 |
| 179 // Counterpart to HideLoader(). Asks the |browser_| to display the preview | 182 // Counterpart to HideLoader(). Asks the |browser_| to display the preview |
| 180 // with the given |height|. | 183 // with the given |height|. |
| 181 void ShowLoader(InstantShownReason reason, | 184 void ShowLoader(InstantShownReason reason, |
| 182 int height, | 185 int height, |
| 183 InstantSizeUnits units); | 186 InstantSizeUnits units); |
| 184 | 187 |
| 185 // Send the omnibox dropdown bounds to the page. | 188 // Send the omnibox popup bounds to the page. |
| 186 void SendBoundsToPage(); | 189 void SendPopupBoundsToPage(); |
| 187 | 190 |
| 188 // If |template_url| is a valid TemplateURL for use with Instant, fills in | 191 // If |template_url| is a valid TemplateURL for use with Instant, fills in |
| 189 // |instant_url| and returns true; returns false otherwise. | 192 // |instant_url| and returns true; returns false otherwise. |
| 190 // Note: If the command-line switch kInstantURL is set, this method uses its | 193 // Note: If the command-line switch kInstantURL is set, this method uses its |
| 191 // value for |instant_url| and returns true without examining |template_url|. | 194 // value for |instant_url| and returns true without examining |template_url|. |
| 192 bool GetInstantURL(const TemplateURL* template_url, | 195 bool GetInstantURL(const TemplateURL* template_url, |
| 193 std::string* instant_url) const; | 196 std::string* instant_url) const; |
| 194 | 197 |
| 195 chrome::BrowserInstantController* const browser_; | 198 chrome::BrowserInstantController* const browser_; |
| 196 | 199 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 | 238 |
| 236 // True if the omnibox is focused, false otherwise. | 239 // True if the omnibox is focused, false otherwise. |
| 237 bool is_omnibox_focused_; | 240 bool is_omnibox_focused_; |
| 238 | 241 |
| 239 // The search model mode for the active tab. | 242 // The search model mode for the active tab. |
| 240 chrome::search::Mode search_mode_; | 243 chrome::search::Mode search_mode_; |
| 241 | 244 |
| 242 // Current omnibox bounds. | 245 // Current omnibox bounds. |
| 243 gfx::Rect omnibox_bounds_; | 246 gfx::Rect omnibox_bounds_; |
| 244 | 247 |
| 245 // Last bounds passed to the page. | 248 // Last omnibox bounds passed to the page. |
| 246 gfx::Rect last_omnibox_bounds_; | 249 gfx::Rect last_omnibox_bounds_; |
|
sreeram
2012/12/05 00:14:46
Shouldn't these (omnibox_bounds_ and last_omnibox_
melevin
2012/12/06 23:13:00
Yup, done.
| |
| 247 | 250 |
| 251 // Current omnibox popup bounds. | |
| 252 gfx::Rect popup_bounds_; | |
| 253 | |
| 254 // Last popup bounds passed to the page. | |
| 255 gfx::Rect last_popup_bounds_; | |
| 256 | |
| 257 // Size of the start-edge omnibox text area margin. | |
| 258 int start_margin_; | |
| 259 | |
| 260 // Size of the end-edge omnibox text area margin. | |
| 261 int end_margin_; | |
| 262 | |
| 248 // Timer used to update the bounds of the omnibox. | 263 // Timer used to update the bounds of the omnibox. |
|
sreeram
2012/12/05 00:14:46
"... bounds of the omnibox popup."
melevin
2012/12/06 23:13:00
Done.
| |
| 249 base::OneShotTimer<InstantController> update_bounds_timer_; | 264 base::OneShotTimer<InstantController> update_bounds_timer_; |
| 250 | 265 |
| 251 // Timer used to ensure that the Instant page does not get too stale. | 266 // Timer used to ensure that the Instant page does not get too stale. |
| 252 base::OneShotTimer<InstantController> stale_loader_timer_; | 267 base::OneShotTimer<InstantController> stale_loader_timer_; |
| 253 | 268 |
| 254 // For each key K => value N, the map says that we found that the search | 269 // For each key K => value N, the map says that we found that the search |
| 255 // engine identified by Instant URL K didn't support the Instant API in each | 270 // engine identified by Instant URL K didn't support the Instant API in each |
| 256 // of the last N times that we loaded it. If an Instant URL isn't present in | 271 // of the last N times that we loaded it. If an Instant URL isn't present in |
| 257 // the map at all or has a value 0, it means that search engine supports the | 272 // the map at all or has a value 0, it means that search engine supports the |
| 258 // Instant API (or we assume it does, since we haven't determined it doesn't). | 273 // Instant API (or we assume it does, since we haven't determined it doesn't). |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 271 | 286 |
| 272 // Whether to allow the preview to show search suggestions. In general, the | 287 // Whether to allow the preview to show search suggestions. In general, the |
| 273 // preview is allowed to show search suggestions whenever |search_mode_| is | 288 // preview is allowed to show search suggestions whenever |search_mode_| is |
| 274 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. | 289 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. |
| 275 bool allow_preview_to_show_search_suggestions_; | 290 bool allow_preview_to_show_search_suggestions_; |
| 276 | 291 |
| 277 DISALLOW_COPY_AND_ASSIGN(InstantController); | 292 DISALLOW_COPY_AND_ASSIGN(InstantController); |
| 278 }; | 293 }; |
| 279 | 294 |
| 280 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 295 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
| OLD | NEW |