Merge "Add new methods to PacProcessor to"

This commit is contained in:
Anna Malova
2020-08-06 17:51:02 +00:00
committed by Android (Google) Code Review
4 changed files with 58 additions and 2 deletions

View File

@@ -12732,6 +12732,9 @@ package android.webkit {
public interface PacProcessor {
method @Nullable public String findProxyForUrl(@NonNull String);
method @NonNull public static android.webkit.PacProcessor getInstance();
method @NonNull public static android.webkit.PacProcessor getInstanceForNetwork(long);
method public default long getNetworkHandle();
method public default void releasePacProcessor();
method public boolean setProxyScript(@NonNull String);
}
@@ -12871,6 +12874,7 @@ package android.webkit {
method public android.webkit.CookieManager getCookieManager();
method public android.webkit.GeolocationPermissions getGeolocationPermissions();
method @NonNull public default android.webkit.PacProcessor getPacProcessor();
method @NonNull public default android.webkit.PacProcessor getPacProcessorForNetwork(long);
method public android.webkit.ServiceWorkerController getServiceWorkerController();
method public android.webkit.WebViewFactoryProvider.Statics getStatics();
method @Deprecated public android.webkit.TokenBindingService getTokenBindingService();

View File

@@ -19,7 +19,7 @@ package android.webkit;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.net.Network;
/**
* Class to evaluate PAC scripts.
@@ -39,6 +39,20 @@ public interface PacProcessor {
return WebViewFactory.getProvider().getPacProcessor();
}
/**
* Returns PacProcessor instance associated with the {@link Network}.
* The host resolution is done on this {@link Network}.
*
* @param networkHandle a handle representing {@link Network} handle.
* @return PacProcessor instance for the specified network.
* @see Network#getNetworkHandle
* @see Network#fromNetworkHandle
*/
@NonNull
static PacProcessor getInstanceForNetwork(long networkHandle) {
return WebViewFactory.getProvider().getPacProcessorForNetwork(networkHandle);
}
/**
* Set PAC script to use.
*
@@ -55,4 +69,23 @@ public interface PacProcessor {
*/
@Nullable
String findProxyForUrl(@NonNull String url);
/**
* Stops support for this {@link PacProcessor} and release its resources.
* No methods of this class must be called after calling this method.
*/
default void releasePacProcessor() {
throw new UnsupportedOperationException("Not implemented");
}
/**
* Returns a network handle associated with this {@link PacProcessor}.
*
* @return a network handle or 0 if a network is unspecified.
* @see Network#getNetworkHandle
* @see Network#fromNetworkHandle
*/
default long getNetworkHandle() {
throw new UnsupportedOperationException("Not implemented");
}
}

View File

@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.content.Context;
import android.content.Intent;
import android.net.Network;
import android.net.Uri;
import java.util.List;
@@ -175,7 +176,7 @@ public interface WebViewFactoryProvider {
WebViewDatabase getWebViewDatabase(Context context);
/**
* Gets the singleton PacProcessor instance.
* Gets the default PacProcessor instance.
* @return the PacProcessor instance
*/
@NonNull
@@ -183,6 +184,20 @@ public interface WebViewFactoryProvider {
throw new UnsupportedOperationException("Not implemented");
}
/**
* Returns PacProcessor instance associated with the {@link Network}.
* The host resolution is done on this {@link Network}.
*
* @param networkHandle a network handle representing the {@link Network}.
* @return the {@link PacProcessor} instance associated with {@link Network}.
* @see Network#getNetworkHandle
* @see Network#fromNetworkHandle
*/
@NonNull
default PacProcessor getPacProcessorForNetwork(long networkHandle) {
throw new UnsupportedOperationException("Not implemented");
}
/**
* Gets the classloader used to load internal WebView implementation classes. This interface
* should only be used by the WebView Support Library.

View File

@@ -11575,6 +11575,9 @@ package android.webkit {
public interface PacProcessor {
method @Nullable public String findProxyForUrl(@NonNull String);
method @NonNull public static android.webkit.PacProcessor getInstance();
method @NonNull public static android.webkit.PacProcessor getInstanceForNetwork(long);
method public default long getNetworkHandle();
method public default void releasePacProcessor();
method public boolean setProxyScript(@NonNull String);
}
@@ -11714,6 +11717,7 @@ package android.webkit {
method public android.webkit.CookieManager getCookieManager();
method public android.webkit.GeolocationPermissions getGeolocationPermissions();
method @NonNull public default android.webkit.PacProcessor getPacProcessor();
method @NonNull public default android.webkit.PacProcessor getPacProcessorForNetwork(long);
method public android.webkit.ServiceWorkerController getServiceWorkerController();
method public android.webkit.WebViewFactoryProvider.Statics getStatics();
method @Deprecated public android.webkit.TokenBindingService getTokenBindingService();