| 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; | 4 package org.chromium.net; |
| 5 | 5 |
| 6 import android.content.Context; | 6 import android.content.Context; |
| 7 import android.support.annotation.VisibleForTesting; | 7 import android.support.annotation.VisibleForTesting; |
| 8 | 8 |
| 9 import java.io.IOException; | 9 import java.io.IOException; |
| 10 import java.net.Proxy; | 10 import java.net.Proxy; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 * <a href="https://developer.chrome.com/multidevice/data-compression">D
ata | 163 * <a href="https://developer.chrome.com/multidevice/data-compression">D
ata |
| 164 * Reduction Proxy</a>. Defaults to disabled. | 164 * Reduction Proxy</a>. Defaults to disabled. |
| 165 * @param key key to use when authenticating with the proxy. | 165 * @param key key to use when authenticating with the proxy. |
| 166 * @return the builder to facilitate chaining. | 166 * @return the builder to facilitate chaining. |
| 167 */ | 167 */ |
| 168 public Builder enableDataReductionProxy(String key) { | 168 public Builder enableDataReductionProxy(String key) { |
| 169 mBuilderDelegate.enableDataReductionProxy(key); | 169 mBuilderDelegate.enableDataReductionProxy(key); |
| 170 return this; | 170 return this; |
| 171 } | 171 } |
| 172 | 172 |
| 173 /** |
| 174 * Sets experimental options to be used in Cronet. |
| 175 * |
| 176 * @param options JSON formatted experimental options. |
| 177 * @return the builder to facilitate chaining. |
| 178 */ |
| 179 public Builder setExperimentalOptions(String options) { |
| 180 mBuilderDelegate.setExperimentalOptions(options); |
| 181 return this; |
| 182 } |
| 183 |
| 173 @VisibleForTesting | 184 @VisibleForTesting |
| 174 ICronetEngineBuilder getBuilderDelegate() { | 185 ICronetEngineBuilder getBuilderDelegate() { |
| 175 return mBuilderDelegate; | 186 return mBuilderDelegate; |
| 176 } | 187 } |
| 177 | 188 |
| 178 // To support method chaining, override superclass methods to return an | 189 // To support method chaining, override superclass methods to return an |
| 179 // instance of this class instead of the parent. | 190 // instance of this class instead of the parent. |
| 180 | 191 |
| 181 @Override | 192 @Override |
| 182 public Builder setUserAgent(String userAgent) { | 193 public Builder setUserAgent(String userAgent) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 return this; | 244 return this; |
| 234 } | 245 } |
| 235 | 246 |
| 236 @Override | 247 @Override |
| 237 public Builder enablePublicKeyPinningBypassForLocalTrustAnchors(boolean
value) { | 248 public Builder enablePublicKeyPinningBypassForLocalTrustAnchors(boolean
value) { |
| 238 super.enablePublicKeyPinningBypassForLocalTrustAnchors(value); | 249 super.enablePublicKeyPinningBypassForLocalTrustAnchors(value); |
| 239 return this; | 250 return this; |
| 240 } | 251 } |
| 241 | 252 |
| 242 @Override | 253 @Override |
| 243 public Builder setExperimentalOptions(String options) { | |
| 244 super.setExperimentalOptions(options); | |
| 245 return this; | |
| 246 } | |
| 247 | |
| 248 @Override | |
| 249 public ExperimentalCronetEngine build() { | 254 public ExperimentalCronetEngine build() { |
| 250 return mBuilderDelegate.build(); | 255 return mBuilderDelegate.build(); |
| 251 } | 256 } |
| 252 } | 257 } |
| 253 | 258 |
| 254 /** | 259 /** |
| 255 * Creates a builder for {@link BidirectionalStream} objects. All callbacks
for | 260 * Creates a builder for {@link BidirectionalStream} objects. All callbacks
for |
| 256 * generated {@code BidirectionalStream} objects will be invoked on | 261 * generated {@code BidirectionalStream} objects will be invoked on |
| 257 * {@code executor}. {@code executor} must not run tasks on the | 262 * {@code executor}. {@code executor} must not run tasks on the |
| 258 * current thread, otherwise the networking operations may block and excepti
ons | 263 * current thread, otherwise the networking operations may block and excepti
ons |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 * {@link #CONNECTION_METRIC_UNKNOWN} if the value is | 438 * {@link #CONNECTION_METRIC_UNKNOWN} if the value is |
| 434 * unavailable. This must be called after | 439 * unavailable. This must be called after |
| 435 * {@link Builder#enableNetworkQualityEstimator}, and will | 440 * {@link Builder#enableNetworkQualityEstimator}, and will |
| 436 * throw an exception otherwise. | 441 * throw an exception otherwise. |
| 437 * @return Estimate of the downstream throughput in kilobits per second. | 442 * @return Estimate of the downstream throughput in kilobits per second. |
| 438 */ | 443 */ |
| 439 public int getDownstreamThroughputKbps() { | 444 public int getDownstreamThroughputKbps() { |
| 440 return CONNECTION_METRIC_UNKNOWN; | 445 return CONNECTION_METRIC_UNKNOWN; |
| 441 } | 446 } |
| 442 } | 447 } |
| OLD | NEW |