Chromium Code Reviews| 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 java.util.concurrent.Executor; | |
| 8 | |
| 7 /** | 9 /** | 
| 8 * HTTP request (GET, PUT or POST). | 10 * HTTP request (GET, PUT or POST). | 
| 9 * Note: All methods must be called on the Executor passed in during creation. | 11 * Note: All methods must be called on the Executor passed in during creation. | 
| 10 */ | 12 */ | 
| 11 public interface UrlRequest { | 13 public interface UrlRequest { | 
| 12 public static final int REQUEST_PRIORITY_IDLE = 0; | 14 public static final int REQUEST_PRIORITY_IDLE = 0; | 
| 13 | 15 | 
| 14 public static final int REQUEST_PRIORITY_LOWEST = 1; | 16 public static final int REQUEST_PRIORITY_LOWEST = 1; | 
| 15 | 17 | 
| 16 public static final int REQUEST_PRIORITY_LOW = 2; | 18 public static final int REQUEST_PRIORITY_LOW = 2; | 
| (...skipping 21 matching lines...) Expand all Loading... | |
| 38 | 40 | 
| 39 /** | 41 /** | 
| 40 * Adds a request header. Must be done before request has started. | 42 * Adds a request header. Must be done before request has started. | 
| 41 * | 43 * | 
| 42 * @param header Header name | 44 * @param header Header name | 
| 43 * @param value Header value | 45 * @param value Header value | 
| 44 */ | 46 */ | 
| 45 public void addHeader(String header, String value); | 47 public void addHeader(String header, String value); | 
| 46 | 48 | 
| 47 /** | 49 /** | 
| 50 * Sets upload data. Must be done before request has started. May only be | |
| 51 * invoked once per request. Switches method to "POST" if not explicitly | |
| 52 * set. Starting the request will throw an exception if a Content-Type | |
| 53 * header is not set. | |
| 54 * | |
| 55 * @param uploadDataProvider responsible for providing the upload data. | |
| 56 * @param executor All UploadDataProvider methods will be called using this | |
| 
 
pauljensen
2015/02/12 17:15:40
I think UploadDataProvider should not have the fir
 
xunjieli
2015/02/12 20:56:28
Done.
 
 | |
| 57 * executor. May optionally be the same executor the request itself is | |
| 
 
pauljensen
2015/02/12 17:15:40
I think both copies of "executor" on this line sho
 
xunjieli
2015/02/12 20:56:28
Done.
 
 | |
| 58 * using. | |
| 59 */ | |
| 60 public void setUploadDataProvider(UploadDataProvider uploadDataProvider, Exe cutor executor); | |
| 61 | |
| 62 /** | |
| 48 * Starts the request, all callbacks go to listener. May only be called | 63 * Starts the request, all callbacks go to listener. May only be called | 
| 49 * once. May not be called if cancel has been called on the request. | 64 * once. May not be called if cancel has been called on the request. | 
| 50 */ | 65 */ | 
| 51 public void start(); | 66 public void start(); | 
| 52 | 67 | 
| 53 /** | 68 /** | 
| 54 * Cancels the request. | 69 * Cancels the request. | 
| 55 * | 70 * | 
| 56 * Can be called at any time. If the Executor passed to UrlRequest on | 71 * Can be called at any time. If the Executor passed to UrlRequest on | 
| 57 * construction runs tasks on a single thread, and cancel is called on that | 72 * construction runs tasks on a single thread, and cancel is called on that | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 */ | 111 */ | 
| 97 public void disableCache(); | 112 public void disableCache(); | 
| 98 | 113 | 
| 99 /** | 114 /** | 
| 100 * Note: There are deliberately no accessors for the results of the request | 115 * Note: There are deliberately no accessors for the results of the request | 
| 101 * here. Having none removes any ambiguity over when they are populated, | 116 * here. Having none removes any ambiguity over when they are populated, | 
| 102 * particularly in the redirect case. | 117 * particularly in the redirect case. | 
| 103 */ | 118 */ | 
| 104 } | 119 } | 
| 105 | 120 | 
| OLD | NEW |