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 <string> | 7 #include <string> |
8 | 8 |
| 9 #include "android_webview/browser/aw_browser_context.h" |
9 #include "android_webview/browser/aw_contents_io_thread_client.h" | 10 #include "android_webview/browser/aw_contents_io_thread_client.h" |
10 #include "android_webview/browser/aw_login_delegate.h" | 11 #include "android_webview/browser/aw_login_delegate.h" |
11 #include "android_webview/browser/aw_resource_context.h" | 12 #include "android_webview/browser/aw_resource_context.h" |
12 #include "android_webview/common/url_constants.h" | 13 #include "android_webview/common/url_constants.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.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_restriction/web_restriction_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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 content::ResourceRequestInfo::ForRequest(request); | 216 content::ResourceRequestInfo::ForRequest(request); |
215 | 217 |
216 // We always push the throttles here. Checking the existence of io_client | 218 // We always push the throttles here. Checking the existence of io_client |
217 // is racy when a popup window is created. That is because RequestBeginning | 219 // is racy when a popup window is created. That is because RequestBeginning |
218 // is called whether or not requests are blocked via BlockRequestForRoute() | 220 // is called whether or not requests are blocked via BlockRequestForRoute() |
219 // however io_client may or may not be ready at the time depending on whether | 221 // however io_client may or may not be ready at the time depending on whether |
220 // webcontents is created. | 222 // webcontents is created. |
221 throttles->push_back(new IoThreadClientThrottle( | 223 throttles->push_back(new IoThreadClientThrottle( |
222 request_info->GetChildID(), request_info->GetRenderFrameID(), request)); | 224 request_info->GetChildID(), request_info->GetRenderFrameID(), request)); |
223 | 225 |
224 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) | 226 bool is_main_frame = resource_type == content::RESOURCE_TYPE_MAIN_FRAME; |
| 227 if (!is_main_frame) |
225 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); | 228 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); |
| 229 throttles->push_back(new web_restriction::WebRestrictionResourceThrottle( |
| 230 AwBrowserContext::GetDefault()->GetWebRestrictionProvider(), |
| 231 request->url(), is_main_frame)); |
226 } | 232 } |
227 | 233 |
228 void AwResourceDispatcherHostDelegate::OnRequestRedirected( | 234 void AwResourceDispatcherHostDelegate::OnRequestRedirected( |
229 const GURL& redirect_url, | 235 const GURL& redirect_url, |
230 net::URLRequest* request, | 236 net::URLRequest* request, |
231 content::ResourceContext* resource_context, | 237 content::ResourceContext* resource_context, |
232 content::ResourceResponse* response) { | 238 content::ResourceResponse* response) { |
233 AddExtraHeadersIfNeeded(request, resource_context); | 239 AddExtraHeadersIfNeeded(request, resource_context); |
234 } | 240 } |
235 | 241 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 net::HttpRequestHeaders headers; | 437 net::HttpRequestHeaders headers; |
432 headers.AddHeadersFromString(extra_headers); | 438 headers.AddHeadersFromString(extra_headers); |
433 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { | 439 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { |
434 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); | 440 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); |
435 } | 441 } |
436 } | 442 } |
437 } | 443 } |
438 } | 444 } |
439 | 445 |
440 } // namespace android_webview | 446 } // namespace android_webview |
OLD | NEW |