Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: components/cronet/android/java/src/org/chromium/net/impl/CronetEngineBuilderImpl.java

Issue 2514783002: [Cronet] Add callback wrapper classes to enforce API version checking. (Closed)
Patch Set: fix JNIAdditionalImport Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 import android.util.Log; 9 import android.util.Log;
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 // Private fields are simply storage of configuration for the resulting Cron etEngine. 81 // Private fields are simply storage of configuration for the resulting Cron etEngine.
82 // See setters below for verbose descriptions. 82 // See setters below for verbose descriptions.
83 private final Context mApplicationContext; 83 private final Context mApplicationContext;
84 private final List<QuicHint> mQuicHints = new LinkedList<>(); 84 private final List<QuicHint> mQuicHints = new LinkedList<>();
85 private final List<Pkp> mPkps = new LinkedList<>(); 85 private final List<Pkp> mPkps = new LinkedList<>();
86 private boolean mPublicKeyPinningBypassForLocalTrustAnchorsEnabled; 86 private boolean mPublicKeyPinningBypassForLocalTrustAnchorsEnabled;
87 private String mUserAgent; 87 private String mUserAgent;
88 private String mStoragePath; 88 private String mStoragePath;
89 private boolean mLegacyModeEnabled; 89 private boolean mLegacyModeEnabled;
90 private CronetEngine.Builder.LibraryLoader mLibraryLoader; 90 private VersionSafeCallbacks.LibraryLoader mLibraryLoader;
91 private boolean mQuicEnabled; 91 private boolean mQuicEnabled;
92 private boolean mHttp2Enabled; 92 private boolean mHttp2Enabled;
93 private boolean mSdchEnabled; 93 private boolean mSdchEnabled;
94 private String mDataReductionProxyKey; 94 private String mDataReductionProxyKey;
95 private String mDataReductionProxyPrimaryProxy; 95 private String mDataReductionProxyPrimaryProxy;
96 private String mDataReductionProxyFallbackProxy; 96 private String mDataReductionProxyFallbackProxy;
97 private String mDataReductionProxySecureProxyCheckUrl; 97 private String mDataReductionProxySecureProxyCheckUrl;
98 private boolean mDisableCache; 98 private boolean mDisableCache;
99 private int mHttpCacheMode; 99 private int mHttpCacheMode;
100 private long mHttpCacheMaxSize; 100 private long mHttpCacheMaxSize;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 mLegacyModeEnabled = value; 151 mLegacyModeEnabled = value;
152 return this; 152 return this;
153 } 153 }
154 154
155 private boolean legacyMode() { 155 private boolean legacyMode() {
156 return mLegacyModeEnabled; 156 return mLegacyModeEnabled;
157 } 157 }
158 158
159 @Override 159 @Override
160 public CronetEngineBuilderImpl setLibraryLoader(CronetEngine.Builder.Library Loader loader) { 160 public CronetEngineBuilderImpl setLibraryLoader(CronetEngine.Builder.Library Loader loader) {
161 mLibraryLoader = loader; 161 mLibraryLoader = new VersionSafeCallbacks.LibraryLoader(loader);
162 return this; 162 return this;
163 } 163 }
164 164
165 CronetEngine.Builder.LibraryLoader libraryLoader() { 165 VersionSafeCallbacks.LibraryLoader libraryLoader() {
166 return mLibraryLoader; 166 return mLibraryLoader;
167 } 167 }
168 168
169 @Override 169 @Override
170 public CronetEngineBuilderImpl enableQuic(boolean value) { 170 public CronetEngineBuilderImpl enableQuic(boolean value) {
171 mQuicEnabled = value; 171 mQuicEnabled = value;
172 return this; 172 return this;
173 } 173 }
174 174
175 boolean quicEnabled() { 175 boolean quicEnabled() {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } catch (ClassNotFoundException e) { 491 } catch (ClassNotFoundException e) {
492 // Leave as null. 492 // Leave as null.
493 Log.i(TAG, "Class loader " + loader + " cannot find Cronet engine im plementation: " 493 Log.i(TAG, "Class loader " + loader + " cannot find Cronet engine im plementation: "
494 + name + ". Will try to find an alternative implemen tation."); 494 + name + ". Will try to find an alternative implemen tation.");
495 } catch (Exception e) { 495 } catch (Exception e) {
496 throw new IllegalStateException("Cannot instantiate: " + name, e); 496 throw new IllegalStateException("Cannot instantiate: " + name, e);
497 } 497 }
498 return cronetEngine; 498 return cronetEngine;
499 } 499 }
500 } 500 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698