| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 4 |
| 5 package org.chromium.net; | 5 package org.chromium.net; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.net.http.HttpResponseCache; | 9 import android.net.http.HttpResponseCache; |
| 10 import android.support.annotation.IntDef; | 10 import android.support.annotation.IntDef; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 private boolean mSdchEnabled; | 112 private boolean mSdchEnabled; |
| 113 private String mDataReductionProxyKey; | 113 private String mDataReductionProxyKey; |
| 114 private String mDataReductionProxyPrimaryProxy; | 114 private String mDataReductionProxyPrimaryProxy; |
| 115 private String mDataReductionProxyFallbackProxy; | 115 private String mDataReductionProxyFallbackProxy; |
| 116 private String mDataReductionProxySecureProxyCheckUrl; | 116 private String mDataReductionProxySecureProxyCheckUrl; |
| 117 private boolean mDisableCache; | 117 private boolean mDisableCache; |
| 118 private int mHttpCacheMode; | 118 private int mHttpCacheMode; |
| 119 private long mHttpCacheMaxSize; | 119 private long mHttpCacheMaxSize; |
| 120 private String mExperimentalOptions; | 120 private String mExperimentalOptions; |
| 121 private long mMockCertVerifier; | 121 private long mMockCertVerifier; |
| 122 private String mCertVerifierData; |
| 122 | 123 |
| 123 /** | 124 /** |
| 124 * Default config enables SPDY, disables QUIC, SDCH and HTTP cache. | 125 * Default config enables SPDY, disables QUIC, SDCH and HTTP cache. |
| 125 * @param context Android {@link Context} for engine to use. | 126 * @param context Android {@link Context} for engine to use. |
| 126 */ | 127 */ |
| 127 public Builder(Context context) { | 128 public Builder(Context context) { |
| 128 mContext = context; | 129 mContext = context; |
| 129 setLibraryName("cronet"); | 130 setLibraryName("cronet"); |
| 130 enableLegacyMode(false); | 131 enableLegacyMode(false); |
| 131 enableQUIC(false); | 132 enableQUIC(false); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 public Builder enableSDCH(boolean value) { | 298 public Builder enableSDCH(boolean value) { |
| 298 mSdchEnabled = value; | 299 mSdchEnabled = value; |
| 299 return this; | 300 return this; |
| 300 } | 301 } |
| 301 | 302 |
| 302 boolean sdchEnabled() { | 303 boolean sdchEnabled() { |
| 303 return mSdchEnabled; | 304 return mSdchEnabled; |
| 304 } | 305 } |
| 305 | 306 |
| 306 /** | 307 /** |
| 308 * Initializes certificate verifier's cache with certData which has a li
st |
| 309 * of hosts/certificates and the results of certificate verification. |
| 310 * @param certData a serialized representation of certificate |
| 311 * verification results data. |
| 312 * @return the builder to facilitate chaining. |
| 313 */ |
| 314 public Builder setCertVerifierData(String certVerifierData) { |
| 315 mCertVerifierData = certVerifierData; |
| 316 return this; |
| 317 } |
| 318 |
| 319 String certVerifierData() { |
| 320 return mCertVerifierData; |
| 321 } |
| 322 |
| 323 /** |
| 307 * Enables | 324 * Enables |
| 308 * <a href="https://developer.chrome.com/multidevice/data-compression">D
ata | 325 * <a href="https://developer.chrome.com/multidevice/data-compression">D
ata |
| 309 * Reduction Proxy</a>. Defaults to disabled. | 326 * Reduction Proxy</a>. Defaults to disabled. |
| 310 * @param key key to use when authenticating with the proxy. | 327 * @param key key to use when authenticating with the proxy. |
| 311 * @return the builder to facilitate chaining. | 328 * @return the builder to facilitate chaining. |
| 312 */ | 329 */ |
| 313 public Builder enableDataReductionProxy(String key) { | 330 public Builder enableDataReductionProxy(String key) { |
| 314 mDataReductionProxyKey = key; | 331 mDataReductionProxyKey = key; |
| 315 return this; | 332 return this; |
| 316 } | 333 } |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 */ | 772 */ |
| 756 public abstract void startNetLogToFile(String fileName, boolean logAll); | 773 public abstract void startNetLogToFile(String fileName, boolean logAll); |
| 757 | 774 |
| 758 /** | 775 /** |
| 759 * Stops NetLog logging and flushes file to disk. If a logging session is | 776 * Stops NetLog logging and flushes file to disk. If a logging session is |
| 760 * not in progress, this call is ignored. | 777 * not in progress, this call is ignored. |
| 761 */ | 778 */ |
| 762 public abstract void stopNetLog(); | 779 public abstract void stopNetLog(); |
| 763 | 780 |
| 764 /** | 781 /** |
| 782 * Returns serialized representation of certificate verifier's cache |
| 783 * which contains the list of hosts/certificates and the certificate |
| 784 * verification results. May block until data is received from the network |
| 785 * thread (will timeout after 30ms). |
| 786 * |
| 787 * @return serialized representation of certificate verification results |
| 788 * data. |
| 789 */ |
| 790 public abstract String getCertVerifierData(); |
| 791 |
| 792 /** |
| 765 * Returns differences in metrics collected by Cronet since the last call to | 793 * Returns differences in metrics collected by Cronet since the last call to |
| 766 * {@link #getGlobalMetricsDeltas}. | 794 * {@link #getGlobalMetricsDeltas}. |
| 767 * <p> | 795 * <p> |
| 768 * Cronet collects these metrics globally. This means deltas returned by | 796 * Cronet collects these metrics globally. This means deltas returned by |
| 769 * {@code getGlobalMetricsDeltas()} will include measurements of requests | 797 * {@code getGlobalMetricsDeltas()} will include measurements of requests |
| 770 * processed by other {@link CronetEngine} instances. Since this function | 798 * processed by other {@link CronetEngine} instances. Since this function |
| 771 * returns differences in metrics collected since the last call, and these | 799 * returns differences in metrics collected since the last call, and these |
| 772 * metrics are collected globally, a call to any {@code CronetEngine} | 800 * metrics are collected globally, a call to any {@code CronetEngine} |
| 773 * instance's {@code getGlobalMetricsDeltas()} method will affect the deltas | 801 * instance's {@code getGlobalMetricsDeltas()} method will affect the deltas |
| 774 * returned by any other {@code CronetEngine} instance's | 802 * returned by any other {@code CronetEngine} instance's |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 * @hide as it's a prototype. | 1134 * @hide as it's a prototype. |
| 1107 */ | 1135 */ |
| 1108 public interface RequestFinishedListener { // TODO(klm): Add a convenience a
bstract class. | 1136 public interface RequestFinishedListener { // TODO(klm): Add a convenience a
bstract class. |
| 1109 /** | 1137 /** |
| 1110 * Invoked with request info. | 1138 * Invoked with request info. |
| 1111 * @param requestInfo {@link UrlRequestInfo} for finished request. | 1139 * @param requestInfo {@link UrlRequestInfo} for finished request. |
| 1112 */ | 1140 */ |
| 1113 void onRequestFinished(UrlRequestInfo requestInfo); | 1141 void onRequestFinished(UrlRequestInfo requestInfo); |
| 1114 } | 1142 } |
| 1115 } | 1143 } |
| OLD | NEW |