| 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 package org.chromium.net; | 5 package org.chromium.net; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Build; | 8 import android.os.Build; |
| 9 import android.os.ConditionVariable; | 9 import android.os.ConditionVariable; |
| 10 import android.os.Handler; | 10 import android.os.Handler; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 static long createNativeUrlRequestContextConfig( | 111 static long createNativeUrlRequestContextConfig( |
| 112 final Context context, CronetEngine.Builder builder) { | 112 final Context context, CronetEngine.Builder builder) { |
| 113 final long urlRequestContextConfig = nativeCreateRequestContextConfig( | 113 final long urlRequestContextConfig = nativeCreateRequestContextConfig( |
| 114 builder.getUserAgent(), builder.storagePath(), builder.quicEnabl
ed(), | 114 builder.getUserAgent(), builder.storagePath(), builder.quicEnabl
ed(), |
| 115 builder.getDefaultQuicUserAgentId(context), builder.http2Enabled
(), | 115 builder.getDefaultQuicUserAgentId(context), builder.http2Enabled
(), |
| 116 builder.sdchEnabled(), builder.dataReductionProxyKey(), | 116 builder.sdchEnabled(), builder.dataReductionProxyKey(), |
| 117 builder.dataReductionProxyPrimaryProxy(), builder.dataReductionP
roxyFallbackProxy(), | 117 builder.dataReductionProxyPrimaryProxy(), builder.dataReductionP
roxyFallbackProxy(), |
| 118 builder.dataReductionProxySecureProxyCheckUrl(), builder.cacheDi
sabled(), | 118 builder.dataReductionProxySecureProxyCheckUrl(), builder.cacheDi
sabled(), |
| 119 builder.httpCacheMode(), builder.httpCacheMaxSize(), builder.exp
erimentalOptions(), | 119 builder.httpCacheMode(), builder.httpCacheMaxSize(), |
| 120 builder.localTrustAnchorsPinningEnabled(), builder.experimentalO
ptions(), |
| 120 builder.mockCertVerifier()); | 121 builder.mockCertVerifier()); |
| 121 for (Builder.QuicHint quicHint : builder.quicHints()) { | 122 for (Builder.QuicHint quicHint : builder.quicHints()) { |
| 122 nativeAddQuicHint(urlRequestContextConfig, quicHint.mHost, quicHint.
mPort, | 123 nativeAddQuicHint(urlRequestContextConfig, quicHint.mHost, quicHint.
mPort, |
| 123 quicHint.mAlternatePort); | 124 quicHint.mAlternatePort); |
| 124 } | 125 } |
| 125 for (Builder.Pkp pkp : builder.publicKeyPins()) { | 126 for (Builder.Pkp pkp : builder.publicKeyPins()) { |
| 126 nativeAddPkp(urlRequestContextConfig, pkp.mHost, pkp.mHashes, pkp.mI
ncludeSubdomains, | 127 nativeAddPkp(urlRequestContextConfig, pkp.mHost, pkp.mHashes, pkp.mI
ncludeSubdomains, |
| 127 pkp.mExpirationDate.getTime()); | 128 pkp.mExpirationDate.getTime()); |
| 128 } | 129 } |
| 129 return urlRequestContextConfig; | 130 return urlRequestContextConfig; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 failException); | 472 failException); |
| 472 } | 473 } |
| 473 } | 474 } |
| 474 | 475 |
| 475 // Native methods are implemented in cronet_url_request_context_adapter.cc. | 476 // Native methods are implemented in cronet_url_request_context_adapter.cc. |
| 476 private static native long nativeCreateRequestContextConfig(String userAgent
, | 477 private static native long nativeCreateRequestContextConfig(String userAgent
, |
| 477 String storagePath, boolean quicEnabled, String quicUserAgentId, boo
lean http2Enabled, | 478 String storagePath, boolean quicEnabled, String quicUserAgentId, boo
lean http2Enabled, |
| 478 boolean sdchEnabled, String dataReductionProxyKey, | 479 boolean sdchEnabled, String dataReductionProxyKey, |
| 479 String dataReductionProxyPrimaryProxy, String dataReductionProxyFall
backProxy, | 480 String dataReductionProxyPrimaryProxy, String dataReductionProxyFall
backProxy, |
| 480 String dataReductionProxySecureProxyCheckUrl, boolean disableCache,
int httpCacheMode, | 481 String dataReductionProxySecureProxyCheckUrl, boolean disableCache,
int httpCacheMode, |
| 481 long httpCacheMaxSize, String experimentalOptions, long mockCertVeri
fier); | 482 long httpCacheMaxSize, boolean pinLocalTrustAnchors, String experime
ntalOptions, |
| 483 long mockCertVerifier); |
| 482 | 484 |
| 483 private static native void nativeAddQuicHint( | 485 private static native void nativeAddQuicHint( |
| 484 long urlRequestContextConfig, String host, int port, int alternatePo
rt); | 486 long urlRequestContextConfig, String host, int port, int alternatePo
rt); |
| 485 | 487 |
| 486 private static native void nativeAddPkp(long urlRequestContextConfig, String
host, | 488 private static native void nativeAddPkp(long urlRequestContextConfig, String
host, |
| 487 byte[][] hashes, boolean includeSubdomains, long expirationTime); | 489 byte[][] hashes, boolean includeSubdomains, long expirationTime); |
| 488 | 490 |
| 489 private static native long nativeCreateRequestContextAdapter(long urlRequest
ContextConfig); | 491 private static native long nativeCreateRequestContextAdapter(long urlRequest
ContextConfig); |
| 490 | 492 |
| 491 private static native int nativeSetMinLogLevel(int loggingLevel); | 493 private static native int nativeSetMinLogLevel(int loggingLevel); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 508 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 510 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 509 private native void nativeEnableNetworkQualityEstimator( | 511 private native void nativeEnableNetworkQualityEstimator( |
| 510 long nativePtr, boolean useLocalHostRequests, boolean useSmallerResp
onses); | 512 long nativePtr, boolean useLocalHostRequests, boolean useSmallerResp
onses); |
| 511 | 513 |
| 512 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 514 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 513 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); | 515 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); |
| 514 | 516 |
| 515 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 517 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 516 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); | 518 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); |
| 517 } | 519 } |
| OLD | NEW |