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

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: make constructors public, adjust copyright date Created 4 years, 1 month 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;
kapishnikov 2016/11/18 16:32:57 Can we keep the old CronetEngine.Builder.LibraryLo
pauljensen 2016/11/18 19:18:07 I think that defeats the purpose of this CL. User
kapishnikov 2016/11/18 19:39:15 You are right. We should not reference the API cla
91 private String mLibraryName; 91 private String mLibraryName;
92 private boolean mQuicEnabled; 92 private boolean mQuicEnabled;
93 private boolean mHttp2Enabled; 93 private boolean mHttp2Enabled;
94 private boolean mSdchEnabled; 94 private boolean mSdchEnabled;
95 private String mDataReductionProxyKey; 95 private String mDataReductionProxyKey;
96 private String mDataReductionProxyPrimaryProxy; 96 private String mDataReductionProxyPrimaryProxy;
97 private String mDataReductionProxyFallbackProxy; 97 private String mDataReductionProxyFallbackProxy;
98 private String mDataReductionProxySecureProxyCheckUrl; 98 private String mDataReductionProxySecureProxyCheckUrl;
99 private boolean mDisableCache; 99 private boolean mDisableCache;
100 private int mHttpCacheMode; 100 private int mHttpCacheMode;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 mLibraryName = libName; 167 mLibraryName = libName;
168 return this; 168 return this;
169 } 169 }
170 170
171 String libraryName() { 171 String libraryName() {
172 return mLibraryName; 172 return mLibraryName;
173 } 173 }
174 174
175 @Override 175 @Override
176 public CronetEngineBuilderImpl setLibraryLoader(CronetEngine.Builder.Library Loader loader) { 176 public CronetEngineBuilderImpl setLibraryLoader(CronetEngine.Builder.Library Loader loader) {
177 mLibraryLoader = loader; 177 mLibraryLoader = new VersionSafeCallbacks.LibraryLoader(loader);
kapishnikov 2016/11/18 16:32:57 I think it would be better if we don't create the
178 return this; 178 return this;
179 } 179 }
180 180
181 CronetEngine.Builder.LibraryLoader libraryLoader() { 181 VersionSafeCallbacks.LibraryLoader libraryLoader() {
kapishnikov 2016/11/18 16:32:57 Same here. Keep CronetEngine.Builder.LibraryLoader
pauljensen 2016/11/18 19:18:07 I think that defeats the purpose of this CL. User
kapishnikov 2016/11/18 19:39:15 Acknowledged.
182 return mLibraryLoader; 182 return mLibraryLoader;
183 } 183 }
184 184
185 @Override 185 @Override
186 public CronetEngineBuilderImpl enableQuic(boolean value) { 186 public CronetEngineBuilderImpl enableQuic(boolean value) {
187 mQuicEnabled = value; 187 mQuicEnabled = value;
188 return this; 188 return this;
189 } 189 }
190 190
191 boolean quicEnabled() { 191 boolean quicEnabled() {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } catch (ClassNotFoundException e) { 507 } catch (ClassNotFoundException e) {
508 // Leave as null. 508 // Leave as null.
509 Log.i(TAG, "Class loader " + loader + " cannot find Cronet engine im plementation: " 509 Log.i(TAG, "Class loader " + loader + " cannot find Cronet engine im plementation: "
510 + name + ". Will try to find an alternative implemen tation."); 510 + name + ". Will try to find an alternative implemen tation.");
511 } catch (Exception e) { 511 } catch (Exception e) {
512 throw new IllegalStateException("Cannot instantiate: " + name, e); 512 throw new IllegalStateException("Cannot instantiate: " + name, e);
513 } 513 }
514 return cronetEngine; 514 return cronetEngine;
515 } 515 }
516 } 516 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698