Commit 5cc0fb53 authored by mef's avatar mef Committed by Commit bot

Rename Cronet AsyncUrlRequestXYZ interfaces into UrlRequestXYZ.

BUG=409926

Review URL: https://codereview.chromium.org/566833003

Cr-Commit-Position: refs/heads/master@{#294863}
parent b40f80fa
// Copyright 2014 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;
/**
* UrlRequest using Chromium HTTP stack implementation.
*/
public class CronetUrlRequest implements UrlRequest {
@Override
public void setHttpMethod(String method) {
}
@Override
public void addHeader(String header, String value) {
}
@Override
public void start(UrlRequestListener listener) {
}
@Override
public void cancel() {
}
@Override
public boolean isCanceled() {
return false;
}
@Override
public void pause() {
}
@Override
public boolean isPaused() {
return false;
}
@Override
public void resume() {
}
}
// Copyright 2014 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;
/**
* UrlRequest factory using Chromium HTTP stack implementation.
*/
public class CronetUrlRequestFactory implements UrlRequestFactory {
@Override
public UrlRequest createRequest(String url, UrlRequestListener listener,
Executor executor) {
return new CronetUrlRequest();
}
}
......@@ -8,7 +8,7 @@ package org.chromium.net;
* HTTP request (GET, PUT or POST).
* Note: All methods must be called on the Executor passed in during creation.
*/
public abstract interface AsyncUrlRequest {
public interface UrlRequest {
/**
* More setters go here. They may only be called before start (Maybe
* also allow during redirects). Could optionally instead use arguments
......@@ -21,7 +21,7 @@ public abstract interface AsyncUrlRequest {
* <p>The default when this method is not called is "GET" if the request has
* no body or "POST" if it does.
*
* @param method Either "POST" or "PUT".
* @param method "GET", "HEAD", "DELETE", "POST" or "PUT".
*/
public void setHttpMethod(String method);
......@@ -37,7 +37,7 @@ public abstract interface AsyncUrlRequest {
* Starts the request, all callbacks go to listener.
* @param listener
*/
public void start(AsyncUrlRequestListener listener);
public void start(UrlRequestListener listener);
/**
* Can be called at any time.
......
......@@ -9,5 +9,5 @@ import java.io.IOException;
/**
*
*/
public class AsyncUrlRequestException extends IOException {
public class UrlRequestException extends IOException {
}
......@@ -7,20 +7,20 @@ package org.chromium.net;
import java.util.concurrent.Executor;
/**
* A factory for {@link AsyncUrlRequest}'s, which uses the best HTTP stack
* A factory for {@link UrlRequest}'s, which uses the best HTTP stack
* available on the current platform.
*/
public abstract class AsyncUrlRequestFactory {
public interface UrlRequestFactory {
/**
* Creates an AsyncUrlRequest object. All AsyncUrlRequest functions must
* Creates an UrlRequest object. All UrlRequest functions must
* be called on the Executor's thread, and all callbacks will be called
* on the Executor's thread as well.
* createAsyncRequest itself may be called on any thread.
* createRequest itself may be called on any thread.
* @param url URL for the request.
* @param listener Callback interface that gets called on different events.
* @param executor Executor on which all callbacks will be called.
* @return new request.
*/
public abstract AsyncUrlRequest createAsyncRequest(String url,
AsyncUrlRequestListener listener, Executor executor);
public abstract UrlRequest createRequest(String url,
UrlRequestListener listener, Executor executor);
}
......@@ -9,9 +9,9 @@ import java.nio.ByteBuffer;
/**
* Note: All methods will be called on the thread of the Executor used during
* construction of the AsyncUrlRequest.
* construction of the UrlRequest.
*/
public abstract interface AsyncUrlRequestListener {
public interface UrlRequestListener {
/**
* Called before following redirects. The redirect will automatically be
* followed, unless the request is paused or cancelled during this
......@@ -20,10 +20,10 @@ public abstract interface AsyncUrlRequestListener {
*
* @param request Request being redirected.
* @param info Response information.
* @param new_location Location where request is redirected.
* @param newLocation Location where request is redirected.
*/
public void onRedirect(AsyncUrlRequest request, ResponseInfo info,
URL new_location);
public void onRedirect(UrlRequest request, ResponseInfo info,
URL newLocation);
/**
* Called when the final set of headers, after all redirects,
......@@ -32,7 +32,7 @@ public abstract interface AsyncUrlRequestListener {
* @param request Request that started to get response.
* @param info Response information.
*/
public void onResponseStarted(AsyncUrlRequest request, ResponseInfo info);
public void onResponseStarted(UrlRequest request, ResponseInfo info);
/**
* Called whenever data is received. The ByteBuffer remains
......@@ -43,23 +43,23 @@ public abstract interface AsyncUrlRequestListener {
* @param request Request that received data.
* @param byteBuffer Received data.
*/
public void onDataReceived(AsyncUrlRequest request, ByteBuffer byteBuffer);
public void onDataReceived(UrlRequest request, ByteBuffer byteBuffer);
/**
* Called when request is complete, no callbacks will be called afterwards.
*
* @param request Request that is complete.
*/
public void onComplete(AsyncUrlRequest request);
public void onComplete(UrlRequest request);
/**
* Can be called at any point between start() and onComplete(). Once
* called, no other functions can be called. AsyncUrlRequestException
* called, no other functions can be called. UrlRequestException
* provides information about error.
*
* @param request Request that received an error.
* @param error information about error.
*/
public void onError(AsyncUrlRequest request,
AsyncUrlRequestException error);
public void onError(UrlRequest request,
UrlRequestException error);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment