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 #endif | 82 #endif |
83 | 83 |
84 #if defined(USE_SYSTEM_PROTOBUF) | 84 #if defined(USE_SYSTEM_PROTOBUF) |
85 #include <google/protobuf/repeated_field.h> | 85 #include <google/protobuf/repeated_field.h> |
86 #else | 86 #else |
87 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" | 87 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" |
88 #endif | 88 #endif |
89 | 89 |
90 #if defined(OS_ANDROID) | 90 #if defined(OS_ANDROID) |
91 #include "chrome/browser/android/intercept_download_resource_throttle.h" | 91 #include "chrome/browser/android/intercept_download_resource_throttle.h" |
| 92 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_r
esource_throttle.h" |
| 93 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
92 #include "components/navigation_interception/intercept_navigation_delegate.h" | 94 #include "components/navigation_interception/intercept_navigation_delegate.h" |
93 #endif | 95 #endif |
94 | 96 |
95 #if defined(OS_CHROMEOS) | 97 #if defined(OS_CHROMEOS) |
96 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h" | 98 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h" |
97 // TODO(oshima): Enable this for other platforms. | 99 // TODO(oshima): Enable this for other platforms. |
98 #include "chrome/browser/renderer_host/offline_resource_throttle.h" | 100 #include "chrome/browser/renderer_host/offline_resource_throttle.h" |
99 #endif | 101 #endif |
100 | 102 |
101 using content::BrowserThread; | 103 using content::BrowserThread; |
102 using content::RenderViewHost; | 104 using content::RenderViewHost; |
103 using content::ResourceDispatcherHostLoginDelegate; | 105 using content::ResourceDispatcherHostLoginDelegate; |
104 using content::ResourceRequestInfo; | 106 using content::ResourceRequestInfo; |
105 using content::ResourceType; | 107 using content::ResourceType; |
106 | 108 |
107 #if defined(ENABLE_EXTENSIONS) | 109 #if defined(ENABLE_EXTENSIONS) |
108 using extensions::Extension; | 110 using extensions::Extension; |
109 using extensions::StreamsPrivateAPI; | 111 using extensions::StreamsPrivateAPI; |
110 #endif | 112 #endif |
111 | 113 |
112 #if defined(OS_ANDROID) | 114 #if defined(OS_ANDROID) |
| 115 using data_reduction_proxy::DataReductionProxyUIService; |
113 using navigation_interception::InterceptNavigationDelegate; | 116 using navigation_interception::InterceptNavigationDelegate; |
114 #endif | 117 #endif |
115 | 118 |
116 namespace { | 119 namespace { |
117 | 120 |
118 ExternalProtocolHandler::Delegate* g_external_protocol_handler_delegate = NULL; | 121 ExternalProtocolHandler::Delegate* g_external_protocol_handler_delegate = NULL; |
119 | 122 |
120 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) { | 123 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) { |
121 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id, | 124 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id, |
122 render_view_id); | 125 render_view_id); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 content::ResourceThrottle* throttle = | 519 content::ResourceThrottle* throttle = |
517 SafeBrowsingResourceThrottleFactory::Create(request, | 520 SafeBrowsingResourceThrottleFactory::Create(request, |
518 resource_context, | 521 resource_context, |
519 resource_type, | 522 resource_type, |
520 safe_browsing_.get()); | 523 safe_browsing_.get()); |
521 if (throttle) | 524 if (throttle) |
522 throttles->push_back(throttle); | 525 throttles->push_back(throttle); |
523 } | 526 } |
524 #endif | 527 #endif |
525 | 528 |
| 529 #if defined(OS_ANDROID) |
| 530 if (io_data->IsDataReductionProxyEnabled() && |
| 531 data_reduction_proxy::DataReductionProxyParams:: |
| 532 IsBypassWarningEnabledInFlags()) { |
| 533 data_reduction_proxy::DataReductionProxyParams* params = |
| 534 io_data->data_reduction_proxy_params(); |
| 535 data_reduction_proxy::DataReductionProxyUIService* service = |
| 536 io_data->data_reduction_proxy_ui_service(); |
| 537 DCHECK(params); |
| 538 DCHECK(service); |
| 539 |
| 540 throttles->push_back( |
| 541 new data_reduction_proxy::DataReductionProxyResourceThrottle( |
| 542 request, resource_type, service, params)); |
| 543 |
| 544 } |
| 545 #endif |
| 546 |
526 #if defined(ENABLE_SUPERVISED_USERS) | 547 #if defined(ENABLE_SUPERVISED_USERS) |
527 bool is_subresource_request = | 548 bool is_subresource_request = |
528 resource_type != content::RESOURCE_TYPE_MAIN_FRAME; | 549 resource_type != content::RESOURCE_TYPE_MAIN_FRAME; |
529 throttles->push_back(new SupervisedUserResourceThrottle( | 550 throttles->push_back(new SupervisedUserResourceThrottle( |
530 request, !is_subresource_request, | 551 request, !is_subresource_request, |
531 io_data->supervised_user_url_filter())); | 552 io_data->supervised_user_url_filter())); |
532 #endif | 553 #endif |
533 | 554 |
534 #if defined(ENABLE_EXTENSIONS) | 555 #if defined(ENABLE_EXTENSIONS) |
535 content::ResourceThrottle* throttle = | 556 content::ResourceThrottle* throttle = |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 url_request->GetTotalReceivedBytes())); | 777 url_request->GetTotalReceivedBytes())); |
757 } | 778 } |
758 } | 779 } |
759 | 780 |
760 // static | 781 // static |
761 void ChromeResourceDispatcherHostDelegate:: | 782 void ChromeResourceDispatcherHostDelegate:: |
762 SetExternalProtocolHandlerDelegateForTesting( | 783 SetExternalProtocolHandlerDelegateForTesting( |
763 ExternalProtocolHandler::Delegate* delegate) { | 784 ExternalProtocolHandler::Delegate* delegate) { |
764 g_external_protocol_handler_delegate = delegate; | 785 g_external_protocol_handler_delegate = delegate; |
765 } | 786 } |
OLD | NEW |