| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_url_request_context_adapter.h" | 5 #include "components/cronet/android/cronet_url_request_context_adapter.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // For now, the choice to enable the data reduction proxy happens once, | 411 // For now, the choice to enable the data reduction proxy happens once, |
| 412 // at initialization. It cannot be disabled thereafter. | 412 // at initialization. It cannot be disabled thereafter. |
| 413 if (!config->data_reduction_proxy_key.empty()) { | 413 if (!config->data_reduction_proxy_key.empty()) { |
| 414 data_reduction_proxy_.reset(new CronetDataReductionProxy( | 414 data_reduction_proxy_.reset(new CronetDataReductionProxy( |
| 415 config->data_reduction_proxy_key, config->data_reduction_primary_proxy, | 415 config->data_reduction_proxy_key, config->data_reduction_primary_proxy, |
| 416 config->data_reduction_fallback_proxy, | 416 config->data_reduction_fallback_proxy, |
| 417 config->data_reduction_secure_proxy_check_url, config->user_agent, | 417 config->data_reduction_secure_proxy_check_url, config->user_agent, |
| 418 GetNetworkTaskRunner(), net_log_.get())); | 418 GetNetworkTaskRunner(), net_log_.get())); |
| 419 network_delegate = data_reduction_proxy_->CreateNetworkDelegate( | 419 network_delegate = data_reduction_proxy_->CreateNetworkDelegate( |
| 420 std::move(network_delegate)); | 420 std::move(network_delegate)); |
| 421 context_builder.set_proxy_delegate( |
| 422 data_reduction_proxy_->CreateProxyDelegate()); |
| 421 std::vector<scoped_ptr<net::URLRequestInterceptor>> interceptors; | 423 std::vector<scoped_ptr<net::URLRequestInterceptor>> interceptors; |
| 422 interceptors.push_back(data_reduction_proxy_->CreateInterceptor()); | 424 interceptors.push_back(data_reduction_proxy_->CreateInterceptor()); |
| 423 context_builder.SetInterceptors(std::move(interceptors)); | 425 context_builder.SetInterceptors(std::move(interceptors)); |
| 424 } | 426 } |
| 425 #endif // defined(DATA_REDUCTION_PROXY_SUPPORT) | 427 #endif // defined(DATA_REDUCTION_PROXY_SUPPORT) |
| 426 context_builder.set_network_delegate(std::move(network_delegate)); | 428 context_builder.set_network_delegate(std::move(network_delegate)); |
| 427 context_builder.set_net_log(net_log_.get()); | 429 context_builder.set_net_log(net_log_.get()); |
| 428 | 430 |
| 429 // Android provides a local HTTP proxy server that handles proxying when a PAC | 431 // Android provides a local HTTP proxy server that handles proxying when a PAC |
| 430 // URL is present. Create a proxy service without a resolver and rely on this | 432 // URL is present. Create a proxy service without a resolver and rely on this |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 JNIEnv* env, | 803 JNIEnv* env, |
| 802 const JavaParamRef<jclass>& jcaller) { | 804 const JavaParamRef<jclass>& jcaller) { |
| 803 base::StatisticsRecorder::Initialize(); | 805 base::StatisticsRecorder::Initialize(); |
| 804 std::vector<uint8_t> data; | 806 std::vector<uint8_t> data; |
| 805 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 807 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
| 806 return ScopedJavaLocalRef<jbyteArray>(); | 808 return ScopedJavaLocalRef<jbyteArray>(); |
| 807 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 809 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
| 808 } | 810 } |
| 809 | 811 |
| 810 } // namespace cronet | 812 } // namespace cronet |
| OLD | NEW |