| 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.h" | 11 #include "android_webview/browser/aw_contents_client_bridge.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/aw_safe_browsing_config_helper.h" | 15 #include "android_webview/browser/aw_safe_browsing_config_helper.h" | 
| 16 #include "android_webview/browser/aw_safe_browsing_resource_throttle.h" | 16 #include "android_webview/browser/aw_safe_browsing_resource_throttle.h" | 
| 17 #include "android_webview/browser/net/aw_web_resource_request.h" | 17 #include "android_webview/browser/net/aw_web_resource_request.h" | 
| 18 #include "android_webview/browser/renderer_host/auto_login_parser.h" | 18 #include "android_webview/browser/renderer_host/auto_login_parser.h" | 
| 19 #include "android_webview/common/url_constants.h" | 19 #include "android_webview/common/url_constants.h" | 
| 20 #include "base/memory/scoped_vector.h" | 20 #include "base/memory/scoped_vector.h" | 
| 21 #include "components/navigation_interception/intercept_navigation_delegate.h" | 21 #include "components/navigation_interception/intercept_navigation_delegate.h" | 
| 22 #include "components/safe_browsing_db/safe_browsing_api_handler.h" | 22 #include "components/safe_browsing_db/safe_browsing_api_handler.h" | 
| 23 #include "components/web_restrictions/browser/web_restrictions_resource_throttle
     .h" | 23 #include "components/web_restrictions/browser/web_restrictions_resource_throttle
     .h" | 
| 24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" | 
| 25 #include "content/public/browser/resource_dispatcher_host.h" | 25 #include "content/public/browser/resource_dispatcher_host.h" | 
| 26 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" | 26 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" | 
| 27 #include "content/public/browser/resource_request_info.h" | 27 #include "content/public/browser/resource_request_info.h" | 
|  | 28 #include "content/public/browser/resource_throttle.h" | 
| 28 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" | 
| 29 #include "net/base/load_flags.h" | 30 #include "net/base/load_flags.h" | 
| 30 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" | 
| 31 #include "net/http/http_response_headers.h" | 32 #include "net/http/http_response_headers.h" | 
| 32 #include "net/url_request/url_request.h" | 33 #include "net/url_request/url_request.h" | 
| 33 #include "net/url_request/url_request_status.h" | 34 #include "net/url_request/url_request_status.h" | 
| 34 #include "url/url_constants.h" | 35 #include "url/url_constants.h" | 
| 35 | 36 | 
| 36 using android_webview::AwContentsIoThreadClient; | 37 using android_webview::AwContentsIoThreadClient; | 
| 37 using android_webview::AwContentsClientBridge; | 38 using android_webview::AwContentsClientBridge; | 
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 290 | 291 | 
| 291   const content::ResourceRequestInfo* request_info = | 292   const content::ResourceRequestInfo* request_info = | 
| 292       content::ResourceRequestInfo::ForRequest(request); | 293       content::ResourceRequestInfo::ForRequest(request); | 
| 293 | 294 | 
| 294   std::unique_ptr<IoThreadClientThrottle> ioThreadThrottle = | 295   std::unique_ptr<IoThreadClientThrottle> ioThreadThrottle = | 
| 295       base::MakeUnique<IoThreadClientThrottle>(request_info->GetChildID(), | 296       base::MakeUnique<IoThreadClientThrottle>(request_info->GetChildID(), | 
| 296                                                request_info->GetRenderFrameID(), | 297                                                request_info->GetRenderFrameID(), | 
| 297                                                request); | 298                                                request); | 
| 298 | 299 | 
| 299   if (ioThreadThrottle->GetSafeBrowsingEnabled()) { | 300   if (ioThreadThrottle->GetSafeBrowsingEnabled()) { | 
| 300     content::ResourceThrottle* throttle = | 301     std::unique_ptr<content::ResourceThrottle> throttle = | 
| 301         AwSafeBrowsingResourceThrottle::MaybeCreate( | 302         MaybeCreateAwSafeBrowsingResourceThrottle( | 
| 302             request, resource_type, | 303             request, resource_type, | 
| 303             AwBrowserContext::GetDefault()->GetSafeBrowsingDBManager(), | 304             AwBrowserContext::GetDefault()->GetSafeBrowsingDBManager(), | 
| 304             AwBrowserContext::GetDefault()->GetSafeBrowsingUIManager()); | 305             AwBrowserContext::GetDefault()->GetSafeBrowsingUIManager()); | 
| 305     if (throttle == nullptr) { | 306     DCHECK(throttle); | 
| 306       // Should not happen | 307     throttles->push_back(std::move(throttle)); | 
| 307       DLOG(WARNING) << "Failed creating safebrowsing throttle"; |  | 
| 308     } else { |  | 
| 309       throttles->push_back(base::WrapUnique(throttle)); |  | 
| 310     } |  | 
| 311   } | 308   } | 
| 312 | 309 | 
| 313   // We always push the throttles here. Checking the existence of io_client | 310   // We always push the throttles here. Checking the existence of io_client | 
| 314   // is racy when a popup window is created. That is because RequestBeginning | 311   // is racy when a popup window is created. That is because RequestBeginning | 
| 315   // is called whether or not requests are blocked via BlockRequestForRoute() | 312   // is called whether or not requests are blocked via BlockRequestForRoute() | 
| 316   // however io_client may or may not be ready at the time depending on whether | 313   // however io_client may or may not be ready at the time depending on whether | 
| 317   // webcontents is created. | 314   // webcontents is created. | 
| 318   throttles->push_back(std::move(ioThreadThrottle)); | 315   throttles->push_back(std::move(ioThreadThrottle)); | 
| 319 | 316 | 
| 320   bool is_main_frame = resource_type == content::RESOURCE_TYPE_MAIN_FRAME; | 317   bool is_main_frame = resource_type == content::RESOURCE_TYPE_MAIN_FRAME; | 
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 514       net::HttpRequestHeaders headers; | 511       net::HttpRequestHeaders headers; | 
| 515       headers.AddHeadersFromString(extra_headers); | 512       headers.AddHeadersFromString(extra_headers); | 
| 516       for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { | 513       for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { | 
| 517         request->SetExtraRequestHeaderByName(it.name(), it.value(), false); | 514         request->SetExtraRequestHeaderByName(it.name(), it.value(), false); | 
| 518       } | 515       } | 
| 519     } | 516     } | 
| 520   } | 517   } | 
| 521 } | 518 } | 
| 522 | 519 | 
| 523 }  // namespace android_webview | 520 }  // namespace android_webview | 
| OLD | NEW | 
|---|