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 18 matching lines...) Expand all Loading... |
29 class AutocompleteProvider; | 29 class AutocompleteProvider; |
30 class InstantLoader; | 30 class InstantLoader; |
31 class InstantTab; | 31 class InstantTab; |
32 class TemplateURL; | 32 class TemplateURL; |
33 | 33 |
34 namespace chrome { | 34 namespace chrome { |
35 class BrowserInstantController; | 35 class BrowserInstantController; |
36 } | 36 } |
37 | 37 |
38 namespace content { | 38 namespace content { |
| 39 class NavigationEntry; |
39 class WebContents; | 40 class WebContents; |
40 } | 41 } |
41 | 42 |
42 // InstantController maintains a WebContents that is intended to give a preview | 43 // InstantController maintains a WebContents that is intended to give a preview |
43 // of search suggestions and results. InstantController is owned by Browser via | 44 // of search suggestions and results. InstantController is owned by Browser via |
44 // BrowserInstantController. | 45 // BrowserInstantController. |
45 class InstantController { | 46 class InstantController { |
46 public: | 47 public: |
47 // The URL for the local omnibox popup. | 48 // The URL for the local omnibox popup. |
48 static const char* kLocalOmniboxPopupURL; | 49 static const char* kLocalOmniboxPopupURL; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() | 216 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() |
216 // unless you are going to call loader_.reset() yourself subsequently. | 217 // unless you are going to call loader_.reset() yourself subsequently. |
217 void HideInternal(); | 218 void HideInternal(); |
218 | 219 |
219 // Counterpart to HideLoader(). Asks the |browser_| to display the preview | 220 // Counterpart to HideLoader(). Asks the |browser_| to display the preview |
220 // with the given |height|. | 221 // with the given |height|. |
221 void ShowLoader(InstantShownReason reason, | 222 void ShowLoader(InstantShownReason reason, |
222 int height, | 223 int height, |
223 InstantSizeUnits units); | 224 InstantSizeUnits units); |
224 | 225 |
| 226 // Copies the loader's NavigationEntry into a transient history entry for the |
| 227 // active tab. Used to update the tab title and make the back button work as |
| 228 // expected when the preview is shown at full height but not yet committed. |
| 229 void SetTransientHistoryEntry(); |
| 230 |
| 231 // Restores the old transient entry for the active tab, if any. |
| 232 void ResetTransientHistoryEntry(); |
| 233 |
225 // Send the omnibox popup bounds to the page. | 234 // Send the omnibox popup bounds to the page. |
226 void SendPopupBoundsToPage(); | 235 void SendPopupBoundsToPage(); |
227 | 236 |
228 // If |template_url| is a valid TemplateURL for use with Instant, fills in | 237 // If |template_url| is a valid TemplateURL for use with Instant, fills in |
229 // |instant_url| and returns true; returns false otherwise. | 238 // |instant_url| and returns true; returns false otherwise. |
230 // Note: If the command-line switch kInstantURL is set, this method uses its | 239 // Note: If the command-line switch kInstantURL is set, this method uses its |
231 // value for |instant_url| and returns true without examining |template_url|. | 240 // value for |instant_url| and returns true without examining |template_url|. |
232 bool GetInstantURL(const TemplateURL* template_url, | 241 bool GetInstantURL(const TemplateURL* template_url, |
233 std::string* instant_url) const; | 242 std::string* instant_url) const; |
234 | 243 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 326 |
318 // The timestamp at which query editing began. This value is used when the | 327 // The timestamp at which query editing began. This value is used when the |
319 // preview is showed and cleared when the preview is hidden. | 328 // preview is showed and cleared when the preview is hidden. |
320 base::Time first_interaction_time_; | 329 base::Time first_interaction_time_; |
321 | 330 |
322 // Whether to allow the preview to show search suggestions. In general, the | 331 // Whether to allow the preview to show search suggestions. In general, the |
323 // preview is allowed to show search suggestions whenever |search_mode_| is | 332 // preview is allowed to show search suggestions whenever |search_mode_| is |
324 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. | 333 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. |
325 bool allow_preview_to_show_search_suggestions_; | 334 bool allow_preview_to_show_search_suggestions_; |
326 | 335 |
| 336 // The transient navigation entry associated with the active tab, if any. |
| 337 scoped_ptr<content::NavigationEntry> transient_entry_; |
| 338 |
| 339 // True iff Instant has set a transient history entry for the active tab. |
| 340 bool instant_set_transient_entry_; |
| 341 |
327 DISALLOW_COPY_AND_ASSIGN(InstantController); | 342 DISALLOW_COPY_AND_ASSIGN(InstantController); |
328 }; | 343 }; |
329 | 344 |
330 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 345 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
OLD | NEW |