| 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 <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 } | 679 } |
| 680 | 680 |
| 681 // Iterate through PKP configuration for every host. | 681 // Iterate through PKP configuration for every host. |
| 682 for (const auto& pkp : config->pkp_list) { | 682 for (const auto& pkp : config->pkp_list) { |
| 683 // Add the host pinning. | 683 // Add the host pinning. |
| 684 context_->transport_security_state()->AddHPKP( | 684 context_->transport_security_state()->AddHPKP( |
| 685 pkp->host, pkp->expiration_date, pkp->include_subdomains, | 685 pkp->host, pkp->expiration_date, pkp->include_subdomains, |
| 686 pkp->pin_hashes, GURL::EmptyGURL()); | 686 pkp->pin_hashes, GURL::EmptyGURL()); |
| 687 } | 687 } |
| 688 | 688 |
| 689 context_->transport_security_state() | |
| 690 ->SetEnablePublicKeyPinningBypassForLocalTrustAnchors( | |
| 691 config->bypass_public_key_pinning_for_local_trust_anchors); | |
| 692 | |
| 693 JNIEnv* env = base::android::AttachCurrentThread(); | 689 JNIEnv* env = base::android::AttachCurrentThread(); |
| 694 jcronet_url_request_context_.Reset(env, jcronet_url_request_context.obj()); | 690 jcronet_url_request_context_.Reset(env, jcronet_url_request_context.obj()); |
| 695 Java_CronetUrlRequestContext_initNetworkThread( | 691 Java_CronetUrlRequestContext_initNetworkThread( |
| 696 env, jcronet_url_request_context.obj()); | 692 env, jcronet_url_request_context.obj()); |
| 697 | 693 |
| 698 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 694 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
| 699 if (data_reduction_proxy_) | 695 if (data_reduction_proxy_) |
| 700 data_reduction_proxy_->Init(true, GetURLRequestContext()); | 696 data_reduction_proxy_->Init(true, GetURLRequestContext()); |
| 701 #endif | 697 #endif |
| 702 is_context_initialized_ = true; | 698 is_context_initialized_ = true; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 jboolean jsdch_enabled, | 833 jboolean jsdch_enabled, |
| 838 const JavaParamRef<jstring>& jdata_reduction_proxy_key, | 834 const JavaParamRef<jstring>& jdata_reduction_proxy_key, |
| 839 const JavaParamRef<jstring>& jdata_reduction_proxy_primary_proxy, | 835 const JavaParamRef<jstring>& jdata_reduction_proxy_primary_proxy, |
| 840 const JavaParamRef<jstring>& jdata_reduction_proxy_fallback_proxy, | 836 const JavaParamRef<jstring>& jdata_reduction_proxy_fallback_proxy, |
| 841 const JavaParamRef<jstring>& jdata_reduction_proxy_secure_proxy_check_url, | 837 const JavaParamRef<jstring>& jdata_reduction_proxy_secure_proxy_check_url, |
| 842 jboolean jdisable_cache, | 838 jboolean jdisable_cache, |
| 843 jint jhttp_cache_mode, | 839 jint jhttp_cache_mode, |
| 844 jlong jhttp_cache_max_size, | 840 jlong jhttp_cache_max_size, |
| 845 const JavaParamRef<jstring>& jexperimental_quic_connection_options, | 841 const JavaParamRef<jstring>& jexperimental_quic_connection_options, |
| 846 jlong jmock_cert_verifier, | 842 jlong jmock_cert_verifier, |
| 847 jboolean jenable_network_quality_estimator, | 843 jboolean jenable_network_quality_estimator) { |
| 848 jboolean jbypass_public_key_pinning_for_local_trust_anchors) { | |
| 849 return reinterpret_cast<jlong>(new URLRequestContextConfig( | 844 return reinterpret_cast<jlong>(new URLRequestContextConfig( |
| 850 jquic_enabled, | 845 jquic_enabled, |
| 851 ConvertNullableJavaStringToUTF8(env, jquic_default_user_agent_id), | 846 ConvertNullableJavaStringToUTF8(env, jquic_default_user_agent_id), |
| 852 jhttp2_enabled, jsdch_enabled, | 847 jhttp2_enabled, jsdch_enabled, |
| 853 static_cast<URLRequestContextConfig::HttpCacheType>(jhttp_cache_mode), | 848 static_cast<URLRequestContextConfig::HttpCacheType>(jhttp_cache_mode), |
| 854 jhttp_cache_max_size, jdisable_cache, | 849 jhttp_cache_max_size, jdisable_cache, |
| 855 ConvertNullableJavaStringToUTF8(env, jstorage_path), | 850 ConvertNullableJavaStringToUTF8(env, jstorage_path), |
| 856 ConvertNullableJavaStringToUTF8(env, juser_agent), | 851 ConvertNullableJavaStringToUTF8(env, juser_agent), |
| 857 ConvertNullableJavaStringToUTF8(env, | 852 ConvertNullableJavaStringToUTF8(env, |
| 858 jexperimental_quic_connection_options), | 853 jexperimental_quic_connection_options), |
| 859 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_key), | 854 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_key), |
| 860 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_primary_proxy), | 855 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_primary_proxy), |
| 861 ConvertNullableJavaStringToUTF8(env, | 856 ConvertNullableJavaStringToUTF8(env, |
| 862 jdata_reduction_proxy_fallback_proxy), | 857 jdata_reduction_proxy_fallback_proxy), |
| 863 ConvertNullableJavaStringToUTF8( | 858 ConvertNullableJavaStringToUTF8( |
| 864 env, jdata_reduction_proxy_secure_proxy_check_url), | 859 env, jdata_reduction_proxy_secure_proxy_check_url), |
| 865 base::WrapUnique( | 860 base::WrapUnique( |
| 866 reinterpret_cast<net::CertVerifier*>(jmock_cert_verifier)), | 861 reinterpret_cast<net::CertVerifier*>(jmock_cert_verifier)), |
| 867 jenable_network_quality_estimator, | 862 jenable_network_quality_estimator)); |
| 868 jbypass_public_key_pinning_for_local_trust_anchors)); | |
| 869 } | 863 } |
| 870 | 864 |
| 871 // Add a QUIC hint to a URLRequestContextConfig. | 865 // Add a QUIC hint to a URLRequestContextConfig. |
| 872 static void AddQuicHint(JNIEnv* env, | 866 static void AddQuicHint(JNIEnv* env, |
| 873 const JavaParamRef<jclass>& jcaller, | 867 const JavaParamRef<jclass>& jcaller, |
| 874 jlong jurl_request_context_config, | 868 jlong jurl_request_context_config, |
| 875 const JavaParamRef<jstring>& jhost, | 869 const JavaParamRef<jstring>& jhost, |
| 876 jint jport, | 870 jint jport, |
| 877 jint jalternate_port) { | 871 jint jalternate_port) { |
| 878 URLRequestContextConfig* config = | 872 URLRequestContextConfig* config = |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 JNIEnv* env, | 945 JNIEnv* env, |
| 952 const JavaParamRef<jclass>& jcaller) { | 946 const JavaParamRef<jclass>& jcaller) { |
| 953 base::StatisticsRecorder::Initialize(); | 947 base::StatisticsRecorder::Initialize(); |
| 954 std::vector<uint8_t> data; | 948 std::vector<uint8_t> data; |
| 955 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 949 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
| 956 return ScopedJavaLocalRef<jbyteArray>(); | 950 return ScopedJavaLocalRef<jbyteArray>(); |
| 957 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 951 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
| 958 } | 952 } |
| 959 | 953 |
| 960 } // namespace cronet | 954 } // namespace cronet |
| OLD | NEW |