Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/ui/search/instant_controller.h

Issue 14043009: Fall back to local page if online NTP fails to load. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix failing tests Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, 234 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest,
235 OmniboxCommitsWhenShownFullHeight); 235 OmniboxCommitsWhenShownFullHeight);
236 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, LocalNTPIsNotPreloaded); 236 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, LocalNTPIsNotPreloaded);
237 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayRenderViewGone); 237 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayRenderViewGone);
238 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayDoesntSupportInstant); 238 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayDoesntSupportInstant);
239 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, 239 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest,
240 MANUAL_OmniboxFocusLoadsInstant); 240 MANUAL_OmniboxFocusLoadsInstant);
241 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, 241 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest,
242 MANUAL_BackspaceFromQueryToSelectedUrlAndNavigate); 242 MANUAL_BackspaceFromQueryToSelectedUrlAndNavigate);
243 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OnDefaultSearchProviderChanged); 243 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OnDefaultSearchProviderChanged);
244 FRIEND_TEST_ALL_PREFIXES(
245 InstantExtendedOnlineTest, RedirectToLocalOnLoadFailure);
244 246
245 Profile* profile() const; 247 Profile* profile() const;
246 InstantOverlay* overlay() const; 248 InstantOverlay* overlay() const;
247 InstantTab* instant_tab() const; 249 InstantTab* instant_tab() const;
248 InstantNTP* ntp() const; 250 InstantNTP* ntp() const;
249 251
250 // Overridden from content::NotificationObserver: 252 // Overridden from content::NotificationObserver:
251 virtual void Observe(int type, 253 virtual void Observe(int type,
252 const content::NotificationSource& source, 254 const content::NotificationSource& source,
253 const content::NotificationDetails& details) OVERRIDE; 255 const content::NotificationDetails& details) OVERRIDE;
(...skipping 18 matching lines...) Expand all
272 const content::WebContents* contents, 274 const content::WebContents* contents,
273 int height, 275 int height,
274 InstantSizeUnits units) OVERRIDE; 276 InstantSizeUnits units) OVERRIDE;
275 virtual void FocusOmnibox(const content::WebContents* contents, 277 virtual void FocusOmnibox(const content::WebContents* contents,
276 OmniboxFocusState state) OVERRIDE; 278 OmniboxFocusState state) OVERRIDE;
277 virtual void NavigateToURL( 279 virtual void NavigateToURL(
278 const content::WebContents* contents, 280 const content::WebContents* contents,
279 const GURL& url, 281 const GURL& url,
280 content::PageTransition transition, 282 content::PageTransition transition,
281 WindowOpenDisposition disposition) OVERRIDE; 283 WindowOpenDisposition disposition) OVERRIDE;
284 virtual void InstantPageLoadFailed(content::WebContents* contents) OVERRIDE;
282 285
283 // Invoked by the InstantLoader when the Instant page wants to delete a 286 // Invoked by the InstantLoader when the Instant page wants to delete a
284 // Most Visited item. 287 // Most Visited item.
285 virtual void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id) 288 virtual void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id)
286 OVERRIDE; 289 OVERRIDE;
287 290
288 // Invoked by the InstantLoader when the Instant page wants to undo a 291 // Invoked by the InstantLoader when the Instant page wants to undo a
289 // Most Visited deletion. 292 // Most Visited deletion.
290 virtual void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id) 293 virtual void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id)
291 OVERRIDE; 294 OVERRIDE;
292 295
293 // Invoked by the InstantLoader when the Instant page wants to undo all 296 // Invoked by the InstantLoader when the Instant page wants to undo all
294 // Most Visited deletions. 297 // Most Visited deletions.
295 virtual void UndoAllMostVisitedDeletions() OVERRIDE; 298 virtual void UndoAllMostVisitedDeletions() OVERRIDE;
296 299
300 // Helper function to navigate the given contents to the local fallback
301 // Instant URL and trim the history correctly.
302 void RedirectToLocalNTP(content::WebContents* contents);
303
297 // Helper for OmniboxFocusChanged. Commit or discard the overlay. 304 // Helper for OmniboxFocusChanged. Commit or discard the overlay.
298 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); 305 void OmniboxLostFocus(gfx::NativeView view_gaining_focus);
299 306
300 // Returns the local Instant URL. (Just a convenience wrapper around 307 // Returns the local Instant URL. (Just a convenience wrapper around
301 // chrome::GetLocalInstantURL.) 308 // chrome::GetLocalInstantURL.)
302 std::string GetLocalInstantURL() const; 309 std::string GetLocalInstantURL() const;
303 310
304 // Returns the correct Instant URL to use from the following possibilities: 311 // Returns the correct Instant URL to use from the following possibilities:
305 // o The default search engine's Instant URL 312 // o The default search engine's Instant URL
306 // o The --instant-url command line switch 313 // o The --instant-url command line switch
(...skipping 24 matching lines...) Expand all
331 338
332 // Called from Update() to set up the appropriate page to send user updates 339 // Called from Update() to set up the appropriate page to send user updates
333 // to. May reset |instant_tab_| or switch to a local fallback |overlay_| as 340 // to. May reset |instant_tab_| or switch to a local fallback |overlay_| as
334 // necessary. 341 // necessary.
335 bool SetUpInstantPageForUpdate(); 342 bool SetUpInstantPageForUpdate();
336 343
337 // If the active tab is an Instant search results page, sets |instant_tab_| to 344 // If the active tab is an Instant search results page, sets |instant_tab_| to
338 // point to it. Else, deletes any existing |instant_tab_|. 345 // point to it. Else, deletes any existing |instant_tab_|.
339 void ResetInstantTab(); 346 void ResetInstantTab();
340 347
348 // Sends theme info, omnibox bounds, font info, etc. down to the Instant tab.
349 void UpdateInfoForInstantTab();
350
341 // Hide the overlay. Also sends an onchange event (with blank query) to the 351 // Hide the overlay. Also sends an onchange event (with blank query) to the
342 // overlay, telling it to clear out results for any old queries. 352 // overlay, telling it to clear out results for any old queries.
343 void HideOverlay(); 353 void HideOverlay();
344 354
345 // Like HideOverlay(), but doesn't call OnStaleOverlay(). Use HideOverlay() 355 // Like HideOverlay(), but doesn't call OnStaleOverlay(). Use HideOverlay()
346 // unless you are going to call overlay_.reset() yourself subsequently. 356 // unless you are going to call overlay_.reset() yourself subsequently.
347 void HideInternal(); 357 void HideInternal();
348 358
349 // Counterpart to HideOverlay(). Asks the |browser_| to display the overlay 359 // Counterpart to HideOverlay(). Asks the |browser_| to display the overlay
350 // with the given |height| in |units|. 360 // with the given |height| in |units|.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 // Used for Top Sites async retrieval. 481 // Used for Top Sites async retrieval.
472 base::WeakPtrFactory<InstantController> weak_ptr_factory_; 482 base::WeakPtrFactory<InstantController> weak_ptr_factory_;
473 483
474 // Used to get notifications about Most Visted changes. 484 // Used to get notifications about Most Visted changes.
475 content::NotificationRegistrar registrar_; 485 content::NotificationRegistrar registrar_;
476 486
477 DISALLOW_COPY_AND_ASSIGN(InstantController); 487 DISALLOW_COPY_AND_ASSIGN(InstantController);
478 }; 488 };
479 489
480 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ 490 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698