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

Powered by Google App Engine
This is Rietveld 408576698