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

Unified Diff: chrome/browser/instant/instant_loader.cc

Issue 11785025: Do not commit InstantLoader server redirects till the page supports instant. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 11 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/instant/instant_loader.cc
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index c6e6874e5473509f431f41f34e479e93a1524e95..10246909e6ffc12aacd52626a9476fd3a8c822f0 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -19,6 +19,7 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_widget_host_view.h"
+#include "content/public/browser/resource_request_details.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_view.h"
#include "ipc/ipc_message.h"
@@ -326,7 +327,9 @@ void InstantLoader::RenderViewGone() {
}
void InstantLoader::AboutToNavigateMainFrame(const GURL& url) {
- controller_->InstantLoaderAboutToNavigateMainFrame(url);
+ controller_->InstantLoaderAboutToNavigateMainFrame(
+ url, url == expected_redirect_);
+ expected_redirect_ = GURL();
}
void InstantLoader::NavigateToURL(const GURL& url,
@@ -338,6 +341,13 @@ void InstantLoader::NavigateToURL(const GURL& url,
void InstantLoader::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
+ if (type == content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT) {
+ content::ResourceRedirectDetails* resource_redirect_details =
+ content::Details<content::ResourceRedirectDetails>(details).ptr();
+ if (resource_redirect_details->resource_type == ResourceType::MAIN_FRAME)
+ expected_redirect_ = resource_redirect_details->new_url;
+ }
+
#if defined(OS_MACOSX)
if (type == content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED) {
if (content::RenderWidgetHostView* rwhv =
@@ -397,6 +407,9 @@ void InstantLoader::SetupPreviewContents() {
content::Source<content::NavigationController>(
&contents_->GetController()));
#endif
+
+ registrar_.Add(this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
+ content::Source<content::WebContents>(contents()));
}
void InstantLoader::CleanupPreviewContents() {
« chrome/browser/instant/instant_controller.cc ('K') | « chrome/browser/instant/instant_loader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698