| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/navigation_interception/intercept_navigation_resource_throt
tle.h" | 5 #include "components/navigation_interception/intercept_navigation_resource_throt
tle.h" |
| 6 | 6 |
| 7 #include "components/navigation_interception/navigation_params.h" | 7 #include "components/navigation_interception/navigation_params.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/child_process_security_policy.h" | 9 #include "content/public/browser/child_process_security_policy.h" |
| 10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 const char* InterceptNavigationResourceThrottle::GetNameForLogging() const { | 87 const char* InterceptNavigationResourceThrottle::GetNameForLogging() const { |
| 88 return "InterceptNavigationResourceThrottle"; | 88 return "InterceptNavigationResourceThrottle"; |
| 89 } | 89 } |
| 90 | 90 |
| 91 std::string InterceptNavigationResourceThrottle::GetMethodAfterRedirect() { | 91 std::string InterceptNavigationResourceThrottle::GetMethodAfterRedirect() { |
| 92 net::HttpResponseHeaders* headers = request_->response_headers(); | 92 net::HttpResponseHeaders* headers = request_->response_headers(); |
| 93 if (!headers) | 93 if (!headers) |
| 94 return request_->method(); | 94 return request_->method(); |
| 95 // TODO(davidben): Plumb net::RedirectInfo through content::ResourceThrottle |
| 96 // and unexpose net::URLRequest::ComputeMethodForRedirect. |
| 95 return net::URLRequest::ComputeMethodForRedirect( | 97 return net::URLRequest::ComputeMethodForRedirect( |
| 96 request_->method(), headers->response_code()); | 98 request_->method(), headers->response_code()); |
| 97 } | 99 } |
| 98 | 100 |
| 99 bool InterceptNavigationResourceThrottle::CheckIfShouldIgnoreNavigation( | 101 bool InterceptNavigationResourceThrottle::CheckIfShouldIgnoreNavigation( |
| 100 const GURL& url, | 102 const GURL& url, |
| 101 const std::string& method, | 103 const std::string& method, |
| 102 bool is_redirect) { | 104 bool is_redirect) { |
| 103 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); | 105 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); |
| 104 if (!info) | 106 if (!info) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 140 | 142 |
| 141 if (should_ignore_navigation) { | 143 if (should_ignore_navigation) { |
| 142 controller()->CancelAndIgnore(); | 144 controller()->CancelAndIgnore(); |
| 143 } else { | 145 } else { |
| 144 controller()->Resume(); | 146 controller()->Resume(); |
| 145 } | 147 } |
| 146 } | 148 } |
| 147 | 149 |
| 148 } // namespace navigation_interception | 150 } // namespace navigation_interception |
| OLD | NEW |