| 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/net/aw_web_resource_request.h" | 15 #include "android_webview/browser/net/aw_web_resource_request.h" |
| 16 #include "android_webview/browser/renderer_host/auto_login_parser.h" | 16 #include "android_webview/browser/renderer_host/auto_login_parser.h" |
| 17 #include "android_webview/common/url_constants.h" | 17 #include "android_webview/common/url_constants.h" |
| 18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
| 19 #include "components/navigation_interception/intercept_navigation_delegate.h" | 19 #include "components/navigation_interception/intercept_navigation_delegate.h" |
| 20 #include "components/safe_browsing/base_resource_throttle.h" |
| 20 #include "components/web_restrictions/browser/web_restrictions_resource_throttle
.h" | 21 #include "components/web_restrictions/browser/web_restrictions_resource_throttle
.h" |
| 21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/browser/resource_dispatcher_host.h" | 23 #include "content/public/browser/resource_dispatcher_host.h" |
| 23 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" | 24 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" |
| 24 #include "content/public/browser/resource_request_info.h" | 25 #include "content/public/browser/resource_request_info.h" |
| 25 #include "content/public/browser/resource_throttle.h" | 26 #include "content/public/browser/resource_throttle.h" |
| 26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 27 #include "net/base/load_flags.h" | 28 #include "net/base/load_flags.h" |
| 28 #include "net/base/net_errors.h" | 29 #include "net/base/net_errors.h" |
| 29 #include "net/http/http_response_headers.h" | 30 #include "net/http/http_response_headers.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 net::URLRequest* request, | 265 net::URLRequest* request, |
| 265 content::ResourceContext* resource_context, | 266 content::ResourceContext* resource_context, |
| 266 content::AppCacheService* appcache_service, | 267 content::AppCacheService* appcache_service, |
| 267 ResourceType resource_type, | 268 ResourceType resource_type, |
| 268 std::vector<std::unique_ptr<content::ResourceThrottle>>* throttles) { | 269 std::vector<std::unique_ptr<content::ResourceThrottle>>* throttles) { |
| 269 AddExtraHeadersIfNeeded(request, resource_context); | 270 AddExtraHeadersIfNeeded(request, resource_context); |
| 270 | 271 |
| 271 const content::ResourceRequestInfo* request_info = | 272 const content::ResourceRequestInfo* request_info = |
| 272 content::ResourceRequestInfo::ForRequest(request); | 273 content::ResourceRequestInfo::ForRequest(request); |
| 273 | 274 |
| 275 content::ResourceThrottle* throttle = |
| 276 safe_browsing::BaseResourceThrottle::MaybeCreate( |
| 277 request, resource_type, |
| 278 AwBrowserContext::GetDefault()->GetSafeBrowsingDBManager(), |
| 279 AwBrowserContext::GetDefault()->GetSafeBrowsingUIManager()); |
| 280 if (throttle == nullptr) { |
| 281 LOG(WARNING) << "Failed creating safebrowsing throttle"; |
| 282 } else { |
| 283 throttles->push_back(base::WrapUnique(throttle)); |
| 284 } |
| 285 |
| 274 // We always push the throttles here. Checking the existence of io_client | 286 // We always push the throttles here. Checking the existence of io_client |
| 275 // is racy when a popup window is created. That is because RequestBeginning | 287 // is racy when a popup window is created. That is because RequestBeginning |
| 276 // is called whether or not requests are blocked via BlockRequestForRoute() | 288 // is called whether or not requests are blocked via BlockRequestForRoute() |
| 277 // however io_client may or may not be ready at the time depending on whether | 289 // however io_client may or may not be ready at the time depending on whether |
| 278 // webcontents is created. | 290 // webcontents is created. |
| 279 throttles->push_back(base::MakeUnique<IoThreadClientThrottle>( | 291 throttles->push_back(base::MakeUnique<IoThreadClientThrottle>( |
| 280 request_info->GetChildID(), request_info->GetRenderFrameID(), request)); | 292 request_info->GetChildID(), request_info->GetRenderFrameID(), request)); |
| 281 | 293 |
| 282 bool is_main_frame = resource_type == content::RESOURCE_TYPE_MAIN_FRAME; | 294 bool is_main_frame = resource_type == content::RESOURCE_TYPE_MAIN_FRAME; |
| 283 if (!is_main_frame) | 295 if (!is_main_frame) |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 net::HttpRequestHeaders headers; | 488 net::HttpRequestHeaders headers; |
| 477 headers.AddHeadersFromString(extra_headers); | 489 headers.AddHeadersFromString(extra_headers); |
| 478 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { | 490 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { |
| 479 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); | 491 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); |
| 480 } | 492 } |
| 481 } | 493 } |
| 482 } | 494 } |
| 483 } | 495 } |
| 484 | 496 |
| 485 } // namespace android_webview | 497 } // namespace android_webview |
| OLD | NEW |