| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(new data_reduction_proxy::DataReductionProxyIOData( | 91 io_data_.reset(new data_reduction_proxy::DataReductionProxyIOData( |
| 92 data_reduction_proxy::Client::CRONET_ANDROID, | 92 data_reduction_proxy::Client::CRONET_ANDROID, 0, net_log, task_runner, |
| 93 data_reduction_proxy::DataReductionProxyParams::kAllowed | | 93 task_runner, false, user_agent, std::string())); |
| 94 data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed, | |
| 95 net_log, task_runner, task_runner, false, user_agent, std::string())); | |
| 96 io_data_->request_options()->SetKeyOnIO(key); | 94 io_data_->request_options()->SetKeyOnIO(key); |
| 97 } | 95 } |
| 98 | 96 |
| 99 CronetDataReductionProxy::~CronetDataReductionProxy() { | 97 CronetDataReductionProxy::~CronetDataReductionProxy() { |
| 100 io_data_->ShutdownOnUIThread(); | 98 io_data_->ShutdownOnUIThread(); |
| 101 } | 99 } |
| 102 | 100 |
| 103 std::unique_ptr<net::NetworkDelegate> | 101 std::unique_ptr<net::NetworkDelegate> |
| 104 CronetDataReductionProxy::CreateNetworkDelegate( | 102 CronetDataReductionProxy::CreateNetworkDelegate( |
| 105 std::unique_ptr<net::NetworkDelegate> wrapped_network_delegate) { | 103 std::unique_ptr<net::NetworkDelegate> wrapped_network_delegate) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 131 io_data_->SetDataReductionProxyService( | 129 io_data_->SetDataReductionProxyService( |
| 132 data_reduction_proxy_service->GetWeakPtr()); | 130 data_reduction_proxy_service->GetWeakPtr()); |
| 133 settings_->InitDataReductionProxySettings( | 131 settings_->InitDataReductionProxySettings( |
| 134 kDataReductionProxyEnabled, prefs_.get(), io_data_.get(), | 132 kDataReductionProxyEnabled, prefs_.get(), io_data_.get(), |
| 135 std::move(data_reduction_proxy_service)); | 133 std::move(data_reduction_proxy_service)); |
| 136 settings_->SetDataReductionProxyEnabled(enable); | 134 settings_->SetDataReductionProxyEnabled(enable); |
| 137 settings_->MaybeActivateDataReductionProxy(true); | 135 settings_->MaybeActivateDataReductionProxy(true); |
| 138 } | 136 } |
| 139 | 137 |
| 140 } // namespace cronet | 138 } // namespace cronet |
| OLD | NEW |