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() { |