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

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

Issue 2339223002: Cronet API Refactoring (Closed)
Patch Set: Rebase & Conflict Resolution Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/api/src/org/chromium/net/ExperimentalUrlRequest.java
diff --git a/components/cronet/android/api/src/org/chromium/net/ExperimentalUrlRequest.java b/components/cronet/android/api/src/org/chromium/net/ExperimentalUrlRequest.java
new file mode 100644
index 0000000000000000000000000000000000000000..39c26b70e4a2dd6aff3518115828fee9dc75e373
--- /dev/null
+++ b/components/cronet/android/api/src/org/chromium/net/ExperimentalUrlRequest.java
@@ -0,0 +1,65 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+package org.chromium.net;
+
+import java.util.concurrent.Executor;
+
+/**
+ * {@link UrlRequest} that exposes experimental features. Created using
+ * {@link ExperimentalUrlRequest.Builder}. Every instance of {@link UrlRequest} can
+ * be casted to an instance of this class.
+ *
+ * {@hide since this class exposes experimental features that should be hidden}.
+ */
+public abstract class ExperimentalUrlRequest extends UrlRequest {
+ /**
+ * Builder for building {@link UrlRequest}. Created by
+ * {@link ExperimentalCronetEngine#newUrlRequestBuilder}. A reference to this class
+ * can also be obtained through downcasting of {@link UrlRequest.Builder}.
+ */
+ public abstract static class Builder extends UrlRequest.Builder {
+ /**
+ * Disables connection migration for the request if enabled for
+ * the session.
+ * @return the builder to facilitate chaining.
+ */
+ public abstract Builder disableConnectionMigration();
+
+ /**
+ * Associates the annotation object with this request. May add more than one.
+ * Passed through to a {@link RequestFinishedInfo.Listener},
+ * see {@link RequestFinishedInfo#getAnnotations}.
+ *
+ * @param annotation an object to pass on to the {@link RequestFinishedInfo.Listener} with a
+ * {@link RequestFinishedInfo}.
+ * @return the builder to facilitate chaining.
+ */
+ public abstract Builder addRequestAnnotation(Object annotation);
+
+ // To support method chaining, override superclass methods to return an
+ // instance of this class instead of the parent.
+
+ @Override
+ public abstract Builder setHttpMethod(String method);
+
+ @Override
+ public abstract Builder addHeader(String header, String value);
+
+ @Override
+ public abstract Builder disableCache();
+
+ @Override
+ public abstract Builder setPriority(int priority);
+
+ @Override
+ public abstract Builder setUploadDataProvider(
+ UploadDataProvider uploadDataProvider, Executor executor);
+
+ @Override
+ public abstract Builder allowDirectExecutor();
+
+ @Override
+ public abstract ExperimentalUrlRequest build();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698