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

Unified Diff: components/navigation_interception/intercept_navigation_resource_throttle.cc

Issue 893843003: Add RedirectInfo as a redirect parameter to ResourceThrottles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Document ResourceThrottle Created 5 years, 10 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: components/navigation_interception/intercept_navigation_resource_throttle.cc
diff --git a/components/navigation_interception/intercept_navigation_resource_throttle.cc b/components/navigation_interception/intercept_navigation_resource_throttle.cc
index 4ed560c99d65f12d08171d01cb8f10d9bbab0317..cb07e58057393c75d601c5512fef92c1b1f5d4a4 100644
--- a/components/navigation_interception/intercept_navigation_resource_throttle.cc
+++ b/components/navigation_interception/intercept_navigation_resource_throttle.cc
@@ -15,6 +15,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/referrer.h"
#include "net/http/http_response_headers.h"
+#include "net/url_request/redirect_info.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_job_factory.h"
#include "net/url_request/url_request.h"
@@ -81,26 +82,16 @@ void InterceptNavigationResourceThrottle::WillStartRequest(bool* defer) {
}
void InterceptNavigationResourceThrottle::WillRedirectRequest(
- const GURL& new_url,
+ const net::RedirectInfo& redirect_info,
bool* defer) {
- *defer =
- CheckIfShouldIgnoreNavigation(new_url, GetMethodAfterRedirect(), true);
+ *defer = CheckIfShouldIgnoreNavigation(redirect_info.new_url,
+ redirect_info.new_method, true);
}
const char* InterceptNavigationResourceThrottle::GetNameForLogging() const {
return "InterceptNavigationResourceThrottle";
}
-std::string InterceptNavigationResourceThrottle::GetMethodAfterRedirect() {
- net::HttpResponseHeaders* headers = request_->response_headers();
- if (!headers)
- return request_->method();
- // TODO(davidben): Plumb net::RedirectInfo through content::ResourceThrottle
- // and unexpose net::URLRequest::ComputeMethodForRedirect.
- return net::URLRequest::ComputeMethodForRedirect(
- request_->method(), headers->response_code());
-}
-
bool InterceptNavigationResourceThrottle::CheckIfShouldIgnoreNavigation(
const GURL& url,
const std::string& method,

Powered by Google App Engine
This is Rietveld 408576698