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; ...@@ -8,7 +8,7 @@ package org.chromium.net;
* HTTP request (GET, PUT or POST). * HTTP request (GET, PUT or POST).
* Note: All methods must be called on the Executor passed in during creation. * 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 * More setters go here. They may only be called before start (Maybe
* also allow during redirects). Could optionally instead use arguments * also allow during redirects). Could optionally instead use arguments
...@@ -21,7 +21,7 @@ public abstract interface AsyncUrlRequest { ...@@ -21,7 +21,7 @@ public abstract interface AsyncUrlRequest {
* <p>The default when this method is not called is "GET" if the request has * <p>The default when this method is not called is "GET" if the request has
* no body or "POST" if it does. * 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); public void setHttpMethod(String method);
...@@ -37,7 +37,7 @@ public abstract interface AsyncUrlRequest { ...@@ -37,7 +37,7 @@ public abstract interface AsyncUrlRequest {
* Starts the request, all callbacks go to listener. * Starts the request, all callbacks go to listener.
* @param listener * @param listener
*/ */
public void start(AsyncUrlRequestListener listener); public void start(UrlRequestListener listener);
/** /**
* Can be called at any time. * Can be called at any time.
......
...@@ -9,5 +9,5 @@ import java.io.IOException; ...@@ -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; ...@@ -7,20 +7,20 @@ package org.chromium.net;
import java.util.concurrent.Executor; 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. * 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 * be called on the Executor's thread, and all callbacks will be called
* on the Executor's thread as well. * 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 url URL for the request.
* @param listener Callback interface that gets called on different events. * @param listener Callback interface that gets called on different events.
* @param executor Executor on which all callbacks will be called. * @param executor Executor on which all callbacks will be called.
* @return new request. * @return new request.
*/ */
public abstract AsyncUrlRequest createAsyncRequest(String url, public abstract UrlRequest createRequest(String url,
AsyncUrlRequestListener listener, Executor executor); UrlRequestListener listener, Executor executor);
} }
...@@ -9,9 +9,9 @@ import java.nio.ByteBuffer; ...@@ -9,9 +9,9 @@ import java.nio.ByteBuffer;
/** /**
* Note: All methods will be called on the thread of the Executor used during * 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 * Called before following redirects. The redirect will automatically be
* followed, unless the request is paused or cancelled during this * followed, unless the request is paused or cancelled during this
...@@ -20,10 +20,10 @@ public abstract interface AsyncUrlRequestListener { ...@@ -20,10 +20,10 @@ public abstract interface AsyncUrlRequestListener {
* *
* @param request Request being redirected. * @param request Request being redirected.
* @param info Response information. * @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, public void onRedirect(UrlRequest request, ResponseInfo info,
URL new_location); URL newLocation);
/** /**
* Called when the final set of headers, after all redirects, * Called when the final set of headers, after all redirects,
...@@ -32,7 +32,7 @@ public abstract interface AsyncUrlRequestListener { ...@@ -32,7 +32,7 @@ public abstract interface AsyncUrlRequestListener {
* @param request Request that started to get response. * @param request Request that started to get response.
* @param info Response information. * @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 * Called whenever data is received. The ByteBuffer remains
...@@ -43,23 +43,23 @@ public abstract interface AsyncUrlRequestListener { ...@@ -43,23 +43,23 @@ public abstract interface AsyncUrlRequestListener {
* @param request Request that received data. * @param request Request that received data.
* @param byteBuffer 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. * Called when request is complete, no callbacks will be called afterwards.
* *
* @param request Request that is complete. * @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 * 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. * provides information about error.
* *
* @param request Request that received an error. * @param request Request that received an error.
* @param error information about error. * @param error information about error.
*/ */
public void onError(AsyncUrlRequest request, public void onError(UrlRequest request,
AsyncUrlRequestException error); 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