| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/cronet/android/cronet_data_reduction_proxy.h" | 5 #include "components/cronet/android/cronet_data_reduction_proxy.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "components/cronet/android/cronet_in_memory_pref_store.h" | 12 #include "components/cronet/android/cronet_in_memory_pref_store.h" |
| 13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" | 13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" |
| 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_dele
gate.h" |
| 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" | 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" |
| 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
| 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ
est_options.h" | 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ
est_options.h" |
| 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" | 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" |
| 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
| 20 #include "components/data_reduction_proxy/core/browser/data_store.h" | 21 #include "components/data_reduction_proxy/core/browser/data_store.h" |
| 21 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 22 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 22 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" | 23 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" |
| 23 #include "components/prefs/pref_registry_simple.h" | 24 #include "components/prefs/pref_registry_simple.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 io_data_->ShutdownOnUIThread(); | 100 io_data_->ShutdownOnUIThread(); |
| 100 } | 101 } |
| 101 | 102 |
| 102 scoped_ptr<net::NetworkDelegate> | 103 scoped_ptr<net::NetworkDelegate> |
| 103 CronetDataReductionProxy::CreateNetworkDelegate( | 104 CronetDataReductionProxy::CreateNetworkDelegate( |
| 104 scoped_ptr<net::NetworkDelegate> wrapped_network_delegate) { | 105 scoped_ptr<net::NetworkDelegate> wrapped_network_delegate) { |
| 105 return io_data_->CreateNetworkDelegate(std::move(wrapped_network_delegate), | 106 return io_data_->CreateNetworkDelegate(std::move(wrapped_network_delegate), |
| 106 false /* No bypass UMA */); | 107 false /* No bypass UMA */); |
| 107 } | 108 } |
| 108 | 109 |
| 110 scoped_ptr<net::ProxyDelegate> CronetDataReductionProxy::CreateProxyDelegate() { |
| 111 return io_data_->CreateProxyDelegate(); |
| 112 } |
| 113 |
| 109 scoped_ptr<net::URLRequestInterceptor> | 114 scoped_ptr<net::URLRequestInterceptor> |
| 110 CronetDataReductionProxy::CreateInterceptor() { | 115 CronetDataReductionProxy::CreateInterceptor() { |
| 111 return io_data_->CreateInterceptor(); | 116 return io_data_->CreateInterceptor(); |
| 112 } | 117 } |
| 113 | 118 |
| 114 void CronetDataReductionProxy::Init(bool enable, | 119 void CronetDataReductionProxy::Init(bool enable, |
| 115 net::URLRequestContext* context) { | 120 net::URLRequestContext* context) { |
| 116 url_request_context_getter_ = | 121 url_request_context_getter_ = |
| 117 new net::TrivialURLRequestContextGetter( | 122 new net::TrivialURLRequestContextGetter( |
| 118 context, task_runner_); | 123 context, task_runner_); |
| 119 scoped_ptr<data_reduction_proxy::DataReductionProxyService> | 124 scoped_ptr<data_reduction_proxy::DataReductionProxyService> |
| 120 data_reduction_proxy_service( | 125 data_reduction_proxy_service( |
| 121 new data_reduction_proxy::DataReductionProxyService( | 126 new data_reduction_proxy::DataReductionProxyService( |
| 122 settings_.get(), prefs_.get(), | 127 settings_.get(), prefs_.get(), |
| 123 url_request_context_getter_.get(), | 128 url_request_context_getter_.get(), |
| 124 make_scoped_ptr(new data_reduction_proxy::DataStore()), | 129 make_scoped_ptr(new data_reduction_proxy::DataStore()), |
| 125 task_runner_, task_runner_, task_runner_, base::TimeDelta())); | 130 task_runner_, task_runner_, task_runner_, base::TimeDelta())); |
| 126 io_data_->SetDataReductionProxyService( | 131 io_data_->SetDataReductionProxyService( |
| 127 data_reduction_proxy_service->GetWeakPtr()); | 132 data_reduction_proxy_service->GetWeakPtr()); |
| 128 settings_->InitDataReductionProxySettings( | 133 settings_->InitDataReductionProxySettings( |
| 129 kDataReductionProxyEnabled, prefs_.get(), io_data_.get(), | 134 kDataReductionProxyEnabled, prefs_.get(), io_data_.get(), |
| 130 std::move(data_reduction_proxy_service)); | 135 std::move(data_reduction_proxy_service)); |
| 131 settings_->SetDataReductionProxyEnabled(enable); | 136 settings_->SetDataReductionProxyEnabled(enable); |
| 132 settings_->MaybeActivateDataReductionProxy(true); | 137 settings_->MaybeActivateDataReductionProxy(true); |
| 133 } | 138 } |
| 134 | 139 |
| 135 } // namespace cronet | 140 } // namespace cronet |
| OLD | NEW |