| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 bool Update(const AutocompleteMatch& match, | 57 bool Update(const AutocompleteMatch& match, |
| 58 const string16& user_text, | 58 const string16& user_text, |
| 59 const string16& full_text, | 59 const string16& full_text, |
| 60 size_t selection_start, | 60 size_t selection_start, |
| 61 size_t selection_end, | 61 size_t selection_end, |
| 62 bool verbatim, | 62 bool verbatim, |
| 63 bool user_input_in_progress, | 63 bool user_input_in_progress, |
| 64 bool omnibox_popup_is_open, | 64 bool omnibox_popup_is_open, |
| 65 bool escape_pressed); | 65 bool escape_pressed); |
| 66 | 66 |
| 67 // Sets the bounds of the omnibox dropdown, in screen coordinates. | 67 // Sets the bounds of the omnibox popup, in screen coordinates. |
| 68 void SetOmniboxBounds(const gfx::Rect& bounds); | 68 void SetPopupBounds(const gfx::Rect& bounds); |
| 69 |
| 70 // Sets the start and end margins of the omnibox text area. |
| 71 void SetMarginSize(int start, int end); |
| 69 | 72 |
| 70 // Send autocomplete results from |providers| to the preview page. | 73 // Send autocomplete results from |providers| to the preview page. |
| 71 void HandleAutocompleteResults( | 74 void HandleAutocompleteResults( |
| 72 const std::vector<AutocompleteProvider*>& providers); | 75 const std::vector<AutocompleteProvider*>& providers); |
| 73 | 76 |
| 74 // Called when the user presses up or down. |count| is a repeat count, | 77 // Called when the user presses up or down. |count| is a repeat count, |
| 75 // negative for moving up, positive for moving down. Returns true if Instant | 78 // negative for moving up, positive for moving down. Returns true if Instant |
| 76 // handled the key press. | 79 // handled the key press. |
| 77 bool OnUpOrDownKeyPressed(int count); | 80 bool OnUpOrDownKeyPressed(int count); |
| 78 | 81 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() | 197 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() |
| 195 // unless you are going to call loader_.reset() yourself subsequently. | 198 // unless you are going to call loader_.reset() yourself subsequently. |
| 196 void HideInternal(); | 199 void HideInternal(); |
| 197 | 200 |
| 198 // Counterpart to HideLoader(). Asks the |browser_| to display the preview | 201 // Counterpart to HideLoader(). Asks the |browser_| to display the preview |
| 199 // with the given |height|. | 202 // with the given |height|. |
| 200 void ShowLoader(InstantShownReason reason, | 203 void ShowLoader(InstantShownReason reason, |
| 201 int height, | 204 int height, |
| 202 InstantSizeUnits units); | 205 InstantSizeUnits units); |
| 203 | 206 |
| 204 // Send the omnibox dropdown bounds to the page. | 207 // Send the omnibox popup bounds to the page. |
| 205 void SendBoundsToPage(); | 208 void SendPopupBoundsToPage(); |
| 206 | 209 |
| 207 // If |template_url| is a valid TemplateURL for use with Instant, fills in | 210 // If |template_url| is a valid TemplateURL for use with Instant, fills in |
| 208 // |instant_url| and returns true; returns false otherwise. | 211 // |instant_url| and returns true; returns false otherwise. |
| 209 // Note: If the command-line switch kInstantURL is set, this method uses its | 212 // Note: If the command-line switch kInstantURL is set, this method uses its |
| 210 // value for |instant_url| and returns true without examining |template_url|. | 213 // value for |instant_url| and returns true without examining |template_url|. |
| 211 bool GetInstantURL(const TemplateURL* template_url, | 214 bool GetInstantURL(const TemplateURL* template_url, |
| 212 std::string* instant_url) const; | 215 std::string* instant_url) const; |
| 213 | 216 |
| 214 chrome::BrowserInstantController* const browser_; | 217 chrome::BrowserInstantController* const browser_; |
| 215 | 218 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // True if the last match passed to Update() was a search (versus a URL). | 254 // True if the last match passed to Update() was a search (versus a URL). |
| 252 // Used to ensure that the preview page is committable. | 255 // Used to ensure that the preview page is committable. |
| 253 bool last_match_was_search_; | 256 bool last_match_was_search_; |
| 254 | 257 |
| 255 // Omnibox focus state. | 258 // Omnibox focus state. |
| 256 OmniboxFocusState omnibox_focus_state_; | 259 OmniboxFocusState omnibox_focus_state_; |
| 257 | 260 |
| 258 // The search model mode for the active tab. | 261 // The search model mode for the active tab. |
| 259 chrome::search::Mode search_mode_; | 262 chrome::search::Mode search_mode_; |
| 260 | 263 |
| 261 // Current omnibox bounds. | 264 // Current omnibox popup bounds. |
| 262 gfx::Rect omnibox_bounds_; | 265 gfx::Rect popup_bounds_; |
| 263 | 266 |
| 264 // Last bounds passed to the page. | 267 // Last popup bounds passed to the page. |
| 265 gfx::Rect last_omnibox_bounds_; | 268 gfx::Rect last_popup_bounds_; |
| 266 | 269 |
| 267 // Timer used to update the bounds of the omnibox. | 270 // Size of the start-edge omnibox text area margin. |
| 271 int start_margin_; |
| 272 |
| 273 // Size of the end-edge omnibox text area margin. |
| 274 int end_margin_; |
| 275 |
| 276 // Timer used to update the bounds of the omnibox popup. |
| 268 base::OneShotTimer<InstantController> update_bounds_timer_; | 277 base::OneShotTimer<InstantController> update_bounds_timer_; |
| 269 | 278 |
| 270 // Timer used to ensure that the Instant page does not get too stale. | 279 // Timer used to ensure that the Instant page does not get too stale. |
| 271 base::OneShotTimer<InstantController> stale_loader_timer_; | 280 base::OneShotTimer<InstantController> stale_loader_timer_; |
| 272 | 281 |
| 273 // For each key K => value N, the map says that we found that the search | 282 // For each key K => value N, the map says that we found that the search |
| 274 // engine identified by Instant URL K didn't support the Instant API, or | 283 // engine identified by Instant URL K didn't support the Instant API, or |
| 275 // caused RenderView crashes in each of the last N times that we loaded it. | 284 // caused RenderView crashes in each of the last N times that we loaded it. |
| 276 // If an Instant URL isn't present in the map at all or has a value 0, | 285 // If an Instant URL isn't present in the map at all or has a value 0, |
| 277 // it means that search engine supports the Instant API (or we assume it does, | 286 // it means that search engine supports the Instant API (or we assume it does, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 291 | 300 |
| 292 // Whether to allow the preview to show search suggestions. In general, the | 301 // Whether to allow the preview to show search suggestions. In general, the |
| 293 // preview is allowed to show search suggestions whenever |search_mode_| is | 302 // preview is allowed to show search suggestions whenever |search_mode_| is |
| 294 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. | 303 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. |
| 295 bool allow_preview_to_show_search_suggestions_; | 304 bool allow_preview_to_show_search_suggestions_; |
| 296 | 305 |
| 297 DISALLOW_COPY_AND_ASSIGN(InstantController); | 306 DISALLOW_COPY_AND_ASSIGN(InstantController); |
| 298 }; | 307 }; |
| 299 | 308 |
| 300 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 309 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
| OLD | NEW |