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 <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 243 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
244 OmniboxCommitsWhenShownFullHeight); | 244 OmniboxCommitsWhenShownFullHeight); |
245 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, LocalNTPIsNotPreloaded); | 245 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, LocalNTPIsNotPreloaded); |
246 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayRenderViewGone); | 246 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayRenderViewGone); |
247 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayDoesntSupportInstant); | 247 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayDoesntSupportInstant); |
248 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, | 248 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, |
249 MANUAL_OmniboxFocusLoadsInstant); | 249 MANUAL_OmniboxFocusLoadsInstant); |
250 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, | 250 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, |
251 MANUAL_BackspaceFromQueryToSelectedUrlAndNavigate); | 251 MANUAL_BackspaceFromQueryToSelectedUrlAndNavigate); |
252 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OnDefaultSearchProviderChanged); | 252 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OnDefaultSearchProviderChanged); |
| 253 FRIEND_TEST_ALL_PREFIXES( |
| 254 InstantExtendedFirstTabTest, RedirectToLocalOnLoadFailure); |
253 | 255 |
254 Profile* profile() const; | 256 Profile* profile() const; |
255 InstantOverlay* overlay() const; | 257 InstantOverlay* overlay() const; |
256 InstantTab* instant_tab() const; | 258 InstantTab* instant_tab() const; |
257 InstantNTP* ntp() const; | 259 InstantNTP* ntp() const; |
258 | 260 |
259 // Overridden from content::NotificationObserver: | 261 // Overridden from content::NotificationObserver: |
260 virtual void Observe(int type, | 262 virtual void Observe(int type, |
261 const content::NotificationSource& source, | 263 const content::NotificationSource& source, |
262 const content::NotificationDetails& details) OVERRIDE; | 264 const content::NotificationDetails& details) OVERRIDE; |
(...skipping 18 matching lines...) Expand all Loading... |
281 const content::WebContents* contents, | 283 const content::WebContents* contents, |
282 int height, | 284 int height, |
283 InstantSizeUnits units) OVERRIDE; | 285 InstantSizeUnits units) OVERRIDE; |
284 virtual void FocusOmnibox(const content::WebContents* contents, | 286 virtual void FocusOmnibox(const content::WebContents* contents, |
285 OmniboxFocusState state) OVERRIDE; | 287 OmniboxFocusState state) OVERRIDE; |
286 virtual void NavigateToURL( | 288 virtual void NavigateToURL( |
287 const content::WebContents* contents, | 289 const content::WebContents* contents, |
288 const GURL& url, | 290 const GURL& url, |
289 content::PageTransition transition, | 291 content::PageTransition transition, |
290 WindowOpenDisposition disposition) OVERRIDE; | 292 WindowOpenDisposition disposition) OVERRIDE; |
| 293 virtual void InstantPageLoadFailed(content::WebContents* contents) OVERRIDE; |
291 | 294 |
292 // Invoked by the InstantLoader when the Instant page wants to delete a | 295 // Invoked by the InstantLoader when the Instant page wants to delete a |
293 // Most Visited item. | 296 // Most Visited item. |
294 virtual void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id) | 297 virtual void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id) |
295 OVERRIDE; | 298 OVERRIDE; |
296 | 299 |
297 // Invoked by the InstantLoader when the Instant page wants to undo a | 300 // Invoked by the InstantLoader when the Instant page wants to undo a |
298 // Most Visited deletion. | 301 // Most Visited deletion. |
299 virtual void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id) | 302 virtual void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id) |
300 OVERRIDE; | 303 OVERRIDE; |
301 | 304 |
302 // Invoked by the InstantLoader when the Instant page wants to undo all | 305 // Invoked by the InstantLoader when the Instant page wants to undo all |
303 // Most Visited deletions. | 306 // Most Visited deletions. |
304 virtual void UndoAllMostVisitedDeletions() OVERRIDE; | 307 virtual void UndoAllMostVisitedDeletions() OVERRIDE; |
305 | 308 |
| 309 // Helper function to navigate the given contents to the local fallback |
| 310 // Instant URL and trim the history correctly. |
| 311 void RedirectToLocalNTP(content::WebContents* contents); |
| 312 |
306 // Helper for OmniboxFocusChanged. Commit or discard the overlay. | 313 // Helper for OmniboxFocusChanged. Commit or discard the overlay. |
307 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); | 314 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); |
308 | 315 |
309 // Returns the local Instant URL. (Just a convenience wrapper around | 316 // Returns the local Instant URL. (Just a convenience wrapper around |
310 // chrome::GetLocalInstantURL.) | 317 // chrome::GetLocalInstantURL.) |
311 std::string GetLocalInstantURL() const; | 318 std::string GetLocalInstantURL() const; |
312 | 319 |
313 // Returns the correct Instant URL to use from the following possibilities: | 320 // Returns the correct Instant URL to use from the following possibilities: |
314 // o The default search engine's Instant URL | 321 // o The default search engine's Instant URL |
315 // o The --instant-url command line switch | 322 // o The --instant-url command line switch |
(...skipping 19 matching lines...) Expand all Loading... |
335 // |instant_url| is empty or if there is no active tab. | 342 // |instant_url| is empty or if there is no active tab. |
336 void ResetOverlay(const std::string& instant_url); | 343 void ResetOverlay(const std::string& instant_url); |
337 | 344 |
338 // Returns true if we should switch to using the local overlay. | 345 // Returns true if we should switch to using the local overlay. |
339 bool ShouldSwitchToLocalOverlay() const; | 346 bool ShouldSwitchToLocalOverlay() const; |
340 | 347 |
341 // If the active tab is an Instant search results page, sets |instant_tab_| to | 348 // If the active tab is an Instant search results page, sets |instant_tab_| to |
342 // point to it. Else, deletes any existing |instant_tab_|. | 349 // point to it. Else, deletes any existing |instant_tab_|. |
343 void ResetInstantTab(); | 350 void ResetInstantTab(); |
344 | 351 |
| 352 // Sends theme info, omnibox bounds, font info, etc. down to the Instant tab. |
| 353 void UpdateInfoForInstantTab(); |
| 354 |
345 // Hide the overlay. Also sends an onchange event (with blank query) to the | 355 // Hide the overlay. Also sends an onchange event (with blank query) to the |
346 // overlay, telling it to clear out results for any old queries. | 356 // overlay, telling it to clear out results for any old queries. |
347 void HideOverlay(); | 357 void HideOverlay(); |
348 | 358 |
349 // Like HideOverlay(), but doesn't call OnStaleOverlay(). Use HideOverlay() | 359 // Like HideOverlay(), but doesn't call OnStaleOverlay(). Use HideOverlay() |
350 // unless you are going to call overlay_.reset() yourself subsequently. | 360 // unless you are going to call overlay_.reset() yourself subsequently. |
351 void HideInternal(); | 361 void HideInternal(); |
352 | 362 |
353 // Counterpart to HideOverlay(). Asks the |browser_| to display the overlay | 363 // Counterpart to HideOverlay(). Asks the |browser_| to display the overlay |
354 // with the given |height| in |units|. | 364 // with the given |height| in |units|. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 // Used for Top Sites async retrieval. | 485 // Used for Top Sites async retrieval. |
476 base::WeakPtrFactory<InstantController> weak_ptr_factory_; | 486 base::WeakPtrFactory<InstantController> weak_ptr_factory_; |
477 | 487 |
478 // Used to get notifications about Most Visted changes. | 488 // Used to get notifications about Most Visted changes. |
479 content::NotificationRegistrar registrar_; | 489 content::NotificationRegistrar registrar_; |
480 | 490 |
481 DISALLOW_COPY_AND_ASSIGN(InstantController); | 491 DISALLOW_COPY_AND_ASSIGN(InstantController); |
482 }; | 492 }; |
483 | 493 |
484 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 494 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
OLD | NEW |