Stop using deprecated WebContentsObserver::DidGetRedirectForResourceRequest in prerender code.
This will go away in favor of DidRedirectNavigation, since the former doesn't work with network service.
BUG=787891
Change-Id: I019001b77fe694c835d6348830309f917152e6d7
Reviewed-on: https://chromium-review.googlesource.com/786394
Reviewed-by: Matt Menke <[email protected]>
Commit-Queue: John Abd-El-Malek <[email protected]>
Cr-Commit-Position: refs/heads/master@{#518756}
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index 34013fa..07f8920f 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -573,6 +573,17 @@
has_finished_loading_ = false;
}
+void PrerenderContents::DidRedirectNavigation(
+ content::NavigationHandle* navigation_handle) {
+ if (!navigation_handle->IsInMainFrame())
+ return;
+
+ // If it's a redirect on the top-level resource, the name needs to be
+ // remembered for future matching, and if it redirects to an https resource,
+ // it needs to be canceled. If a subresource is redirected, nothing changes.
+ CheckURL(navigation_handle->GetURL());
+}
+
void PrerenderContents::DidFinishLoad(
content::RenderFrameHost* render_frame_host,
const GURL& validated_url) {
@@ -627,17 +638,6 @@
}
}
-void PrerenderContents::DidGetRedirectForResourceRequest(
- const content::ResourceRedirectDetails& details) {
- // DidGetRedirectForResourceRequest can come for any resource on a page. If
- // it's a redirect on the top-level resource, the name needs to be remembered
- // for future matching, and if it redirects to an https resource, it needs to
- // be canceled. If a subresource is redirected, nothing changes.
- if (details.resource_type != content::RESOURCE_TYPE_MAIN_FRAME)
- return;
- CheckURL(details.new_url);
-}
-
void PrerenderContents::Destroy(FinalStatus final_status) {
DCHECK_NE(final_status, FINAL_STATUS_USED);