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

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 terrible flag guarding logic 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 NavigateToURLSuggestionHitEnterAndLookForSubmit); 221 NavigateToURLSuggestionHitEnterAndLookForSubmit);
222 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, 222 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest,
223 MiddleClickOnSuggestionOpensInNewTab); 223 MiddleClickOnSuggestionOpensInNewTab);
224 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded); 224 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded);
225 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab); 225 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab);
226 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab); 226 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab);
227 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPForWrongProvider); 227 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPForWrongProvider);
228 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPRenderViewGone); 228 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPRenderViewGone);
229 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, 229 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest,
230 PreloadedNTPDoesntSupportInstant); 230 PreloadedNTPDoesntSupportInstant);
231 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, RedirectToLocalOnLoadFailure);
231 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); 232 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation);
232 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UnrelatedSiteInstance); 233 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UnrelatedSiteInstance);
233 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ValidatesSuggestions); 234 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ValidatesSuggestions);
234 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, 235 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest,
235 OmniboxCommitsWhenShownFullHeight); 236 OmniboxCommitsWhenShownFullHeight);
236 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, LocalNTPIsNotPreloaded); 237 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, LocalNTPIsNotPreloaded);
237 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayRenderViewGone); 238 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayRenderViewGone);
238 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayDoesntSupportInstant); 239 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayDoesntSupportInstant);
239 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, 240 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest,
240 MANUAL_OmniboxFocusLoadsInstant); 241 MANUAL_OmniboxFocusLoadsInstant);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 const content::WebContents* contents, 273 const content::WebContents* contents,
273 int height, 274 int height,
274 InstantSizeUnits units) OVERRIDE; 275 InstantSizeUnits units) OVERRIDE;
275 virtual void FocusOmnibox(const content::WebContents* contents, 276 virtual void FocusOmnibox(const content::WebContents* contents,
276 OmniboxFocusState state) OVERRIDE; 277 OmniboxFocusState state) OVERRIDE;
277 virtual void NavigateToURL( 278 virtual void NavigateToURL(
278 const content::WebContents* contents, 279 const content::WebContents* contents,
279 const GURL& url, 280 const GURL& url,
280 content::PageTransition transition, 281 content::PageTransition transition,
281 WindowOpenDisposition disposition) OVERRIDE; 282 WindowOpenDisposition disposition) OVERRIDE;
283 virtual void InstantPageLoadFailed(content::WebContents* contents) OVERRIDE;
282 284
283 // Invoked by the InstantLoader when the Instant page wants to delete a 285 // Invoked by the InstantLoader when the Instant page wants to delete a
284 // Most Visited item. 286 // Most Visited item.
285 virtual void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id) 287 virtual void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id)
286 OVERRIDE; 288 OVERRIDE;
287 289
288 // Invoked by the InstantLoader when the Instant page wants to undo a 290 // Invoked by the InstantLoader when the Instant page wants to undo a
289 // Most Visited deletion. 291 // Most Visited deletion.
290 virtual void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id) 292 virtual void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id)
291 OVERRIDE; 293 OVERRIDE;
292 294
293 // Invoked by the InstantLoader when the Instant page wants to undo all 295 // Invoked by the InstantLoader when the Instant page wants to undo all
294 // Most Visited deletions. 296 // Most Visited deletions.
295 virtual void UndoAllMostVisitedDeletions() OVERRIDE; 297 virtual void UndoAllMostVisitedDeletions() OVERRIDE;
296 298
299 // Helper function to navigate the given contents to the local fallback
300 // Instant URL and trim the history correctly.
301 void RedirectToLocalNTP(content::WebContents* contents);
302
297 // Helper for OmniboxFocusChanged. Commit or discard the overlay. 303 // Helper for OmniboxFocusChanged. Commit or discard the overlay.
298 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); 304 void OmniboxLostFocus(gfx::NativeView view_gaining_focus);
299 305
300 // Returns the local Instant URL. (Just a convenience wrapper around 306 // Returns the local Instant URL. (Just a convenience wrapper around
301 // chrome::GetLocalInstantURL.) 307 // chrome::GetLocalInstantURL.)
302 std::string GetLocalInstantURL() const; 308 std::string GetLocalInstantURL() const;
303 309
304 // Returns the correct Instant URL to use from the following possibilities: 310 // Returns the correct Instant URL to use from the following possibilities:
305 // o The default search engine's Instant URL 311 // o The default search engine's Instant URL
306 // o The --instant-url command line switch 312 // o The --instant-url command line switch
(...skipping 24 matching lines...) Expand all
331 337
332 // Called from Update() to set up the appropriate page to send user updates 338 // 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 339 // to. May reset |instant_tab_| or switch to a local fallback |overlay_| as
334 // necessary. 340 // necessary.
335 bool SetUpInstantPageForUpdate(); 341 bool SetUpInstantPageForUpdate();
336 342
337 // If the active tab is an Instant search results page, sets |instant_tab_| to 343 // If the active tab is an Instant search results page, sets |instant_tab_| to
338 // point to it. Else, deletes any existing |instant_tab_|. 344 // point to it. Else, deletes any existing |instant_tab_|.
339 void ResetInstantTab(); 345 void ResetInstantTab();
340 346
347 // Sends theme info, omnibox bounds, font info, etc. down to the Instant tab.
348 void UpdateInfoForInstantTab();
349
341 // Hide the overlay. Also sends an onchange event (with blank query) to the 350 // 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. 351 // overlay, telling it to clear out results for any old queries.
343 void HideOverlay(); 352 void HideOverlay();
344 353
345 // Like HideOverlay(), but doesn't call OnStaleOverlay(). Use HideOverlay() 354 // Like HideOverlay(), but doesn't call OnStaleOverlay(). Use HideOverlay()
346 // unless you are going to call overlay_.reset() yourself subsequently. 355 // unless you are going to call overlay_.reset() yourself subsequently.
347 void HideInternal(); 356 void HideInternal();
348 357
349 // Counterpart to HideOverlay(). Asks the |browser_| to display the overlay 358 // Counterpart to HideOverlay(). Asks the |browser_| to display the overlay
350 // with the given |height| in |units|. 359 // 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. 480 // Used for Top Sites async retrieval.
472 base::WeakPtrFactory<InstantController> weak_ptr_factory_; 481 base::WeakPtrFactory<InstantController> weak_ptr_factory_;
473 482
474 // Used to get notifications about Most Visted changes. 483 // Used to get notifications about Most Visted changes.
475 content::NotificationRegistrar registrar_; 484 content::NotificationRegistrar registrar_;
476 485
477 DISALLOW_COPY_AND_ASSIGN(InstantController); 486 DISALLOW_COPY_AND_ASSIGN(InstantController);
478 }; 487 };
479 488
480 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ 489 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698