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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 #endif | 81 #endif |
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 "components/data_reduction_proxy/content/browser/data_reduction_proxy_r esource_throttle.h" | |
92 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" | |
91 #include "components/navigation_interception/intercept_navigation_delegate.h" | 93 #include "components/navigation_interception/intercept_navigation_delegate.h" |
92 #endif | 94 #endif |
93 | 95 |
94 #if defined(OS_CHROMEOS) | 96 #if defined(OS_CHROMEOS) |
95 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h" | 97 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h" |
96 // TODO(oshima): Enable this for other platforms. | 98 // TODO(oshima): Enable this for other platforms. |
97 #include "chrome/browser/renderer_host/offline_resource_throttle.h" | 99 #include "chrome/browser/renderer_host/offline_resource_throttle.h" |
98 #endif | 100 #endif |
99 | 101 |
100 using content::BrowserThread; | 102 using content::BrowserThread; |
101 using content::RenderViewHost; | 103 using content::RenderViewHost; |
102 using content::ResourceDispatcherHostLoginDelegate; | 104 using content::ResourceDispatcherHostLoginDelegate; |
103 using content::ResourceRequestInfo; | 105 using content::ResourceRequestInfo; |
104 using content::ResourceType; | 106 using content::ResourceType; |
105 | 107 |
106 #if defined(ENABLE_EXTENSIONS) | 108 #if defined(ENABLE_EXTENSIONS) |
107 using extensions::Extension; | 109 using extensions::Extension; |
108 using extensions::StreamsPrivateAPI; | 110 using extensions::StreamsPrivateAPI; |
109 #endif | 111 #endif |
110 | 112 |
111 #if defined(OS_ANDROID) | 113 #if defined(OS_ANDROID) |
114 using data_reduction_proxy::DataReductionProxyUIService; | |
112 using navigation_interception::InterceptNavigationDelegate; | 115 using navigation_interception::InterceptNavigationDelegate; |
113 #endif | 116 #endif |
114 | 117 |
115 namespace { | 118 namespace { |
116 | 119 |
117 ExternalProtocolHandler::Delegate* g_external_protocol_handler_delegate = NULL; | 120 ExternalProtocolHandler::Delegate* g_external_protocol_handler_delegate = NULL; |
118 | 121 |
119 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) { | 122 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) { |
120 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id, | 123 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id, |
121 render_view_id); | 124 render_view_id); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
515 content::ResourceThrottle* throttle = | 518 content::ResourceThrottle* throttle = |
516 SafeBrowsingResourceThrottleFactory::Create(request, | 519 SafeBrowsingResourceThrottleFactory::Create(request, |
517 resource_context, | 520 resource_context, |
518 resource_type, | 521 resource_type, |
519 safe_browsing_.get()); | 522 safe_browsing_.get()); |
520 if (throttle) | 523 if (throttle) |
521 throttles->push_back(throttle); | 524 throttles->push_back(throttle); |
522 } | 525 } |
523 #endif | 526 #endif |
524 | 527 |
528 #if defined(OS_ANDROID) | |
mmenke
2015/01/16 20:15:27
All these OS_ANDROID checks seem very regression p
megjablon
2015/01/17 02:21:48
Done.
| |
529 if (io_data->IsDataReductionProxyEnabled() && | |
530 data_reduction_proxy::DataReductionProxyParams:: | |
531 IsInterstitalsCommandLineSwitchOn()) { | |
mmenke
2015/01/16 20:15:27
Also suggest indenting IsInterstitalsCommandLineSw
mmenke
2015/01/16 20:15:27
I think "IsInterstitalsCommandLineSwitchOn" could
megjablon
2015/01/17 02:21:48
Done.
| |
532 data_reduction_proxy::DataReductionProxyParams* params = | |
533 io_data->data_reduction_proxy_params(); | |
534 data_reduction_proxy::DataReductionProxyUIService* service = | |
535 io_data->data_reduction_proxy_ui_service(); | |
536 DCHECK(params); | |
537 DCHECK(service); | |
538 | |
539 throttles->push_back( | |
540 new data_reduction_proxy::DataReductionProxyResourceThrottle( | |
mmenke
2015/01/16 20:15:27
Suggest renaming this the "DataReductionProxyDebug
megjablon
2015/01/17 02:21:48
Done.
| |
541 request, resource_type, service, params)); | |
542 | |
543 } | |
mmenke
2015/01/16 20:15:27
Think it's better if the RDHDelegate knows as litt
megjablon
2015/01/17 02:21:48
Done.
| |
544 #endif | |
545 | |
525 #if defined(ENABLE_SUPERVISED_USERS) | 546 #if defined(ENABLE_SUPERVISED_USERS) |
526 bool is_subresource_request = | 547 bool is_subresource_request = |
527 resource_type != content::RESOURCE_TYPE_MAIN_FRAME; | 548 resource_type != content::RESOURCE_TYPE_MAIN_FRAME; |
528 throttles->push_back(new SupervisedUserResourceThrottle( | 549 throttles->push_back(new SupervisedUserResourceThrottle( |
529 request, !is_subresource_request, | 550 request, !is_subresource_request, |
530 io_data->supervised_user_url_filter())); | 551 io_data->supervised_user_url_filter())); |
531 #endif | 552 #endif |
532 | 553 |
533 #if defined(ENABLE_EXTENSIONS) | 554 #if defined(ENABLE_EXTENSIONS) |
534 content::ResourceThrottle* throttle = | 555 content::ResourceThrottle* throttle = |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
750 url_request->GetTotalReceivedBytes())); | 771 url_request->GetTotalReceivedBytes())); |
751 } | 772 } |
752 } | 773 } |
753 | 774 |
754 // static | 775 // static |
755 void ChromeResourceDispatcherHostDelegate:: | 776 void ChromeResourceDispatcherHostDelegate:: |
756 SetExternalProtocolHandlerDelegateForTesting( | 777 SetExternalProtocolHandlerDelegateForTesting( |
757 ExternalProtocolHandler::Delegate* delegate) { | 778 ExternalProtocolHandler::Delegate* delegate) { |
758 g_external_protocol_handler_delegate = delegate; | 779 g_external_protocol_handler_delegate = delegate; |
759 } | 780 } |
OLD | NEW |