Chromium Code Reviews| 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 "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" | 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 | 82 |
| 83 #if defined(USE_SYSTEM_PROTOBUF) | 83 #if defined(USE_SYSTEM_PROTOBUF) |
| 84 #include <google/protobuf/repeated_field.h> | 84 #include <google/protobuf/repeated_field.h> |
| 85 #else | 85 #else |
| 86 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" | 86 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 #if defined(OS_ANDROID) | 89 #if defined(OS_ANDROID) |
| 90 #include "chrome/browser/android/intercept_download_resource_throttle.h" | 90 #include "chrome/browser/android/intercept_download_resource_throttle.h" |
| 91 #include "chrome/browser/ui/android/infobars/auto_login_prompter.h" | 91 #include "chrome/browser/ui/android/infobars/auto_login_prompter.h" |
| 92 #include "components/data_reduction_proxy/content/data_reduction_proxy_resource_ throttle.h" | |
| 93 #include "components/data_reduction_proxy/content/data_reduction_proxy_ui_servic e.h" | |
| 94 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" | |
| 95 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc hes.h" | |
| 92 #include "components/navigation_interception/intercept_navigation_delegate.h" | 96 #include "components/navigation_interception/intercept_navigation_delegate.h" |
| 93 #endif | 97 #endif |
| 94 | 98 |
| 95 #if defined(OS_CHROMEOS) | 99 #if defined(OS_CHROMEOS) |
| 96 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h" | 100 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h" |
| 97 // TODO(oshima): Enable this for other platforms. | 101 // TODO(oshima): Enable this for other platforms. |
| 98 #include "chrome/browser/renderer_host/offline_resource_throttle.h" | 102 #include "chrome/browser/renderer_host/offline_resource_throttle.h" |
| 99 #endif | 103 #endif |
| 100 | 104 |
| 101 using content::BrowserThread; | 105 using content::BrowserThread; |
| 102 using content::RenderViewHost; | 106 using content::RenderViewHost; |
| 103 using content::ResourceDispatcherHostLoginDelegate; | 107 using content::ResourceDispatcherHostLoginDelegate; |
| 104 using content::ResourceRequestInfo; | 108 using content::ResourceRequestInfo; |
| 105 using content::ResourceType; | 109 using content::ResourceType; |
| 106 | 110 |
| 107 #if defined(ENABLE_EXTENSIONS) | 111 #if defined(ENABLE_EXTENSIONS) |
| 108 using extensions::Extension; | 112 using extensions::Extension; |
| 109 using extensions::StreamsPrivateAPI; | 113 using extensions::StreamsPrivateAPI; |
| 110 #endif | 114 #endif |
| 111 | 115 |
| 112 #if defined(OS_ANDROID) | 116 #if defined(OS_ANDROID) |
| 117 using data_reduction_proxy::DataReductionProxyParams; | |
| 118 using data_reduction_proxy::DataReductionProxyResourceThrottle; | |
| 113 using navigation_interception::InterceptNavigationDelegate; | 119 using navigation_interception::InterceptNavigationDelegate; |
| 114 #endif | 120 #endif |
| 115 | 121 |
| 116 namespace { | 122 namespace { |
| 117 | 123 |
| 118 ExternalProtocolHandler::Delegate* g_external_protocol_handler_delegate = NULL; | 124 ExternalProtocolHandler::Delegate* g_external_protocol_handler_delegate = NULL; |
| 119 | 125 |
| 120 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) { | 126 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) { |
| 121 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id, | 127 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id, |
| 122 render_view_id); | 128 render_view_id); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 content::ResourceThrottle* throttle = | 511 content::ResourceThrottle* throttle = |
| 506 SafeBrowsingResourceThrottleFactory::Create(request, | 512 SafeBrowsingResourceThrottleFactory::Create(request, |
| 507 resource_context, | 513 resource_context, |
| 508 resource_type, | 514 resource_type, |
| 509 safe_browsing_.get()); | 515 safe_browsing_.get()); |
| 510 if (throttle) | 516 if (throttle) |
| 511 throttles->push_back(throttle); | 517 throttles->push_back(throttle); |
| 512 } | 518 } |
| 513 #endif | 519 #endif |
| 514 | 520 |
| 521 #if defined(OS_ANDROID) | |
|
bengr
2014/10/31 17:06:47
Again, gating this on object being instantiated in
megjablon
2014/12/11 23:32:04
Acknowledged.
| |
| 522 if (io_data->IsDataReductionProxyEnabled() && | |
| 523 DataReductionProxyParams::IsIncludedInBypassWarningTrial()) { | |
| 524 DataReductionProxyParams* params = | |
| 525 io_data->data_reduction_proxy_params(); | |
| 526 data_reduction_proxy::DataReductionProxyUIService* service = | |
| 527 io_data->data_reduction_proxy_ui_service(); | |
| 528 | |
| 529 if (params && service) { | |
| 530 throttles->push_back(new DataReductionProxyResourceThrottle( | |
| 531 request, | |
|
bengr
2014/10/31 17:06:47
These params can probably all fit on one line.
megjablon
2014/12/11 23:32:04
Done.
| |
| 532 resource_type, | |
| 533 service, | |
| 534 params)); | |
| 535 } | |
| 536 | |
| 537 } | |
| 538 #endif | |
| 539 | |
| 515 #if defined(ENABLE_MANAGED_USERS) | 540 #if defined(ENABLE_MANAGED_USERS) |
| 516 bool is_subresource_request = | 541 bool is_subresource_request = |
| 517 resource_type != content::RESOURCE_TYPE_MAIN_FRAME; | 542 resource_type != content::RESOURCE_TYPE_MAIN_FRAME; |
| 518 throttles->push_back(new SupervisedUserResourceThrottle( | 543 throttles->push_back(new SupervisedUserResourceThrottle( |
| 519 request, !is_subresource_request, | 544 request, !is_subresource_request, |
| 520 io_data->supervised_user_url_filter())); | 545 io_data->supervised_user_url_filter())); |
| 521 #endif | 546 #endif |
| 522 | 547 |
| 523 #if defined(ENABLE_EXTENSIONS) | 548 #if defined(ENABLE_EXTENSIONS) |
| 524 content::ResourceThrottle* throttle = | 549 content::ResourceThrottle* throttle = |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 754 url_request->GetTotalReceivedBytes())); | 779 url_request->GetTotalReceivedBytes())); |
| 755 } | 780 } |
| 756 } | 781 } |
| 757 | 782 |
| 758 // static | 783 // static |
| 759 void ChromeResourceDispatcherHostDelegate:: | 784 void ChromeResourceDispatcherHostDelegate:: |
| 760 SetExternalProtocolHandlerDelegateForTesting( | 785 SetExternalProtocolHandlerDelegateForTesting( |
| 761 ExternalProtocolHandler::Delegate* delegate) { | 786 ExternalProtocolHandler::Delegate* delegate) { |
| 762 g_external_protocol_handler_delegate = delegate; | 787 g_external_protocol_handler_delegate = delegate; |
| 763 } | 788 } |
| OLD | NEW |