| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 package org.chromium.net.impl; | 4 package org.chromium.net.impl; |
| 5 | 5 |
| 6 import android.content.Context; | 6 import android.content.Context; |
| 7 import android.support.annotation.IntDef; | 7 import android.support.annotation.IntDef; |
| 8 import android.support.annotation.VisibleForTesting; | 8 import android.support.annotation.VisibleForTesting; |
| 9 | 9 |
| 10 import static org.chromium.net.CronetEngine.Builder.HTTP_CACHE_DISABLED; | 10 import static org.chromium.net.CronetEngine.Builder.HTTP_CACHE_DISABLED; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 private final List<QuicHint> mQuicHints = new LinkedList<>(); | 77 private final List<QuicHint> mQuicHints = new LinkedList<>(); |
| 78 private final List<Pkp> mPkps = new LinkedList<>(); | 78 private final List<Pkp> mPkps = new LinkedList<>(); |
| 79 private boolean mPublicKeyPinningBypassForLocalTrustAnchorsEnabled; | 79 private boolean mPublicKeyPinningBypassForLocalTrustAnchorsEnabled; |
| 80 private String mUserAgent; | 80 private String mUserAgent; |
| 81 private String mStoragePath; | 81 private String mStoragePath; |
| 82 private VersionSafeCallbacks.LibraryLoader mLibraryLoader; | 82 private VersionSafeCallbacks.LibraryLoader mLibraryLoader; |
| 83 private boolean mQuicEnabled; | 83 private boolean mQuicEnabled; |
| 84 private boolean mHttp2Enabled; | 84 private boolean mHttp2Enabled; |
| 85 private boolean mSdchEnabled; | 85 private boolean mSdchEnabled; |
| 86 private boolean mBrotiEnabled; | 86 private boolean mBrotiEnabled; |
| 87 private String mDataReductionProxyKey; | |
| 88 private String mDataReductionProxyPrimaryProxy; | |
| 89 private String mDataReductionProxyFallbackProxy; | |
| 90 private String mDataReductionProxySecureProxyCheckUrl; | |
| 91 private boolean mDisableCache; | 87 private boolean mDisableCache; |
| 92 private int mHttpCacheMode; | 88 private int mHttpCacheMode; |
| 93 private long mHttpCacheMaxSize; | 89 private long mHttpCacheMaxSize; |
| 94 private String mExperimentalOptions; | 90 private String mExperimentalOptions; |
| 95 protected long mMockCertVerifier; | 91 protected long mMockCertVerifier; |
| 96 private boolean mNetworkQualityEstimatorEnabled; | 92 private boolean mNetworkQualityEstimatorEnabled; |
| 97 private String mCertVerifierData; | 93 private String mCertVerifierData; |
| 98 | 94 |
| 99 /** | 95 /** |
| 100 * Default config enables SPDY, disables QUIC, SDCH and HTTP cache. | 96 * Default config enables SPDY, disables QUIC, SDCH and HTTP cache. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 @Override | 188 @Override |
| 193 public CronetEngineBuilderImpl enableBrotli(boolean value) { | 189 public CronetEngineBuilderImpl enableBrotli(boolean value) { |
| 194 mBrotiEnabled = value; | 190 mBrotiEnabled = value; |
| 195 return this; | 191 return this; |
| 196 } | 192 } |
| 197 | 193 |
| 198 boolean brotliEnabled() { | 194 boolean brotliEnabled() { |
| 199 return mBrotiEnabled; | 195 return mBrotiEnabled; |
| 200 } | 196 } |
| 201 | 197 |
| 202 @Override | |
| 203 public CronetEngineBuilderImpl enableDataReductionProxy(String key) { | |
| 204 mDataReductionProxyKey = key; | |
| 205 return this; | |
| 206 } | |
| 207 | |
| 208 String dataReductionProxyKey() { | |
| 209 return mDataReductionProxyKey; | |
| 210 } | |
| 211 | |
| 212 @Override | |
| 213 public CronetEngineBuilderImpl setDataReductionProxyOptions( | |
| 214 String primaryProxy, String fallbackProxy, String secureProxyCheckUr
l) { | |
| 215 if (primaryProxy.isEmpty() || fallbackProxy.isEmpty() || secureProxyChec
kUrl.isEmpty()) { | |
| 216 throw new IllegalArgumentException( | |
| 217 "Primary and fallback proxies and check url must be set"); | |
| 218 } | |
| 219 mDataReductionProxyPrimaryProxy = primaryProxy; | |
| 220 mDataReductionProxyFallbackProxy = fallbackProxy; | |
| 221 mDataReductionProxySecureProxyCheckUrl = secureProxyCheckUrl; | |
| 222 return this; | |
| 223 } | |
| 224 | |
| 225 String dataReductionProxyPrimaryProxy() { | |
| 226 return mDataReductionProxyPrimaryProxy; | |
| 227 } | |
| 228 | |
| 229 String dataReductionProxyFallbackProxy() { | |
| 230 return mDataReductionProxyFallbackProxy; | |
| 231 } | |
| 232 | |
| 233 String dataReductionProxySecureProxyCheckUrl() { | |
| 234 return mDataReductionProxySecureProxyCheckUrl; | |
| 235 } | |
| 236 | |
| 237 @IntDef({ | 198 @IntDef({ |
| 238 HTTP_CACHE_DISABLED, HTTP_CACHE_IN_MEMORY, HTTP_CACHE_DISK_NO_HTTP,
HTTP_CACHE_DISK, | 199 HTTP_CACHE_DISABLED, HTTP_CACHE_IN_MEMORY, HTTP_CACHE_DISK_NO_HTTP,
HTTP_CACHE_DISK, |
| 239 }) | 200 }) |
| 240 @Retention(RetentionPolicy.SOURCE) | 201 @Retention(RetentionPolicy.SOURCE) |
| 241 public @interface HttpCacheSetting {} | 202 public @interface HttpCacheSetting {} |
| 242 | 203 |
| 243 @Override | 204 @Override |
| 244 public CronetEngineBuilderImpl enableHttpCache(@HttpCacheSetting int cacheMo
de, long maxSize) { | 205 public CronetEngineBuilderImpl enableHttpCache(@HttpCacheSetting int cacheMo
de, long maxSize) { |
| 245 if (cacheMode == HTTP_CACHE_DISK || cacheMode == HTTP_CACHE_DISK_NO_HTTP
) { | 206 if (cacheMode == HTTP_CACHE_DISK || cacheMode == HTTP_CACHE_DISK_NO_HTTP
) { |
| 246 if (storagePath() == null) { | 207 if (storagePath() == null) { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 389 |
| 429 /** | 390 /** |
| 430 * Returns {@link Context} for builder. | 391 * Returns {@link Context} for builder. |
| 431 * | 392 * |
| 432 * @return {@link Context} for builder. | 393 * @return {@link Context} for builder. |
| 433 */ | 394 */ |
| 434 Context getContext() { | 395 Context getContext() { |
| 435 return mApplicationContext; | 396 return mApplicationContext; |
| 436 } | 397 } |
| 437 } | 398 } |
| OLD | NEW |