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

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

Powered by Google App Engine
This is Rietveld 408576698