| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 private final Context mApplicationContext; | 76 private final Context mApplicationContext; |
| 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 String mDataReductionProxyKey; | 87 private String mDataReductionProxyKey; |
| 87 private String mDataReductionProxyPrimaryProxy; | 88 private String mDataReductionProxyPrimaryProxy; |
| 88 private String mDataReductionProxyFallbackProxy; | 89 private String mDataReductionProxyFallbackProxy; |
| 89 private String mDataReductionProxySecureProxyCheckUrl; | 90 private String mDataReductionProxySecureProxyCheckUrl; |
| 90 private boolean mDisableCache; | 91 private boolean mDisableCache; |
| 91 private int mHttpCacheMode; | 92 private int mHttpCacheMode; |
| 92 private long mHttpCacheMaxSize; | 93 private long mHttpCacheMaxSize; |
| 93 private String mExperimentalOptions; | 94 private String mExperimentalOptions; |
| 94 protected long mMockCertVerifier; | 95 protected long mMockCertVerifier; |
| 95 private boolean mNetworkQualityEstimatorEnabled; | 96 private boolean mNetworkQualityEstimatorEnabled; |
| 96 private String mCertVerifierData; | 97 private String mCertVerifierData; |
| 97 | 98 |
| 98 /** | 99 /** |
| 99 * Default config enables SPDY, disables QUIC, SDCH and HTTP cache. | 100 * Default config enables SPDY, disables QUIC, SDCH and HTTP cache. |
| 100 * @param context Android {@link Context} for engine to use. | 101 * @param context Android {@link Context} for engine to use. |
| 101 */ | 102 */ |
| 102 public CronetEngineBuilderImpl(Context context) { | 103 public CronetEngineBuilderImpl(Context context) { |
| 103 mApplicationContext = context.getApplicationContext(); | 104 mApplicationContext = context.getApplicationContext(); |
| 104 enableQuic(false); | 105 enableQuic(false); |
| 105 enableHttp2(true); | 106 enableHttp2(true); |
| 106 enableSdch(false); | 107 enableSdch(false); |
| 108 enableBrotli(false); |
| 107 enableHttpCache(HTTP_CACHE_DISABLED, 0); | 109 enableHttpCache(HTTP_CACHE_DISABLED, 0); |
| 108 enableNetworkQualityEstimator(false); | 110 enableNetworkQualityEstimator(false); |
| 109 enablePublicKeyPinningBypassForLocalTrustAnchors(true); | 111 enablePublicKeyPinningBypassForLocalTrustAnchors(true); |
| 110 } | 112 } |
| 111 | 113 |
| 112 @Override | 114 @Override |
| 113 public String getDefaultUserAgent() { | 115 public String getDefaultUserAgent() { |
| 114 return UserAgent.from(mApplicationContext); | 116 return UserAgent.from(mApplicationContext); |
| 115 } | 117 } |
| 116 | 118 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 public CronetEngineBuilderImpl enableSdch(boolean value) { | 183 public CronetEngineBuilderImpl enableSdch(boolean value) { |
| 182 mSdchEnabled = value; | 184 mSdchEnabled = value; |
| 183 return this; | 185 return this; |
| 184 } | 186 } |
| 185 | 187 |
| 186 boolean sdchEnabled() { | 188 boolean sdchEnabled() { |
| 187 return mSdchEnabled; | 189 return mSdchEnabled; |
| 188 } | 190 } |
| 189 | 191 |
| 190 @Override | 192 @Override |
| 193 public CronetEngineBuilderImpl enableBrotli(boolean value) { |
| 194 mBrotiEnabled = value; |
| 195 return this; |
| 196 } |
| 197 |
| 198 boolean brotliEnabled() { |
| 199 return mBrotiEnabled; |
| 200 } |
| 201 |
| 202 @Override |
| 191 public CronetEngineBuilderImpl enableDataReductionProxy(String key) { | 203 public CronetEngineBuilderImpl enableDataReductionProxy(String key) { |
| 192 mDataReductionProxyKey = key; | 204 mDataReductionProxyKey = key; |
| 193 return this; | 205 return this; |
| 194 } | 206 } |
| 195 | 207 |
| 196 String dataReductionProxyKey() { | 208 String dataReductionProxyKey() { |
| 197 return mDataReductionProxyKey; | 209 return mDataReductionProxyKey; |
| 198 } | 210 } |
| 199 | 211 |
| 200 @Override | 212 @Override |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 428 |
| 417 /** | 429 /** |
| 418 * Returns {@link Context} for builder. | 430 * Returns {@link Context} for builder. |
| 419 * | 431 * |
| 420 * @return {@link Context} for builder. | 432 * @return {@link Context} for builder. |
| 421 */ | 433 */ |
| 422 Context getContext() { | 434 Context getContext() { |
| 423 return mApplicationContext; | 435 return mApplicationContext; |
| 424 } | 436 } |
| 425 } | 437 } |
| OLD | NEW |