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 "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" | 5 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
11 #include "android_webview/browser/aw_contents_client_bridge_base.h" | 11 #include "android_webview/browser/aw_contents_client_bridge_base.h" |
12 #include "android_webview/browser/aw_contents_io_thread_client.h" | 12 #include "android_webview/browser/aw_contents_io_thread_client.h" |
13 #include "android_webview/browser/aw_login_delegate.h" | 13 #include "android_webview/browser/aw_login_delegate.h" |
14 #include "android_webview/browser/aw_resource_context.h" | 14 #include "android_webview/browser/aw_resource_context.h" |
15 #include "android_webview/browser/renderer_host/auto_login_parser.h" | 15 #include "android_webview/browser/renderer_host/auto_login_parser.h" |
16 #include "android_webview/common/url_constants.h" | 16 #include "android_webview/common/url_constants.h" |
17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
18 #include "components/navigation_interception/intercept_navigation_delegate.h" | 18 #include "components/navigation_interception/intercept_navigation_delegate.h" |
19 #include "components/web_restrictions/browser/web_restrictions_resource_throttle
.h" | 19 #include "components/web_restrictions/browser/web_restrictions_resource_throttle
.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/resource_controller.h" | |
22 #include "content/public/browser/resource_dispatcher_host.h" | 21 #include "content/public/browser/resource_dispatcher_host.h" |
23 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" | 22 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" |
24 #include "content/public/browser/resource_request_info.h" | 23 #include "content/public/browser/resource_request_info.h" |
25 #include "content/public/browser/resource_throttle.h" | 24 #include "content/public/browser/resource_throttle.h" |
26 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
27 #include "net/base/load_flags.h" | 26 #include "net/base/load_flags.h" |
28 #include "net/base/net_errors.h" | 27 #include "net/base/net_errors.h" |
29 #include "net/http/http_response_headers.h" | 28 #include "net/http/http_response_headers.h" |
30 #include "net/url_request/url_request.h" | 29 #include "net/url_request/url_request.h" |
31 #include "net/url_request/url_request_status.h" | 30 #include "net/url_request/url_request_status.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 const net::RedirectInfo& redirect_info, | 168 const net::RedirectInfo& redirect_info, |
170 bool* defer) { | 169 bool* defer) { |
171 WillStartRequest(defer); | 170 WillStartRequest(defer); |
172 } | 171 } |
173 | 172 |
174 void IoThreadClientThrottle::OnIoThreadClientReady(int new_render_process_id, | 173 void IoThreadClientThrottle::OnIoThreadClientReady(int new_render_process_id, |
175 int new_render_frame_id) { | 174 int new_render_frame_id) { |
176 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 175 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
177 | 176 |
178 if (!MaybeBlockRequest()) { | 177 if (!MaybeBlockRequest()) { |
179 controller()->Resume(); | 178 Resume(); |
180 } | 179 } |
181 } | 180 } |
182 | 181 |
183 bool IoThreadClientThrottle::MaybeBlockRequest() { | 182 bool IoThreadClientThrottle::MaybeBlockRequest() { |
184 if (ShouldBlockRequest()) { | 183 if (ShouldBlockRequest()) { |
185 controller()->CancelWithError(net::ERR_ACCESS_DENIED); | 184 CancelWithError(net::ERR_ACCESS_DENIED); |
186 return true; | 185 return true; |
187 } | 186 } |
188 return false; | 187 return false; |
189 } | 188 } |
190 | 189 |
191 bool IoThreadClientThrottle::ShouldBlockRequest() { | 190 bool IoThreadClientThrottle::ShouldBlockRequest() { |
192 std::unique_ptr<AwContentsIoThreadClient> io_client = GetIoThreadClient(); | 191 std::unique_ptr<AwContentsIoThreadClient> io_client = GetIoThreadClient(); |
193 if (!io_client) | 192 if (!io_client) |
194 return false; | 193 return false; |
195 | 194 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 net::HttpRequestHeaders headers; | 464 net::HttpRequestHeaders headers; |
466 headers.AddHeadersFromString(extra_headers); | 465 headers.AddHeadersFromString(extra_headers); |
467 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { | 466 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { |
468 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); | 467 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); |
469 } | 468 } |
470 } | 469 } |
471 } | 470 } |
472 } | 471 } |
473 | 472 |
474 } // namespace android_webview | 473 } // namespace android_webview |
OLD | NEW |