| 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" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 net::NetLog* net_log) | 81 net::NetLog* net_log) |
| 82 : task_runner_(task_runner) { | 82 : task_runner_(task_runner) { |
| 83 DCHECK(task_runner_->BelongsToCurrentThread()); | 83 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 84 AddOptionsToCommandLine(primary_proxy, fallback_proxy, secure_proxy_check_url, | 84 AddOptionsToCommandLine(primary_proxy, fallback_proxy, secure_proxy_check_url, |
| 85 base::CommandLine::ForCurrentProcess()); | 85 base::CommandLine::ForCurrentProcess()); |
| 86 prefs_ = CreatePrefService(); | 86 prefs_ = CreatePrefService(); |
| 87 // In Cronet, the Data Reduction Proxy's UI classes are Created on Cronet's | 87 // In Cronet, the Data Reduction Proxy's UI classes are Created on Cronet's |
| 88 // network thread. | 88 // network thread. |
| 89 settings_.reset( | 89 settings_.reset( |
| 90 new data_reduction_proxy::DataReductionProxySettings()); | 90 new data_reduction_proxy::DataReductionProxySettings()); |
| 91 io_data_.reset( | 91 io_data_.reset(new data_reduction_proxy::DataReductionProxyIOData( |
| 92 new data_reduction_proxy::DataReductionProxyIOData( | 92 data_reduction_proxy::Client::CRONET_ANDROID, |
| 93 data_reduction_proxy::Client::CRONET_ANDROID, | 93 data_reduction_proxy::DataReductionProxyParams::kAllowed | |
| 94 data_reduction_proxy::DataReductionProxyParams::kAllowed | | 94 data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed, |
| 95 data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed, | 95 net_log, task_runner, task_runner, false, user_agent)); |
| 96 net_log, task_runner, task_runner, false, false, user_agent)); | |
| 97 io_data_->request_options()->SetKeyOnIO(key); | 96 io_data_->request_options()->SetKeyOnIO(key); |
| 98 } | 97 } |
| 99 | 98 |
| 100 CronetDataReductionProxy::~CronetDataReductionProxy() { | 99 CronetDataReductionProxy::~CronetDataReductionProxy() { |
| 101 io_data_->ShutdownOnUIThread(); | 100 io_data_->ShutdownOnUIThread(); |
| 102 } | 101 } |
| 103 | 102 |
| 104 std::unique_ptr<net::NetworkDelegate> | 103 std::unique_ptr<net::NetworkDelegate> |
| 105 CronetDataReductionProxy::CreateNetworkDelegate( | 104 CronetDataReductionProxy::CreateNetworkDelegate( |
| 106 std::unique_ptr<net::NetworkDelegate> wrapped_network_delegate) { | 105 std::unique_ptr<net::NetworkDelegate> wrapped_network_delegate) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 132 io_data_->SetDataReductionProxyService( | 131 io_data_->SetDataReductionProxyService( |
| 133 data_reduction_proxy_service->GetWeakPtr()); | 132 data_reduction_proxy_service->GetWeakPtr()); |
| 134 settings_->InitDataReductionProxySettings( | 133 settings_->InitDataReductionProxySettings( |
| 135 kDataReductionProxyEnabled, prefs_.get(), io_data_.get(), | 134 kDataReductionProxyEnabled, prefs_.get(), io_data_.get(), |
| 136 std::move(data_reduction_proxy_service)); | 135 std::move(data_reduction_proxy_service)); |
| 137 settings_->SetDataReductionProxyEnabled(enable); | 136 settings_->SetDataReductionProxyEnabled(enable); |
| 138 settings_->MaybeActivateDataReductionProxy(true); | 137 settings_->MaybeActivateDataReductionProxy(true); |
| 139 } | 138 } |
| 140 | 139 |
| 141 } // namespace cronet | 140 } // namespace cronet |
| OLD | NEW |