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

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: Remove logic to always try to load a server-provided NTP on frontmost tab. 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 <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 const content::WebContents* contents, 259 const content::WebContents* contents,
260 int height, 260 int height,
261 InstantSizeUnits units) OVERRIDE; 261 InstantSizeUnits units) OVERRIDE;
262 virtual void FocusOmnibox(const content::WebContents* contents, 262 virtual void FocusOmnibox(const content::WebContents* contents,
263 OmniboxFocusState state) OVERRIDE; 263 OmniboxFocusState state) OVERRIDE;
264 virtual void NavigateToURL( 264 virtual void NavigateToURL(
265 const content::WebContents* contents, 265 const content::WebContents* contents,
266 const GURL& url, 266 const GURL& url,
267 content::PageTransition transition, 267 content::PageTransition transition,
268 WindowOpenDisposition disposition) OVERRIDE; 268 WindowOpenDisposition disposition) OVERRIDE;
269 virtual void InstantPageLoadFailed(content::WebContents* contents) OVERRIDE;
269 270
270 // Invoked by the InstantLoader when the Instant page wants to delete a 271 // Invoked by the InstantLoader when the Instant page wants to delete a
271 // Most Visited item. 272 // Most Visited item.
272 virtual void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id) 273 virtual void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id)
273 OVERRIDE; 274 OVERRIDE;
274 275
275 // Invoked by the InstantLoader when the Instant page wants to undo a 276 // Invoked by the InstantLoader when the Instant page wants to undo a
276 // Most Visited deletion. 277 // Most Visited deletion.
277 virtual void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id) 278 virtual void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id)
278 OVERRIDE; 279 OVERRIDE;
279 280
280 // Invoked by the InstantLoader when the Instant page wants to undo all 281 // Invoked by the InstantLoader when the Instant page wants to undo all
281 // Most Visited deletions. 282 // Most Visited deletions.
282 virtual void UndoAllMostVisitedDeletions() OVERRIDE; 283 virtual void UndoAllMostVisitedDeletions() OVERRIDE;
283 284
285 // Helper function to navigate the given contents to the local fallback
286 // Instant URL and trim the history correctly.
287 void RedirectToLocalNTP(content::WebContents* contents);
288
284 // Helper for OmniboxFocusChanged. Commit or discard the overlay. 289 // Helper for OmniboxFocusChanged. Commit or discard the overlay.
285 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); 290 void OmniboxLostFocus(gfx::NativeView view_gaining_focus);
286 291
287 // Creates a new NTP, using the instant_url property of the default 292 // Creates a new NTP, using the instant_url property of the default
288 // TemplateURL, or chrome::kChromeSearchLocalNTPURL if |use_local_ntp| is 293 // TemplateURL, or chrome::kChromeSearchLocalNTPURL if |use_local_ntp| is
289 // true. For |ignore_blacklist| look at comments in GetInstantURL(). 294 // true. For |ignore_blacklist| look at comments in GetInstantURL().
290 void ResetNTP(bool ignore_blacklist, bool use_local_ntp); 295 void ResetNTP(bool ignore_blacklist, bool use_local_ntp);
291 296
292 // Ensures that |overlay_| uses the Instant URL returned by GetInstantURL(), 297 // Ensures that |overlay_| uses the Instant URL returned by GetInstantURL(),
293 // creating a new overlay if necessary. In extended mode, will fallback to 298 // creating a new overlay if necessary. In extended mode, will fallback to
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // Used for Top Sites async retrieval. 479 // Used for Top Sites async retrieval.
475 base::WeakPtrFactory<InstantController> weak_ptr_factory_; 480 base::WeakPtrFactory<InstantController> weak_ptr_factory_;
476 481
477 // Used to get notifications about Most Visted changes. 482 // Used to get notifications about Most Visted changes.
478 content::NotificationRegistrar registrar_; 483 content::NotificationRegistrar registrar_;
479 484
480 DISALLOW_COPY_AND_ASSIGN(InstantController); 485 DISALLOW_COPY_AND_ASSIGN(InstantController);
481 }; 486 };
482 487
483 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ 488 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698