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

Unified Diff: chrome/browser/ui/search/instant_page.cc

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, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/search/instant_page.cc
diff --git a/chrome/browser/ui/search/instant_page.cc b/chrome/browser/ui/search/instant_page.cc
index dbb5c2527307a041d6f6cd94f8aa48d0af85bd73..c773378273457a020ac558ee7536e853ae5a4974 100644
--- a/chrome/browser/ui/search/instant_page.cc
+++ b/chrome/browser/ui/search/instant_page.cc
@@ -7,7 +7,9 @@
#include "base/utf_string_conversions.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
+#include "content/public/browser/navigation_details.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/frame_navigate_params.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/font.h"
@@ -193,6 +195,16 @@ void InstantPage::DidCommitProvisionalLoadForFrame(
delegate_->InstantPageAboutToNavigateMainFrame(contents(), url);
}
+void InstantPage::DidFailProvisionalLoad(
samarth 2013/05/03 04:39:17 nit: keep functions in same order as in the header
David Black 2013/05/03 06:14:44 Done.
sreeram 2013/05/03 23:17:31 Not done?
David Black 2013/05/04 00:49:23 Done.
+ int64 /* frame_id */,
+ bool /* is_main_frame */,
+ const GURL& /* validated_url */,
+ int /* error_code */,
+ const string16& /* error_description */,
+ content::RenderViewHost* /* render_view_host */) {
+ delegate_->InstantPageLoadFailed(contents());
sreeram 2013/05/03 23:17:31 Shouldn't you do this only for "if (is_main_frame)
David Black 2013/05/04 00:49:23 Sure, I guess that sanity check makes sense. Done
+}
+
void InstantPage::OnSetSuggestions(
int page_id,
const std::vector<InstantSuggestion>& suggestions) {
@@ -258,3 +270,13 @@ void InstantPage::OnUndoMostVisitedDeletion(InstantRestrictedID restricted_id) {
void InstantPage::OnUndoAllMostVisitedDeletions() {
delegate_->UndoAllMostVisitedDeletions();
}
+
+void InstantPage::DidNavigateMainFrame(
+ const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& /* params */) {
sreeram 2013/05/03 23:17:31 Strange indent. Either 4 from beginning of line, o
David Black 2013/05/04 00:49:23 Done.
+ // A 204 can be sent by the search provider as a lightweight signal
+ // to fall back to the local page, and we obviously want to fall back
+ // if we get any response code that indicates an error.
+ if (details.http_status_code == 204 || details.http_status_code >= 400)
+ delegate_->InstantPageLoadFailed(contents());
sreeram 2013/05/03 23:17:31 DidNavigateMainFrame() is called for all main page
David Black 2013/05/04 00:49:23 This does not seem like a coherent concern to me.
David Black 2013/05/04 00:53:51 I have verified that history.pushState does not re
+}

Powered by Google App Engine
This is Rietveld 408576698