Index: net/android/java/src/org/chromium/net/ProxyChangeListener.java |
diff --git a/net/android/java/src/org/chromium/net/ProxyChangeListener.java b/net/android/java/src/org/chromium/net/ProxyChangeListener.java |
index 63bfb30514cae20a672e8526aa8a3d73919d3189..cebb14b2921aaa1f12d1406949f9c12f0182415f 100644 |
--- a/net/android/java/src/org/chromium/net/ProxyChangeListener.java |
+++ b/net/android/java/src/org/chromium/net/ProxyChangeListener.java |
@@ -34,14 +34,19 @@ public class ProxyChangeListener { |
private Delegate mDelegate; |
private static class ProxyConfig { |
- public ProxyConfig(String host, int port) { |
+ public ProxyConfig(String host, int port, String[] exclusionList) { |
mHost = host; |
mPort = port; |
+ mExclusionList = exclusionList; |
} |
public final String mHost; |
public final int mPort; |
+ public final String[] mExclusionList; |
} |
+ /** |
+ * The delegate for ProxyChangeListener. Use for testing. |
+ */ |
public interface Delegate { |
public void proxySettingsChanged(); |
} |
@@ -99,6 +104,7 @@ public class ProxyChangeListener { |
try { |
final String GET_HOST_NAME = "getHost"; |
final String GET_PORT_NAME = "getPort"; |
+ final String GET_EXCLUSION_LIST = "getExclusionList"; |
String className; |
String proxyInfo; |
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { |
@@ -108,7 +114,6 @@ public class ProxyChangeListener { |
className = "android.net.ProxyInfo"; |
proxyInfo = "android.intent.extra.PROXY_INFO"; |
} |
- |
Object props = intent.getExtras().get(proxyInfo); |
if (props == null) { |
return null; |
@@ -117,11 +122,19 @@ public class ProxyChangeListener { |
Class<?> cls = Class.forName(className); |
Method getHostMethod = cls.getDeclaredMethod(GET_HOST_NAME); |
Method getPortMethod = cls.getDeclaredMethod(GET_PORT_NAME); |
+ Method getExclusionListMethod = cls.getDeclaredMethod(GET_EXCLUSION_LIST); |
String host = (String) getHostMethod.invoke(props); |
int port = (Integer) getPortMethod.invoke(props); |
- return new ProxyConfig(host, port); |
+ String[] exclusionList; |
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { |
+ String s = (String) getExclusionListMethod.invoke(props); |
+ exclusionList = s.split(","); |
+ } else { |
+ exclusionList = (String[]) getExclusionListMethod.invoke(props); |
+ } |
+ return new ProxyConfig(host, port, exclusionList); |
} catch (ClassNotFoundException ex) { |
Log.e(TAG, "Using no proxy configuration due to exception:" + ex); |
return null; |
@@ -154,7 +167,7 @@ public class ProxyChangeListener { |
// Note that this code currently runs on a MESSAGE_LOOP_UI thread, but |
// the C++ code must run the callbacks on the network thread. |
if (cfg != null) { |
- nativeProxySettingsChangedTo(mNativePtr, cfg.mHost, cfg.mPort); |
+ nativeProxySettingsChangedTo(mNativePtr, cfg.mHost, cfg.mPort, cfg.mExclusionList); |
} else { |
nativeProxySettingsChanged(mNativePtr); |
} |
@@ -184,7 +197,8 @@ public class ProxyChangeListener { |
@NativeClassQualifiedName("ProxyConfigServiceAndroid::JNIDelegate") |
private native void nativeProxySettingsChangedTo(long nativePtr, |
String host, |
- int port); |
+ int port, |
+ String[] exclusionList); |
@NativeClassQualifiedName("ProxyConfigServiceAndroid::JNIDelegate") |
private native void nativeProxySettingsChanged(long nativePtr); |
} |