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

Side by Side Diff: components/cronet/android/api/src/org/chromium/net/CronetEngine.java

Issue 1557233003: Download doclava when building for Android and use to build cronet Javadocs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert back to Patch Set 10 Created 4 years, 8 months 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 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.content.Context; 7 import android.content.Context;
8 import android.net.http.HttpResponseCache;
8 import android.support.annotation.IntDef; 9 import android.support.annotation.IntDef;
9 import android.support.annotation.Nullable; 10 import android.support.annotation.Nullable;
10 import android.util.Log; 11 import android.util.Log;
11 12
12 import java.io.File; 13 import java.io.File;
13 import java.io.IOException; 14 import java.io.IOException;
14 import java.lang.annotation.Retention; 15 import java.lang.annotation.Retention;
15 import java.lang.annotation.RetentionPolicy; 16 import java.lang.annotation.RetentionPolicy;
16 import java.lang.reflect.Constructor; 17 import java.lang.reflect.Constructor;
17 import java.net.IDN; 18 import java.net.IDN;
18 import java.net.Proxy; 19 import java.net.Proxy;
19 import java.net.URL; 20 import java.net.URL;
20 import java.net.URLConnection; 21 import java.net.URLConnection;
21 import java.net.URLStreamHandlerFactory; 22 import java.net.URLStreamHandlerFactory;
22 import java.util.Collection; 23 import java.util.Collection;
23 import java.util.Collections; 24 import java.util.Collections;
24 import java.util.Date; 25 import java.util.Date;
25 import java.util.HashSet; 26 import java.util.HashSet;
26 import java.util.LinkedList; 27 import java.util.LinkedList;
27 import java.util.List; 28 import java.util.List;
28 import java.util.Map; 29 import java.util.Map;
29 import java.util.Set; 30 import java.util.Set;
30 import java.util.concurrent.Executor; 31 import java.util.concurrent.Executor;
31 import java.util.regex.Pattern; 32 import java.util.regex.Pattern;
32 33
34 import javax.net.ssl.HttpsURLConnection;
35
33 /** 36 /**
34 * An engine to process {@link UrlRequest}s, which uses the best HTTP stack 37 * An engine to process {@link UrlRequest}s, which uses the best HTTP stack
35 * available on the current platform. 38 * available on the current platform.
36 */ 39 */
37 public abstract class CronetEngine { 40 public abstract class CronetEngine {
38 /** 41 /**
39 * A builder for {@link CronetEngine}s, which allows runtime configuration o f 42 * A builder for {@link CronetEngine}s, which allows runtime configuration o f
40 * {@code CronetEngine}. Configuration options are set on the builder and 43 * {@code CronetEngine}. Configuration options are set on the builder and
41 * then {@link #build} is called to create the {@code CronetEngine}. 44 * then {@link #build} is called to create the {@code CronetEngine}.
42 */ 45 */
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 * @param value {@code true} makes the resulting {@link CronetEngine} 194 * @param value {@code true} makes the resulting {@link CronetEngine}
192 * use an implementation based on the system's 195 * use an implementation based on the system's
193 * {@link java.net.HttpURLConnection} implementation 196 * {@link java.net.HttpURLConnection} implementation
194 * without trying to load the native implementation. 197 * without trying to load the native implementation.
195 * {@code false} makes the resulting {@code CronetEngine} 198 * {@code false} makes the resulting {@code CronetEngine}
196 * use the native implementation, or if that fails to load, 199 * use the native implementation, or if that fails to load,
197 * falls back to an implementation based on the system's 200 * falls back to an implementation based on the system's
198 * {@link java.net.HttpURLConnection} implementation. 201 * {@link java.net.HttpURLConnection} implementation.
199 * @return the builder to facilitate chaining. 202 * @return the builder to facilitate chaining.
200 * @deprecated Not supported by the new API. 203 * @deprecated Not supported by the new API.
204 * @hide
201 */ 205 */
202 @Deprecated 206 @Deprecated
203 public Builder enableLegacyMode(boolean value) { 207 public Builder enableLegacyMode(boolean value) {
204 mLegacyModeEnabled = value; 208 mLegacyModeEnabled = value;
205 return this; 209 return this;
206 } 210 }
207 211
208 boolean legacyMode() { 212 boolean legacyMode() {
209 return mLegacyModeEnabled; 213 return mLegacyModeEnabled;
210 } 214 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 * Overrides 322 * Overrides
319 * <a href="https://developer.chrome.com/multidevice/data-compression"> 323 * <a href="https://developer.chrome.com/multidevice/data-compression">
320 * Data Reduction Proxy</a> configuration parameters with a primary 324 * Data Reduction Proxy</a> configuration parameters with a primary
321 * proxy name, fallback proxy name, and a secure proxy check URL. Proxie s 325 * proxy name, fallback proxy name, and a secure proxy check URL. Proxie s
322 * are specified as [scheme://]host[:port]. Used for testing. 326 * are specified as [scheme://]host[:port]. Used for testing.
323 * @param primaryProxy the primary data reduction proxy to use. 327 * @param primaryProxy the primary data reduction proxy to use.
324 * @param fallbackProxy a fallback data reduction proxy to use. 328 * @param fallbackProxy a fallback data reduction proxy to use.
325 * @param secureProxyCheckUrl a URL to fetch to determine if using a sec ure 329 * @param secureProxyCheckUrl a URL to fetch to determine if using a sec ure
326 * proxy is allowed. 330 * proxy is allowed.
327 * @return the builder to facilitate chaining. 331 * @return the builder to facilitate chaining.
328 * @deprecated Marked as deprecated because @hide doesn't properly hide but 332 * @hide as it's a prototype.
329 * javadocs are built with nodeprecated="yes".
330 */ 333 */
331 @Deprecated
332 @SuppressWarnings("DepAnn")
333 public Builder setDataReductionProxyOptions( 334 public Builder setDataReductionProxyOptions(
334 String primaryProxy, String fallbackProxy, String secureProxyChe ckUrl) { 335 String primaryProxy, String fallbackProxy, String secureProxyChe ckUrl) {
335 if (primaryProxy.isEmpty() || fallbackProxy.isEmpty() 336 if (primaryProxy.isEmpty() || fallbackProxy.isEmpty()
336 || secureProxyCheckUrl.isEmpty()) { 337 || secureProxyCheckUrl.isEmpty()) {
337 throw new IllegalArgumentException( 338 throw new IllegalArgumentException(
338 "Primary and fallback proxies and check url must be set" ); 339 "Primary and fallback proxies and check url must be set" );
339 } 340 }
340 mDataReductionProxyPrimaryProxy = primaryProxy; 341 mDataReductionProxyPrimaryProxy = primaryProxy;
341 mDataReductionProxyFallbackProxy = fallbackProxy; 342 mDataReductionProxyFallbackProxy = fallbackProxy;
342 mDataReductionProxySecureProxyCheckUrl = secureProxyCheckUrl; 343 mDataReductionProxySecureProxyCheckUrl = secureProxyCheckUrl;
343 return this; 344 return this;
344 } 345 }
345 346
346 String dataReductionProxyPrimaryProxy() { 347 String dataReductionProxyPrimaryProxy() {
347 return mDataReductionProxyPrimaryProxy; 348 return mDataReductionProxyPrimaryProxy;
348 } 349 }
349 350
350 String dataReductionProxyFallbackProxy() { 351 String dataReductionProxyFallbackProxy() {
351 return mDataReductionProxyFallbackProxy; 352 return mDataReductionProxyFallbackProxy;
352 } 353 }
353 354
354 String dataReductionProxySecureProxyCheckUrl() { 355 String dataReductionProxySecureProxyCheckUrl() {
355 return mDataReductionProxySecureProxyCheckUrl; 356 return mDataReductionProxySecureProxyCheckUrl;
356 } 357 }
357 358
358 /** @deprecated not really deprecated but hidden. */ 359 /** @hide */
359 @IntDef({ 360 @IntDef({
360 HTTP_CACHE_DISABLED, HTTP_CACHE_IN_MEMORY, HTTP_CACHE_DISK_NO_HT TP, HTTP_CACHE_DISK, 361 HTTP_CACHE_DISABLED, HTTP_CACHE_IN_MEMORY, HTTP_CACHE_DISK_NO_HT TP, HTTP_CACHE_DISK,
361 }) 362 })
362 @Retention(RetentionPolicy.SOURCE) 363 @Retention(RetentionPolicy.SOURCE)
363 @SuppressWarnings("DepAnn")
364 public @interface HttpCacheSetting {} 364 public @interface HttpCacheSetting {}
365 365
366 /** 366 /**
367 * Setting to disable HTTP cache. Some data may still be temporarily sto red in memory. 367 * Setting to disable HTTP cache. Some data may still be temporarily sto red in memory.
368 * Passed to {@link #enableHttpCache}. 368 * Passed to {@link #enableHttpCache}.
369 */ 369 */
370 public static final int HTTP_CACHE_DISABLED = 0; 370 public static final int HTTP_CACHE_DISABLED = 0;
371 371
372 /** 372 /**
373 * Setting to enable in-memory HTTP cache, including HTTP data. 373 * Setting to enable in-memory HTTP cache, including HTTP data.
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 * and causing exceptions during shutdown. Request is given medium priority, 632 * and causing exceptions during shutdown. Request is given medium priority,
633 * see {@link UrlRequest.Builder#REQUEST_PRIORITY_MEDIUM}. To specify other 633 * see {@link UrlRequest.Builder#REQUEST_PRIORITY_MEDIUM}. To specify other
634 * priorities see {@link #createRequest(String, UrlRequest.Callback, 634 * priorities see {@link #createRequest(String, UrlRequest.Callback,
635 * Executor, int priority)}. 635 * Executor, int priority)}.
636 * 636 *
637 * @param url {@link URL} for the request. 637 * @param url {@link URL} for the request.
638 * @param callback callback object that gets invoked on different events. 638 * @param callback callback object that gets invoked on different events.
639 * @param executor {@link Executor} on which all callbacks will be invoked. 639 * @param executor {@link Executor} on which all callbacks will be invoked.
640 * @return new request. 640 * @return new request.
641 * @deprecated Use {@link UrlRequest.Builder#build}. 641 * @deprecated Use {@link UrlRequest.Builder#build}.
642 * @hide
642 */ 643 */
643 @Deprecated 644 @Deprecated
644 public final UrlRequest createRequest( 645 public final UrlRequest createRequest(
645 String url, UrlRequest.Callback callback, Executor executor) { 646 String url, UrlRequest.Callback callback, Executor executor) {
646 return createRequest(url, callback, executor, UrlRequest.Builder.REQUEST _PRIORITY_MEDIUM); 647 return createRequest(url, callback, executor, UrlRequest.Builder.REQUEST _PRIORITY_MEDIUM);
647 } 648 }
648 649
649 /** 650 /**
650 * Creates a {@link UrlRequest} object. All callbacks will 651 * Creates a {@link UrlRequest} object. All callbacks will
651 * be called on {@code executor}'s thread. {@code executor} must not run 652 * be called on {@code executor}'s thread. {@code executor} must not run
652 * tasks on the current thread to prevent blocking networking operations 653 * tasks on the current thread to prevent blocking networking operations
653 * and causing exceptions during shutdown. 654 * and causing exceptions during shutdown.
654 * 655 *
655 * @param url {@link URL} for the request. 656 * @param url {@link URL} for the request.
656 * @param callback callback object that gets invoked on different events. 657 * @param callback callback object that gets invoked on different events.
657 * @param executor {@link Executor} on which all callbacks will be invoked. 658 * @param executor {@link Executor} on which all callbacks will be invoked.
658 * @param priority priority of the request which should be one of the 659 * @param priority priority of the request which should be one of the
659 * {@link UrlRequest.Builder#REQUEST_PRIORITY_IDLE REQUEST_PRIORITY_ *} 660 * {@link UrlRequest.Builder#REQUEST_PRIORITY_IDLE REQUEST_PRIORITY_ *}
660 * values. 661 * values.
661 * @return new request. 662 * @return new request.
662 * @deprecated Use {@link UrlRequest.Builder#build}. 663 * @deprecated Use {@link UrlRequest.Builder#build}.
664 * @hide
663 */ 665 */
664 @Deprecated 666 @Deprecated
665 public final UrlRequest createRequest(String url, UrlRequest.Callback callba ck, 667 public final UrlRequest createRequest(String url, UrlRequest.Callback callba ck,
666 Executor executor, @UrlRequest.Builder.RequestPriority int priority) { 668 Executor executor, @UrlRequest.Builder.RequestPriority int priority) {
667 return createRequest(url, callback, executor, priority, Collections.empt yList()); 669 return createRequest(url, callback, executor, priority, Collections.empt yList());
668 } 670 }
669 671
670 /** 672 /**
671 * Creates a {@link UrlRequest} object. All callbacks will 673 * Creates a {@link UrlRequest} object. All callbacks will
672 * be called on {@code executor}'s thread. {@code executor} must not run 674 * be called on {@code executor}'s thread. {@code executor} must not run
673 * tasks on the current thread to prevent blocking networking operations 675 * tasks on the current thread to prevent blocking networking operations
674 * and causing exceptions during shutdown. 676 * and causing exceptions during shutdown.
675 * 677 *
676 * @param url {@link URL} for the request. 678 * @param url {@link URL} for the request.
677 * @param callback callback object that gets invoked on different events. 679 * @param callback callback object that gets invoked on different events.
678 * @param executor {@link Executor} on which all callbacks will be invoked. 680 * @param executor {@link Executor} on which all callbacks will be invoked.
679 * @param priority priority of the request which should be one of the 681 * @param priority priority of the request which should be one of the
680 * {@link UrlRequest.Builder#REQUEST_PRIORITY_IDLE REQUEST_PRIORITY_ *} 682 * {@link UrlRequest.Builder#REQUEST_PRIORITY_IDLE REQUEST_PRIORITY_ *}
681 * values. 683 * values.
682 * @param requestAnnotations Objects to pass on to {@link CronetEngine.Reque stFinishedListener}. 684 * @param requestAnnotations Objects to pass on to {@link CronetEngine.Reque stFinishedListener}.
683 * @return new request. 685 * @return new request.
686 * @deprecated Use {@link UrlRequest.Builder#build}.
687 * @hide as it references hidden CronetEngine.RequestFinishedListener
684 */ 688 */
689 @Deprecated
685 protected abstract UrlRequest createRequest(String url, UrlRequest.Callback callback, 690 protected abstract UrlRequest createRequest(String url, UrlRequest.Callback callback,
686 Executor executor, int priority, Collection<Object> requestAnnotatio ns); 691 Executor executor, int priority, Collection<Object> requestAnnotatio ns);
687 692
688 /** 693 /**
689 * Creates a {@link BidirectionalStream} object. {@code callback} methods wi ll 694 * Creates a {@link BidirectionalStream} object. {@code callback} methods wi ll
690 * be invoked on {@code executor}. {@code executor} must not run 695 * be invoked on {@code executor}. {@code executor} must not run
691 * tasks on the current thread to prevent blocking networking operations 696 * tasks on the current thread to prevent blocking networking operations
692 * and causing exceptions during shutdown. 697 * and causing exceptions during shutdown.
693 * 698 *
694 * @param url the URL for the stream 699 * @param url the URL for the stream
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 * Enables the network quality estimator, which collects and reports 779 * Enables the network quality estimator, which collects and reports
775 * measurements of round trip time (RTT) and downstream throughput at 780 * measurements of round trip time (RTT) and downstream throughput at
776 * various layers of the network stack. After enabling the estimator, 781 * various layers of the network stack. After enabling the estimator,
777 * listeners of RTT and throughput can be added with 782 * listeners of RTT and throughput can be added with
778 * {@link #addRttListener} and {@link #addThroughputListener} and 783 * {@link #addRttListener} and {@link #addThroughputListener} and
779 * removed with {@link #removeRttListener} and 784 * removed with {@link #removeRttListener} and
780 * {@link #removeThroughputListener}. The estimator uses memory and CPU 785 * {@link #removeThroughputListener}. The estimator uses memory and CPU
781 * only when enabled. 786 * only when enabled.
782 * @param executor an executor that will be used to notified all 787 * @param executor an executor that will be used to notified all
783 * added RTT and throughput listeners. 788 * added RTT and throughput listeners.
784 * @deprecated not really deprecated but hidden for now as it's a prototype. 789 * @hide as it's a prototype.
785 */ 790 */
786 @Deprecated public abstract void enableNetworkQualityEstimator(Executor exec utor); 791 public abstract void enableNetworkQualityEstimator(Executor executor);
787 792
788 /** 793 /**
789 * Enables the network quality estimator for testing. This must be called 794 * Enables the network quality estimator for testing. This must be called
790 * before round trip time and throughput listeners are added. Set both 795 * before round trip time and throughput listeners are added. Set both
791 * boolean parameters to false for default behavior. 796 * boolean parameters to false for default behavior.
792 * @param useLocalHostRequests include requests to localhost in estimates. 797 * @param useLocalHostRequests include requests to localhost in estimates.
793 * @param useSmallerResponses include small responses in throughput estimate s. 798 * @param useSmallerResponses include small responses in throughput estimate s.
794 * @param executor an {@link java.util.concurrent.Executor} on which all 799 * @param executor an {@link java.util.concurrent.Executor} on which all
795 * listeners will be called. 800 * listeners will be called.
796 * @deprecated not really deprecated but hidden for now as it's a prototype. 801 * @hide as it's a prototype.
797 */ 802 */
798 @Deprecated
799 abstract void enableNetworkQualityEstimatorForTesting( 803 abstract void enableNetworkQualityEstimatorForTesting(
800 boolean useLocalHostRequests, boolean useSmallerResponses, Executor executor); 804 boolean useLocalHostRequests, boolean useSmallerResponses, Executor executor);
801 805
802 /** 806 /**
803 * Registers a listener that gets called whenever the network quality 807 * Registers a listener that gets called whenever the network quality
804 * estimator witnesses a sample round trip time. This must be called 808 * estimator witnesses a sample round trip time. This must be called
805 * after {@link #enableNetworkQualityEstimator}, and with throw an 809 * after {@link #enableNetworkQualityEstimator}, and with throw an
806 * exception otherwise. Round trip times may be recorded at various layers 810 * exception otherwise. Round trip times may be recorded at various layers
807 * of the network stack, including TCP, QUIC, and at the URL request layer. 811 * of the network stack, including TCP, QUIC, and at the URL request layer.
808 * The listener is called on the {@link java.util.concurrent.Executor} that 812 * The listener is called on the {@link java.util.concurrent.Executor} that
809 * is passed to {@link #enableNetworkQualityEstimator}. 813 * is passed to {@link #enableNetworkQualityEstimator}.
810 * @param listener the listener of round trip times. 814 * @param listener the listener of round trip times.
811 * @deprecated not really deprecated but hidden for now as it's a prototype. 815 * @hide as it's a prototype.
812 */ 816 */
813 @Deprecated public abstract void addRttListener(NetworkQualityRttListener li stener); 817 public abstract void addRttListener(NetworkQualityRttListener listener);
814 818
815 /** 819 /**
816 * Removes a listener of round trip times if previously registered with 820 * Removes a listener of round trip times if previously registered with
817 * {@link #addRttListener}. This should be called after a 821 * {@link #addRttListener}. This should be called after a
818 * {@link NetworkQualityRttListener} is added in order to stop receiving 822 * {@link NetworkQualityRttListener} is added in order to stop receiving
819 * observations. 823 * observations.
820 * @param listener the listener of round trip times. 824 * @param listener the listener of round trip times.
821 * @deprecated not really deprecated but hidden for now as it's a prototype. 825 * @hide as it's a prototype.
822 */ 826 */
823 @Deprecated public abstract void removeRttListener(NetworkQualityRttListener listener); 827 public abstract void removeRttListener(NetworkQualityRttListener listener);
824 828
825 /** 829 /**
826 * Registers a listener that gets called whenever the network quality 830 * Registers a listener that gets called whenever the network quality
827 * estimator witnesses a sample throughput measurement. This must be called 831 * estimator witnesses a sample throughput measurement. This must be called
828 * after {@link #enableNetworkQualityEstimator}. Throughput observations 832 * after {@link #enableNetworkQualityEstimator}. Throughput observations
829 * are computed by measuring bytes read over the active network interface 833 * are computed by measuring bytes read over the active network interface
830 * at times when at least one URL response is being received. The listener 834 * at times when at least one URL response is being received. The listener
831 * is called on the {@link java.util.concurrent.Executor} that is passed to 835 * is called on the {@link java.util.concurrent.Executor} that is passed to
832 * {@link #enableNetworkQualityEstimator}. 836 * {@link #enableNetworkQualityEstimator}.
833 * @param listener the listener of throughput. 837 * @param listener the listener of throughput.
834 * @deprecated not really deprecated but hidden for now as it's a prototype. 838 * @hide as it's a prototype.
835 */ 839 */
836 @Deprecated
837 public abstract void addThroughputListener(NetworkQualityThroughputListener listener); 840 public abstract void addThroughputListener(NetworkQualityThroughputListener listener);
838 841
839 /** 842 /**
840 * Removes a listener of throughput. This should be called after a 843 * Removes a listener of throughput. This should be called after a
841 * {@link NetworkQualityThroughputListener} is added with 844 * {@link NetworkQualityThroughputListener} is added with
842 * {@link #addThroughputListener} in order to stop receiving observations. 845 * {@link #addThroughputListener} in order to stop receiving observations.
843 * @param listener the listener of throughput. 846 * @param listener the listener of throughput.
844 * @deprecated not really deprecated but hidden for now as it's a prototype. 847 * @hide as it's a prototype.
845 */ 848 */
846 @Deprecated
847 public abstract void removeThroughputListener(NetworkQualityThroughputListen er listener); 849 public abstract void removeThroughputListener(NetworkQualityThroughputListen er listener);
848 850
849 /** 851 /**
850 * Establishes a new connection to the resource specified by the {@link URL} {@code url}. 852 * Establishes a new connection to the resource specified by the {@link URL} {@code url}.
851 * <p> 853 * <p>
852 * <b>Note:</b> Cronet's {@link java.net.HttpURLConnection} implementation i s subject to certain 854 * <b>Note:</b> Cronet's {@link java.net.HttpURLConnection} implementation i s subject to certain
853 * limitations, see {@link #createURLStreamHandlerFactory} for details. 855 * limitations, see {@link #createURLStreamHandlerFactory} for details.
854 * 856 *
855 * @param url URL of resource to connect to. 857 * @param url URL of resource to connect to.
856 * @return an {@link java.net.HttpURLConnection} instance implemented by thi s CronetEngine. 858 * @return an {@link java.net.HttpURLConnection} instance implemented by thi s CronetEngine.
857 * @throws IOException if an error occurs while opening the connection. 859 * @throws IOException if an error occurs while opening the connection.
858 */ 860 */
859 public abstract URLConnection openConnection(URL url) throws IOException; 861 public abstract URLConnection openConnection(URL url) throws IOException;
860 862
861 /** 863 /**
862 * Establishes a new connection to the resource specified by the {@link URL} {@code url} 864 * Establishes a new connection to the resource specified by the {@link URL} {@code url}
863 * using the given proxy. 865 * using the given proxy.
864 * <p> 866 * <p>
865 * <b>Note:</b> Cronet's {@link java.net.HttpURLConnection} implementation i s subject to certain 867 * <b>Note:</b> Cronet's {@link java.net.HttpURLConnection} implementation i s subject to certain
866 * limitations, see {@link #createURLStreamHandlerFactory} for details. 868 * limitations, see {@link #createURLStreamHandlerFactory} for details.
867 * 869 *
868 * @param url URL of resource to connect to. 870 * @param url URL of resource to connect to.
869 * @param proxy proxy to use when establishing connection. 871 * @param proxy proxy to use when establishing connection.
870 * @return an {@link java.net.HttpURLConnection} instance implemented by thi s CronetEngine. 872 * @return an {@link java.net.HttpURLConnection} instance implemented by thi s CronetEngine.
871 * @throws IOException if an error occurs while opening the connection. 873 * @throws IOException if an error occurs while opening the connection.
872 * @deprecated Marked as deprecated because @hide doesn't properly hide but 874 * @hide TODO(pauljensen): Expose once implemented, http://crbug.com/418111
873 * javadocs are built with nodeprecated="yes".
874 * TODO(pauljensen): Expose once implemented, http://crbug.com/41811 1
875 */ 875 */
876 @Deprecated
877 @SuppressWarnings("DepAnn")
878 public abstract URLConnection openConnection(URL url, Proxy proxy) throws IO Exception; 876 public abstract URLConnection openConnection(URL url, Proxy proxy) throws IO Exception;
879 877
880 /** 878 /**
881 * Creates a {@link URLStreamHandlerFactory} to handle HTTP and HTTPS 879 * Creates a {@link URLStreamHandlerFactory} to handle HTTP and HTTPS
882 * traffic. An instance of this class can be installed via 880 * traffic. An instance of this class can be installed via
883 * {@link URL#setURLStreamHandlerFactory} thus using this CronetEngine by de fault for 881 * {@link URL#setURLStreamHandlerFactory} thus using this CronetEngine by de fault for
884 * all requests created via {@link URL#openConnection}. 882 * all requests created via {@link URL#openConnection}.
885 * <p> 883 * <p>
886 * Cronet does not use certain HTTP features provided via the system: 884 * Cronet does not use certain HTTP features provided via the system:
887 * <ul> 885 * <ul>
888 * <li>the HTTP cache installed via 886 * <li>the HTTP cache installed via
889 * {@link android.net.http.HttpResponseCache#install(java.io.File, long) 887 * {@link HttpResponseCache#install(java.io.File, long) HttpResponseCach e.install()}</li>
890 * HttpResponseCache.install()}</li>
891 * <li>the HTTP authentication method installed via 888 * <li>the HTTP authentication method installed via
892 * {@link java.net.Authenticator#setDefault}</li> 889 * {@link java.net.Authenticator#setDefault}</li>
893 * <li>the HTTP cookie storage installed via {@link java.net.CookieHandler#s etDefault}</li> 890 * <li>the HTTP cookie storage installed via {@link java.net.CookieHandler#s etDefault}</li>
894 * </ul> 891 * </ul>
895 * <p> 892 * <p>
896 * While Cronet supports and encourages requests using the HTTPS protocol, 893 * While Cronet supports and encourages requests using the HTTPS protocol,
897 * Cronet does not provide support for the 894 * Cronet does not provide support for the
898 * {@link javax.net.ssl.HttpsURLConnection} API. This lack of support also 895 * {@link HttpsURLConnection} API. This lack of support also
899 * includes not using certain HTTPS features provided via the system: 896 * includes not using certain HTTPS features provided via the system:
900 * <ul> 897 * <ul>
901 * <li>the HTTPS hostname verifier installed via {@link 898 * <li>the HTTPS hostname verifier installed via {@link
902 * javax.net.ssl.HttpsURLConnection#setDefaultHostnameVerifier(javax.net.s sl.HostnameVerifier) 899 * HttpsURLConnection#setDefaultHostnameVerifier(javax.net.ssl.HostnameVer ifier)
903 * HttpsURLConnection.setDefaultHostnameVerifier()}</li> 900 * HttpsURLConnection.setDefaultHostnameVerifier()}</li>
904 * <li>the HTTPS socket factory installed via {@link 901 * <li>the HTTPS socket factory installed via {@link
905 * javax.net.ssl.HttpsURLConnection#setDefaultSSLSocketFactory(javax.net.s sl.SSLSocketFactory) 902 * HttpsURLConnection#setDefaultSSLSocketFactory(javax.net.ssl.SSLSocketFa ctory)
906 * HttpsURLConnection.setDefaultSSLSocketFactory()}</li> 903 * HttpsURLConnection.setDefaultSSLSocketFactory()}</li>
907 * </ul> 904 * </ul>
908 * 905 *
909 * @return an {@link URLStreamHandlerFactory} instance implemented by this 906 * @return an {@link URLStreamHandlerFactory} instance implemented by this
910 * CronetEngine. 907 * CronetEngine.
911 */ 908 */
912 public abstract URLStreamHandlerFactory createURLStreamHandlerFactory(); 909 public abstract URLStreamHandlerFactory createURLStreamHandlerFactory();
913 910
914 /** 911 /**
915 * Creates a {@link CronetEngine} with the given {@link Builder}. 912 * Creates a {@link CronetEngine} with the given {@link Builder}.
916 * 913 *
917 * @param builder builder to used for creating the CronetEngine instance. 914 * @param builder builder to used for creating the CronetEngine instance.
918 * @return the created CronetEngine instance. 915 * @return the created CronetEngine instance.
919 * @deprecated Use {@link CronetEngine.Builder}. 916 * @deprecated Use {@link CronetEngine.Builder}.
917 * @hide
920 */ 918 */
921 @Deprecated 919 @Deprecated
922 public static CronetEngine createContext(Builder builder) { 920 public static CronetEngine createContext(Builder builder) {
923 CronetEngine cronetEngine = null; 921 CronetEngine cronetEngine = null;
924 if (builder.getUserAgent() == null) { 922 if (builder.getUserAgent() == null) {
925 builder.setUserAgent(builder.getDefaultUserAgent()); 923 builder.setUserAgent(builder.getDefaultUserAgent());
926 } 924 }
927 if (!builder.legacyMode()) { 925 if (!builder.legacyMode()) {
928 cronetEngine = createCronetEngine(builder); 926 cronetEngine = createCronetEngine(builder);
929 } 927 }
(...skipping 29 matching lines...) Expand all
959 * Registers a listener that gets called after the end of each request with the request info. 957 * Registers a listener that gets called after the end of each request with the request info.
960 * 958 *
961 * <p>This must be called after {@link #enableNetworkQualityEstimator} and w ill throw an 959 * <p>This must be called after {@link #enableNetworkQualityEstimator} and w ill throw an
962 * exception otherwise. 960 * exception otherwise.
963 * 961 *
964 * <p>The listener is called on the {@link java.util.concurrent.Executor} th at 962 * <p>The listener is called on the {@link java.util.concurrent.Executor} th at
965 * is passed to {@link #enableNetworkQualityEstimator}. 963 * is passed to {@link #enableNetworkQualityEstimator}.
966 * 964 *
967 * @param listener the listener for finished requests. 965 * @param listener the listener for finished requests.
968 * 966 *
969 * @deprecated not really deprecated but hidden for now as it's a prototype. 967 * @hide as it's a prototype.
970 */ 968 */
971 @Deprecated public abstract void addRequestFinishedListener(RequestFinishedL istener listener); 969 public abstract void addRequestFinishedListener(RequestFinishedListener list ener);
972 970
973 /** 971 /**
974 * Removes a finished request listener. 972 * Removes a finished request listener.
975 * 973 *
976 * @param listener the listener to remove. 974 * @param listener the listener to remove.
977 * 975 *
978 * @deprecated not really deprecated but hidden for now as it's a prototype. 976 * @hide it's a prototype.
979 */ 977 */
980 @Deprecated
981 public abstract void removeRequestFinishedListener(RequestFinishedListener l istener); 978 public abstract void removeRequestFinishedListener(RequestFinishedListener l istener);
982 979
983 /** 980 /**
984 * Information about a finished request. Passed to {@link RequestFinishedLis tener}. 981 * Information about a finished request. Passed to {@link RequestFinishedLis tener}.
985 * 982 *
986 * @deprecated not really deprecated but hidden for now as it's a prototype. 983 * @hide as it's a prototype.
987 */ 984 */
988 @Deprecated
989 public static final class UrlRequestInfo { 985 public static final class UrlRequestInfo {
990 private final String mUrl; 986 private final String mUrl;
991 private final Collection<Object> mAnnotations; 987 private final Collection<Object> mAnnotations;
992 private final UrlRequestMetrics mMetrics; 988 private final UrlRequestMetrics mMetrics;
993 @Nullable private final UrlResponseInfo mResponseInfo; 989 @Nullable private final UrlResponseInfo mResponseInfo;
994 990
995 UrlRequestInfo(String url, Collection<Object> annotations, UrlRequestMet rics metrics, 991 UrlRequestInfo(String url, Collection<Object> annotations, UrlRequestMet rics metrics,
996 @Nullable UrlResponseInfo responseInfo) { 992 @Nullable UrlResponseInfo responseInfo) {
997 mUrl = url; 993 mUrl = url;
998 mAnnotations = annotations; 994 mAnnotations = annotations;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 public UrlResponseInfo getResponseInfo() { 1032 public UrlResponseInfo getResponseInfo() {
1037 return mResponseInfo; 1033 return mResponseInfo;
1038 } 1034 }
1039 } 1035 }
1040 1036
1041 /** 1037 /**
1042 * Metrics collected for a single request. 1038 * Metrics collected for a single request.
1043 * 1039 *
1044 * <p>Must call {@link #enableNetworkQualityEstimator} to enable request met rics collection. 1040 * <p>Must call {@link #enableNetworkQualityEstimator} to enable request met rics collection.
1045 * 1041 *
1046 * @deprecated not really deprecated but hidden for now as it's a prototype. 1042 * @hide as it's a prototype.
1047 */ 1043 */
1048 @Deprecated
1049 public static final class UrlRequestMetrics { 1044 public static final class UrlRequestMetrics {
1050 @Nullable private final Long mTtfbMs; 1045 @Nullable private final Long mTtfbMs;
1051 @Nullable private final Long mTotalTimeMs; 1046 @Nullable private final Long mTotalTimeMs;
1052 @Nullable private final Long mSentBytesCount; 1047 @Nullable private final Long mSentBytesCount;
1053 @Nullable private final Long mReceivedBytesCount; 1048 @Nullable private final Long mReceivedBytesCount;
1054 1049
1055 public UrlRequestMetrics(@Nullable Long ttfbMs, @Nullable Long totalTime Ms, 1050 public UrlRequestMetrics(@Nullable Long ttfbMs, @Nullable Long totalTime Ms,
1056 @Nullable Long sentBytesCount, @Nullable Long receivedBytesCount ) { 1051 @Nullable Long sentBytesCount, @Nullable Long receivedBytesCount ) {
1057 mTtfbMs = ttfbMs; 1052 mTtfbMs = ttfbMs;
1058 mTotalTimeMs = totalTimeMs; 1053 mTotalTimeMs = totalTimeMs;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 */ 1086 */
1092 @Nullable 1087 @Nullable
1093 public Long getReceivedBytesCount() { 1088 public Long getReceivedBytesCount() {
1094 return mReceivedBytesCount; 1089 return mReceivedBytesCount;
1095 } 1090 }
1096 } 1091 }
1097 1092
1098 /** 1093 /**
1099 * Interface to listen for finished requests that were created via this Cron etEngine instance. 1094 * Interface to listen for finished requests that were created via this Cron etEngine instance.
1100 * 1095 *
1101 * @deprecated not really deprecated but hidden for now as it's a prototype. 1096 * @hide as it's a prototype.
1102 */ 1097 */
1103 @Deprecated
1104 public interface RequestFinishedListener { // TODO(klm): Add a convenience a bstract class. 1098 public interface RequestFinishedListener { // TODO(klm): Add a convenience a bstract class.
1105 /** 1099 /**
1106 * Invoked with request info. 1100 * Invoked with request info.
1107 * @param requestInfo {@link UrlRequestInfo} for finished request. 1101 * @param requestInfo {@link UrlRequestInfo} for finished request.
1108 */ 1102 */
1109 void onRequestFinished(UrlRequestInfo requestInfo); 1103 void onRequestFinished(UrlRequestInfo requestInfo);
1110 } 1104 }
1111 } 1105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698