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

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

Issue 2470903002: Add default implementation of experimental methods (Closed)
Patch Set: Addressed Paul's comments Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 package org.chromium.net; 4 package org.chromium.net;
5 5
6 import java.util.concurrent.Executor; 6 import java.util.concurrent.Executor;
7 7
8 /** 8 /**
9 * {@link UrlRequest} that exposes experimental features. Created using 9 * {@link UrlRequest} that exposes experimental features. Created using
10 * {@link ExperimentalUrlRequest.Builder}. Every instance of {@link UrlRequest} can 10 * {@link ExperimentalUrlRequest.Builder}. Every instance of {@link UrlRequest} can
11 * be casted to an instance of this class. 11 * be casted to an instance of this class.
12 * 12 *
13 * {@hide since this class exposes experimental features that should be hidden}. 13 * {@hide since this class exposes experimental features that should be hidden}.
14 */ 14 */
15 public abstract class ExperimentalUrlRequest extends UrlRequest { 15 public abstract class ExperimentalUrlRequest extends UrlRequest {
16 /** 16 /**
17 * Builder for building {@link UrlRequest}. Created by 17 * Builder for building {@link UrlRequest}. Created by
18 * {@link ExperimentalCronetEngine#newUrlRequestBuilder}. A reference to thi s class 18 * {@link ExperimentalCronetEngine#newUrlRequestBuilder}. A reference to thi s class
19 * can also be obtained through downcasting of {@link UrlRequest.Builder}. 19 * can also be obtained through downcasting of {@link UrlRequest.Builder}.
20 */ 20 */
21 public abstract static class Builder extends UrlRequest.Builder { 21 public abstract static class Builder extends UrlRequest.Builder {
22 /** 22 /**
23 * Disables connection migration for the request if enabled for 23 * Disables connection migration for the request if enabled for
24 * the session. 24 * the session.
25 * @return the builder to facilitate chaining. 25 * @return the builder to facilitate chaining.
26 */ 26 */
27 public abstract Builder disableConnectionMigration(); 27 public Builder disableConnectionMigration() {
28 return this;
29 }
28 30
29 /** 31 /**
30 * Associates the annotation object with this request. May add more than one. 32 * Associates the annotation object with this request. May add more than one.
31 * Passed through to a {@link RequestFinishedInfo.Listener}, 33 * Passed through to a {@link RequestFinishedInfo.Listener},
32 * see {@link RequestFinishedInfo#getAnnotations}. 34 * see {@link RequestFinishedInfo#getAnnotations}.
33 * 35 *
34 * @param annotation an object to pass on to the {@link RequestFinishedI nfo.Listener} with a 36 * @param annotation an object to pass on to the {@link RequestFinishedI nfo.Listener} with a
35 * {@link RequestFinishedInfo}. 37 * {@link RequestFinishedInfo}.
36 * @return the builder to facilitate chaining. 38 * @return the builder to facilitate chaining.
37 */ 39 */
38 public abstract Builder addRequestAnnotation(Object annotation); 40 public Builder addRequestAnnotation(Object annotation) {
41 return this;
42 }
39 43
40 // To support method chaining, override superclass methods to return an 44 // To support method chaining, override superclass methods to return an
41 // instance of this class instead of the parent. 45 // instance of this class instead of the parent.
42 46
43 @Override 47 @Override
44 public abstract Builder setHttpMethod(String method); 48 public abstract Builder setHttpMethod(String method);
45 49
46 @Override 50 @Override
47 public abstract Builder addHeader(String header, String value); 51 public abstract Builder addHeader(String header, String value);
48 52
49 @Override 53 @Override
50 public abstract Builder disableCache(); 54 public abstract Builder disableCache();
51 55
52 @Override 56 @Override
53 public abstract Builder setPriority(int priority); 57 public abstract Builder setPriority(int priority);
54 58
55 @Override 59 @Override
56 public abstract Builder setUploadDataProvider( 60 public abstract Builder setUploadDataProvider(
57 UploadDataProvider uploadDataProvider, Executor executor); 61 UploadDataProvider uploadDataProvider, Executor executor);
58 62
59 @Override 63 @Override
60 public abstract Builder allowDirectExecutor(); 64 public abstract Builder allowDirectExecutor();
61 65
62 @Override 66 @Override
63 public abstract ExperimentalUrlRequest build(); 67 public abstract ExperimentalUrlRequest build();
64 } 68 }
65 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698