| 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; |
| 11 import static org.chromium.net.CronetEngine.Builder.HTTP_CACHE_DISK; | 11 import static org.chromium.net.CronetEngine.Builder.HTTP_CACHE_DISK; |
| 12 import static org.chromium.net.CronetEngine.Builder.HTTP_CACHE_DISK_NO_HTTP; | 12 import static org.chromium.net.CronetEngine.Builder.HTTP_CACHE_DISK_NO_HTTP; |
| 13 import static org.chromium.net.CronetEngine.Builder.HTTP_CACHE_IN_MEMORY; | 13 import static org.chromium.net.CronetEngine.Builder.HTTP_CACHE_IN_MEMORY; |
| 14 | 14 |
| 15 import org.chromium.net.CronetEngine; | 15 import org.chromium.net.CronetEngine; |
| 16 import org.chromium.net.ICronetEngineBuilder; | 16 import org.chromium.net.ICronetEngineBuilder; |
| 17 | 17 |
| 18 import java.io.File; | 18 import java.io.File; |
| 19 import java.lang.annotation.Retention; | 19 import java.lang.annotation.Retention; |
| 20 import java.lang.annotation.RetentionPolicy; | 20 import java.lang.annotation.RetentionPolicy; |
| 21 import java.net.IDN; | 21 import java.net.IDN; |
| 22 import java.util.Date; | 22 import java.util.Date; |
| 23 import java.util.HashSet; | 23 import java.util.HashSet; |
| 24 import java.util.LinkedList; | 24 import java.util.LinkedList; |
| 25 import java.util.List; | 25 import java.util.List; |
| 26 import java.util.Set; | 26 import java.util.Set; |
| 27 import java.util.concurrent.Executor; |
| 27 import java.util.regex.Pattern; | 28 import java.util.regex.Pattern; |
| 28 | 29 |
| 29 /** | 30 /** |
| 30 * Implementation of {@link ICronetEngineBuilder}. | 31 * Implementation of {@link ICronetEngineBuilder}. |
| 31 */ | 32 */ |
| 32 public abstract class CronetEngineBuilderImpl extends ICronetEngineBuilder { | 33 public abstract class CronetEngineBuilderImpl extends ICronetEngineBuilder { |
| 33 /** | 34 /** |
| 34 * A hint that a host supports QUIC. | 35 * A hint that a host supports QUIC. |
| 35 */ | 36 */ |
| 36 public static class QuicHint { | 37 public static class QuicHint { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 74 |
| 74 // Private fields are simply storage of configuration for the resulting Cron
etEngine. | 75 // Private fields are simply storage of configuration for the resulting Cron
etEngine. |
| 75 // See setters below for verbose descriptions. | 76 // See setters below for verbose descriptions. |
| 76 private final Context mApplicationContext; | 77 private final Context mApplicationContext; |
| 77 private final List<QuicHint> mQuicHints = new LinkedList<>(); | 78 private final List<QuicHint> mQuicHints = new LinkedList<>(); |
| 78 private final List<Pkp> mPkps = new LinkedList<>(); | 79 private final List<Pkp> mPkps = new LinkedList<>(); |
| 79 private boolean mPublicKeyPinningBypassForLocalTrustAnchorsEnabled; | 80 private boolean mPublicKeyPinningBypassForLocalTrustAnchorsEnabled; |
| 80 private String mUserAgent; | 81 private String mUserAgent; |
| 81 private String mStoragePath; | 82 private String mStoragePath; |
| 82 private VersionSafeCallbacks.LibraryLoader mLibraryLoader; | 83 private VersionSafeCallbacks.LibraryLoader mLibraryLoader; |
| 84 private Executor mUiExecutor; |
| 83 private boolean mQuicEnabled; | 85 private boolean mQuicEnabled; |
| 84 private boolean mHttp2Enabled; | 86 private boolean mHttp2Enabled; |
| 85 private boolean mSdchEnabled; | 87 private boolean mSdchEnabled; |
| 86 private String mDataReductionProxyKey; | 88 private String mDataReductionProxyKey; |
| 87 private String mDataReductionProxyPrimaryProxy; | 89 private String mDataReductionProxyPrimaryProxy; |
| 88 private String mDataReductionProxyFallbackProxy; | 90 private String mDataReductionProxyFallbackProxy; |
| 89 private String mDataReductionProxySecureProxyCheckUrl; | 91 private String mDataReductionProxySecureProxyCheckUrl; |
| 90 private boolean mDisableCache; | 92 private boolean mDisableCache; |
| 91 private int mHttpCacheMode; | 93 private int mHttpCacheMode; |
| 92 private long mHttpCacheMaxSize; | 94 private long mHttpCacheMaxSize; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 public CronetEngineBuilderImpl setLibraryLoader(CronetEngine.Builder.Library
Loader loader) { | 143 public CronetEngineBuilderImpl setLibraryLoader(CronetEngine.Builder.Library
Loader loader) { |
| 142 mLibraryLoader = new VersionSafeCallbacks.LibraryLoader(loader); | 144 mLibraryLoader = new VersionSafeCallbacks.LibraryLoader(loader); |
| 143 return this; | 145 return this; |
| 144 } | 146 } |
| 145 | 147 |
| 146 VersionSafeCallbacks.LibraryLoader libraryLoader() { | 148 VersionSafeCallbacks.LibraryLoader libraryLoader() { |
| 147 return mLibraryLoader; | 149 return mLibraryLoader; |
| 148 } | 150 } |
| 149 | 151 |
| 150 @Override | 152 @Override |
| 153 public CronetEngineBuilderImpl setUiThreadExecutor(Executor uiExecutor) { |
| 154 mUiExecutor = uiExecutor; |
| 155 return this; |
| 156 } |
| 157 |
| 158 Executor uiExecutor() { |
| 159 return mUiExecutor; |
| 160 } |
| 161 |
| 162 @Override |
| 151 public CronetEngineBuilderImpl enableQuic(boolean value) { | 163 public CronetEngineBuilderImpl enableQuic(boolean value) { |
| 152 mQuicEnabled = value; | 164 mQuicEnabled = value; |
| 153 return this; | 165 return this; |
| 154 } | 166 } |
| 155 | 167 |
| 156 boolean quicEnabled() { | 168 boolean quicEnabled() { |
| 157 return mQuicEnabled; | 169 return mQuicEnabled; |
| 158 } | 170 } |
| 159 | 171 |
| 160 /** | 172 /** |
| (...skipping 255 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 |