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_contents_io_thread_client.h" | 11 #include "android_webview/browser/aw_contents_io_thread_client.h" |
11 #include "android_webview/browser/aw_login_delegate.h" | 12 #include "android_webview/browser/aw_login_delegate.h" |
12 #include "android_webview/browser/aw_resource_context.h" | 13 #include "android_webview/browser/aw_resource_context.h" |
13 #include "android_webview/common/url_constants.h" | 14 #include "android_webview/common/url_constants.h" |
14 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
15 #include "components/auto_login_parser/auto_login_parser.h" | 16 #include "components/auto_login_parser/auto_login_parser.h" |
16 #include "components/navigation_interception/intercept_navigation_delegate.h" | 17 #include "components/navigation_interception/intercept_navigation_delegate.h" |
| 18 #include "components/web_restrictions/browser/web_restrictions_resource_throttle
.h" |
17 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/resource_controller.h" | 20 #include "content/public/browser/resource_controller.h" |
19 #include "content/public/browser/resource_dispatcher_host.h" | 21 #include "content/public/browser/resource_dispatcher_host.h" |
20 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" | 22 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" |
21 #include "content/public/browser/resource_request_info.h" | 23 #include "content/public/browser/resource_request_info.h" |
22 #include "content/public/browser/resource_throttle.h" | 24 #include "content/public/browser/resource_throttle.h" |
23 #include "net/base/load_flags.h" | 25 #include "net/base/load_flags.h" |
24 #include "net/base/net_errors.h" | 26 #include "net/base/net_errors.h" |
25 #include "net/http/http_response_headers.h" | 27 #include "net/http/http_response_headers.h" |
26 #include "net/url_request/url_request.h" | 28 #include "net/url_request/url_request.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 content::ResourceRequestInfo::ForRequest(request); | 223 content::ResourceRequestInfo::ForRequest(request); |
222 | 224 |
223 // We always push the throttles here. Checking the existence of io_client | 225 // We always push the throttles here. Checking the existence of io_client |
224 // is racy when a popup window is created. That is because RequestBeginning | 226 // is racy when a popup window is created. That is because RequestBeginning |
225 // is called whether or not requests are blocked via BlockRequestForRoute() | 227 // is called whether or not requests are blocked via BlockRequestForRoute() |
226 // however io_client may or may not be ready at the time depending on whether | 228 // however io_client may or may not be ready at the time depending on whether |
227 // webcontents is created. | 229 // webcontents is created. |
228 throttles->push_back(new IoThreadClientThrottle( | 230 throttles->push_back(new IoThreadClientThrottle( |
229 request_info->GetChildID(), request_info->GetRenderFrameID(), request)); | 231 request_info->GetChildID(), request_info->GetRenderFrameID(), request)); |
230 | 232 |
231 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) | 233 bool is_main_frame = resource_type == content::RESOURCE_TYPE_MAIN_FRAME; |
| 234 if (!is_main_frame) |
232 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); | 235 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); |
| 236 throttles->push_back(new web_restrictions::WebRestrictionsResourceThrottle( |
| 237 AwBrowserContext::GetDefault()->GetWebRestrictionProvider(), |
| 238 request->url(), is_main_frame)); |
233 } | 239 } |
234 | 240 |
235 void AwResourceDispatcherHostDelegate::OnRequestRedirected( | 241 void AwResourceDispatcherHostDelegate::OnRequestRedirected( |
236 const GURL& redirect_url, | 242 const GURL& redirect_url, |
237 net::URLRequest* request, | 243 net::URLRequest* request, |
238 content::ResourceContext* resource_context, | 244 content::ResourceContext* resource_context, |
239 content::ResourceResponse* response) { | 245 content::ResourceResponse* response) { |
240 AddExtraHeadersIfNeeded(request, resource_context); | 246 AddExtraHeadersIfNeeded(request, resource_context); |
241 } | 247 } |
242 | 248 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 net::HttpRequestHeaders headers; | 443 net::HttpRequestHeaders headers; |
438 headers.AddHeadersFromString(extra_headers); | 444 headers.AddHeadersFromString(extra_headers); |
439 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { | 445 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { |
440 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); | 446 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); |
441 } | 447 } |
442 } | 448 } |
443 } | 449 } |
444 } | 450 } |
445 | 451 |
446 } // namespace android_webview | 452 } // namespace android_webview |
OLD | NEW |