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_UI_SEARCH_INSTANT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 void SearchModeChanged(const SearchMode& old_mode, | 147 void SearchModeChanged(const SearchMode& old_mode, |
148 const SearchMode& new_mode); | 148 const SearchMode& new_mode); |
149 | 149 |
150 // The user switched tabs. Hide the overlay. Create |instant_tab_| if the | 150 // The user switched tabs. Hide the overlay. Create |instant_tab_| if the |
151 // newly active tab is an Instant search results page. | 151 // newly active tab is an Instant search results page. |
152 void ActiveTabChanged(); | 152 void ActiveTabChanged(); |
153 | 153 |
154 // The user is about to switch tabs. Commit the overlay if needed. | 154 // The user is about to switch tabs. Commit the overlay if needed. |
155 void TabDeactivated(content::WebContents* contents); | 155 void TabDeactivated(content::WebContents* contents); |
156 | 156 |
157 // Sets whether Instant should show result overlays. |use_local_overlay_only| | 157 // Sets whether Instant should show result overlays. |use_local_page_only| |
158 // will force the use of kLocalOmniboxPopupURL as the Instant URL and is only | 158 // will force the use of baked-in page as the Instant URL and is only |
159 // applicable if |extended_enabled_| is true. | 159 // applicable if |extended_enabled_| is true. |
160 void SetInstantEnabled(bool instant_enabled, bool use_local_overlay_only); | 160 void SetInstantEnabled(bool instant_enabled, bool use_local_page_only); |
161 | 161 |
162 // The theme has changed. Pass the message to the overlay page. | 162 // The theme has changed. Pass the message to the overlay page. |
163 void ThemeChanged(const ThemeBackgroundInfo& theme_info); | 163 void ThemeChanged(const ThemeBackgroundInfo& theme_info); |
164 | 164 |
165 // Called when someone else swapped in a different contents in the |overlay_|. | 165 // Called when someone else swapped in a different contents in the |overlay_|. |
166 void SwappedOverlayContents(); | 166 void SwappedOverlayContents(); |
167 | 167 |
168 // Called when contents for |overlay_| received focus. | 168 // Called when contents for |overlay_| received focus. |
169 void FocusedOverlayContents(); | 169 void FocusedOverlayContents(); |
170 | 170 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 MiddleClickOnSuggestionOpensInNewTab); | 216 MiddleClickOnSuggestionOpensInNewTab); |
217 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded); | 217 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded); |
218 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab); | 218 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab); |
219 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab); | 219 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab); |
220 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPForWrongProvider); | 220 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPForWrongProvider); |
221 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); | 221 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); |
222 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UnrelatedSiteInstance); | 222 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UnrelatedSiteInstance); |
223 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ValidatesSuggestions); | 223 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ValidatesSuggestions); |
224 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 224 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
225 OmniboxCommitsWhenShownFullHeight); | 225 OmniboxCommitsWhenShownFullHeight); |
226 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, LocalNTPIsNotLocalOverlay); | 226 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, LocalNTPIsNotPreloaded); |
227 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, | 227 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, |
228 MANUAL_OmniboxFocusLoadsInstant); | 228 MANUAL_OmniboxFocusLoadsInstant); |
229 | 229 |
230 // Overridden from content::NotificationObserver: | 230 // Overridden from content::NotificationObserver: |
231 virtual void Observe(int type, | 231 virtual void Observe(int type, |
232 const content::NotificationSource& source, | 232 const content::NotificationSource& source, |
233 const content::NotificationDetails& details) OVERRIDE; | 233 const content::NotificationDetails& details) OVERRIDE; |
234 | 234 |
235 // Overridden from InstantPage::Delegate: | 235 // Overridden from InstantPage::Delegate: |
236 // TODO(shishir): We assume that the WebContent's current RenderViewHost is | 236 // TODO(shishir): We assume that the WebContent's current RenderViewHost is |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 bool ShouldSwitchToLocalNTP() const; | 370 bool ShouldSwitchToLocalNTP() const; |
371 | 371 |
372 BrowserInstantController* const browser_; | 372 BrowserInstantController* const browser_; |
373 | 373 |
374 // Whether the extended API and regular API are enabled. If both are false, | 374 // Whether the extended API and regular API are enabled. If both are false, |
375 // Instant is effectively disabled. | 375 // Instant is effectively disabled. |
376 const bool extended_enabled_; | 376 const bool extended_enabled_; |
377 bool instant_enabled_; | 377 bool instant_enabled_; |
378 | 378 |
379 // If true, the Instant URL is set to kLocalOmniboxPopupURL. | 379 // If true, the Instant URL is set to kLocalOmniboxPopupURL. |
380 bool use_local_overlay_only_; | 380 bool use_local_page_only_; |
381 | 381 |
382 // The state of the overlay page, i.e., the page owned by |overlay_|. Ignored | 382 // The state of the overlay page, i.e., the page owned by |overlay_|. Ignored |
383 // if |instant_tab_| is in use. | 383 // if |instant_tab_| is in use. |
384 InstantOverlayModel model_; | 384 InstantOverlayModel model_; |
385 | 385 |
386 // The three instances of InstantPage maintained by InstantController as | 386 // The three instances of InstantPage maintained by InstantController as |
387 // described above. All three may be non-NULL in extended mode. If | 387 // described above. All three may be non-NULL in extended mode. If |
388 // |instant_tab_| is not NULL, then |overlay_| is guaranteed to be hidden and | 388 // |instant_tab_| is not NULL, then |overlay_| is guaranteed to be hidden and |
389 // messages will be sent to |instant_tab_| instead. | 389 // messages will be sent to |instant_tab_| instead. |
390 // | 390 // |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 // Used for Top Sites async retrieval. | 470 // Used for Top Sites async retrieval. |
471 base::WeakPtrFactory<InstantController> weak_ptr_factory_; | 471 base::WeakPtrFactory<InstantController> weak_ptr_factory_; |
472 | 472 |
473 // Used to get notifications about Most Visted changes. | 473 // Used to get notifications about Most Visted changes. |
474 content::NotificationRegistrar registrar_; | 474 content::NotificationRegistrar registrar_; |
475 | 475 |
476 DISALLOW_COPY_AND_ASSIGN(InstantController); | 476 DISALLOW_COPY_AND_ASSIGN(InstantController); |
477 }; | 477 }; |
478 | 478 |
479 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 479 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
OLD | NEW |