| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.support.annotation.IntDef; | 7 import android.support.annotation.IntDef; |
| 8 import android.util.Log; | 8 import android.util.Log; |
| 9 import android.util.Pair; | 9 import android.util.Pair; |
| 10 | 10 |
| 11 import java.lang.annotation.Retention; | 11 import java.lang.annotation.Retention; |
| 12 import java.lang.annotation.RetentionPolicy; | 12 import java.lang.annotation.RetentionPolicy; |
| 13 import java.nio.ByteBuffer; | 13 import java.nio.ByteBuffer; |
| 14 import java.util.ArrayList; | 14 import java.util.ArrayList; |
| 15 import java.util.Collection; | 15 import java.util.Collection; |
| 16 import java.util.Collections; | 16 import java.util.Collections; |
| 17 import java.util.concurrent.Executor; | 17 import java.util.concurrent.Executor; |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Controls an HTTP request (GET, PUT, POST etc). | 20 * Controls an HTTP request (GET, PUT, POST etc). |
| 21 * Created using {@link UrlRequest.Builder}. | 21 * Created using {@link UrlRequest.Builder}. |
| 22 * Note: All methods must be called on the {@link Executor} passed in during cre
ation. | 22 * Note: All methods must be called on the {@link Executor} passed in during cre
ation. |
| 23 */ | 23 */ |
| 24 public interface UrlRequest { | 24 public interface UrlRequest { |
| 25 /** | 25 /** |
| 26 * Builder for {@link UrlRequest}s. Allows configuring requests before const
ructing them | 26 * Builder for {@link UrlRequest}s. Allows configuring requests before const
ructing them |
| 27 * with {@link Builder#build}. | 27 * with {@link Builder#build}. |
| 28 */ | 28 */ |
| 29 public static final class Builder { | 29 public static class Builder { |
| 30 private static final String ACCEPT_ENCODING = "Accept-Encoding"; | 30 private static final String ACCEPT_ENCODING = "Accept-Encoding"; |
| 31 // All fields are temporary storage of UrlRequest configuration to be | 31 // All fields are temporary storage of UrlRequest configuration to be |
| 32 // copied to built UrlRequests. | 32 // copied to built UrlRequests. |
| 33 | 33 |
| 34 // CronetEngine to execute request. | 34 // CronetEngine to execute request. |
| 35 final CronetEngine mCronetEngine; | 35 final CronetEngine mCronetEngine; |
| 36 // URL to request. | 36 // URL to request. |
| 37 final String mUrl; | 37 final String mUrl; |
| 38 // Callback to receive progress callbacks. | 38 // Callback to receive progress callbacks. |
| 39 final Callback mCallback; | 39 final Callback mCallback; |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 * the request's current status. {@code listener} will be invoked | 695 * the request's current status. {@code listener} will be invoked |
| 696 * back on the {@link Executor} passed in when the request was | 696 * back on the {@link Executor} passed in when the request was |
| 697 * created. | 697 * created. |
| 698 */ | 698 */ |
| 699 public void getStatus(final StatusListener listener); | 699 public void getStatus(final StatusListener listener); |
| 700 | 700 |
| 701 // Note: There are deliberately no accessors for the results of the request | 701 // Note: There are deliberately no accessors for the results of the request |
| 702 // here. Having none removes any ambiguity over when they are populated, | 702 // here. Having none removes any ambiguity over when they are populated, |
| 703 // particularly in the redirect case. | 703 // particularly in the redirect case. |
| 704 } | 704 } |
| OLD | NEW |