| 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.nio.ByteBuffer; | 7 import java.nio.ByteBuffer; |
| 8 import java.util.concurrent.Executor; | 8 import java.util.concurrent.Executor; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 /** | 207 /** |
| 208 * Invoked if request failed for any reason after {@link UrlRequest#star
t}. | 208 * Invoked if request failed for any reason after {@link UrlRequest#star
t}. |
| 209 * Once invoked, no other {@link Callback} methods will be invoked. | 209 * Once invoked, no other {@link Callback} methods will be invoked. |
| 210 * {@code error} provides information about the failure. | 210 * {@code error} provides information about the failure. |
| 211 * | 211 * |
| 212 * @param request Request that failed. | 212 * @param request Request that failed. |
| 213 * @param info Response information. May be {@code null} if no response
was | 213 * @param info Response information. May be {@code null} if no response
was |
| 214 * received. | 214 * received. |
| 215 * @param error information about error. | 215 * @param error information about error. |
| 216 */ | 216 */ |
| 217 public void onFailed(UrlRequest request, UrlResponseInfo info, CronetExc
eption error) { | 217 public abstract void onFailed( |
| 218 // TODO(mef): Remove fallback to legacy api and make this method abs
tract | 218 UrlRequest request, UrlResponseInfo info, CronetException error)
; |
| 219 // after complete transition to CronetException. | |
| 220 onFailed(request, info, new UrlRequestException(error)); | |
| 221 } | |
| 222 | 219 |
| 223 /** | 220 /** |
| 224 * Invoked if request was canceled via {@link UrlRequest#cancel}. Once | 221 * Invoked if request was canceled via {@link UrlRequest#cancel}. Once |
| 225 * invoked, no other {@link Callback} methods will be invoked. | 222 * invoked, no other {@link Callback} methods will be invoked. |
| 226 * Default implementation takes no action. | 223 * Default implementation takes no action. |
| 227 * | 224 * |
| 228 * @param request Request that was canceled. | 225 * @param request Request that was canceled. |
| 229 * @param info Response information. May be {@code null} if no response
was | 226 * @param info Response information. May be {@code null} if no response
was |
| 230 * received. | 227 * received. |
| 231 */ | 228 */ |
| 232 public void onCanceled(UrlRequest request, UrlResponseInfo info) {} | 229 public void onCanceled(UrlRequest request, UrlResponseInfo info) {} |
| 233 | |
| 234 /** | |
| 235 * @deprecated Use {@code onFailed} instead. | |
| 236 * {@hide This method will be removed after complete transition to Crone
tException}. | |
| 237 */ | |
| 238 @Deprecated | |
| 239 // TODO(mef): Remove this after complete transition to CronetException. | |
| 240 public void onFailed(UrlRequest request, UrlResponseInfo info, UrlReques
tException error) { | |
| 241 assert false; | |
| 242 } | |
| 243 } | 230 } |
| 244 | 231 |
| 245 /** | 232 /** |
| 246 * Request status values returned by {@link #getStatus}. | 233 * Request status values returned by {@link #getStatus}. |
| 247 */ | 234 */ |
| 248 public static class Status { | 235 public static class Status { |
| 249 | 236 |
| 250 /** | 237 /** |
| 251 * This state indicates that the request is completed, canceled, or is n
ot | 238 * This state indicates that the request is completed, canceled, or is n
ot |
| 252 * started. | 239 * started. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 * the request's current status. {@code listener} will be invoked | 413 * the request's current status. {@code listener} will be invoked |
| 427 * back on the {@link Executor} passed in when the request was | 414 * back on the {@link Executor} passed in when the request was |
| 428 * created. | 415 * created. |
| 429 */ | 416 */ |
| 430 public abstract void getStatus(final StatusListener listener); | 417 public abstract void getStatus(final StatusListener listener); |
| 431 | 418 |
| 432 // Note: There are deliberately no accessors for the results of the request | 419 // Note: There are deliberately no accessors for the results of the request |
| 433 // here. Having none removes any ambiguity over when they are populated, | 420 // here. Having none removes any ambiguity over when they are populated, |
| 434 // particularly in the redirect case. | 421 // particularly in the redirect case. |
| 435 } | 422 } |
| OLD | NEW |