Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(717)

Unified Diff: net/proxy/proxy_config_service_android.cc

Issue 421493002: Use Android proxy's exclusion list to enable proxy bypass (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix stale line Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_config_service_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_config_service_android.cc
diff --git a/net/proxy/proxy_config_service_android.cc b/net/proxy/proxy_config_service_android.cc
index b294689f078ca47b08cf99dea3bae10e21fee0d0..f1a0b6cca54f702b924b969ba320d691b61b1108 100644
--- a/net/proxy/proxy_config_service_android.cc
+++ b/net/proxy/proxy_config_service_android.cc
@@ -6,6 +6,7 @@
#include <sys/system_properties.h>
+#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/basictypes.h"
#include "base/bind.h"
@@ -162,6 +163,7 @@ std::string GetJavaProperty(const std::string& property) {
void CreateStaticProxyConfig(const std::string& host,
int port,
const std::string& pac_url,
+ const std::vector<std::string>& exclusion_list,
ProxyConfig* config) {
if (!pac_url.empty()) {
config->set_pac_url(GURL(pac_url));
@@ -169,6 +171,16 @@ void CreateStaticProxyConfig(const std::string& host,
} else if (port != 0) {
std::string rules = base::StringPrintf("%s:%d", host.c_str(), port);
config->proxy_rules().ParseFromString(rules);
+ config->proxy_rules().bypass_rules.Clear();
+
+ std::vector<std::string>::const_iterator it;
+ for (it = exclusion_list.begin(); it != exclusion_list.end(); ++it) {
+ std::string pattern;
+ base::TrimWhitespaceASCII(*it, base::TRIM_ALL, &pattern);
+ if (pattern.empty())
+ continue;
+ config->proxy_rules().bypass_rules.AddRuleForHostname("", pattern, -1);
sgurun-gerrit only 2014/10/10 00:58:55 himm, I am not fully sure if I am doing it right h
sgurun-gerrit only 2014/10/11 00:53:59 So it seems that the exclusion list that is manual
+ }
} else {
*config = ProxyConfig::CreateDirect();
}
@@ -255,10 +267,11 @@ class ProxyConfigServiceAndroid::Delegate
// Called on the JNI thread.
void ProxySettingsChangedTo(const std::string& host,
int port,
- const std::string& pac_url) {
+ const std::string& pac_url,
+ const std::vector<std::string>& exclusion_list) {
DCHECK(OnJNIThread());
ProxyConfig proxy_config;
- CreateStaticProxyConfig(host, port, pac_url, &proxy_config);
+ CreateStaticProxyConfig(host, port, pac_url, exclusion_list, &proxy_config);
network_task_runner_->PostTask(
FROM_HERE,
base::Bind(
@@ -277,12 +290,16 @@ class ProxyConfigServiceAndroid::Delegate
jobject jself,
jstring jhost,
jint jport,
- jstring jpac_url) override {
+ jstring jpac_url,
+ jobjectArray jexclusion_list) override {
std::string host = ConvertJavaStringToUTF8(env, jhost);
std::string pac_url;
if (jpac_url)
ConvertJavaStringToUTF8(env, jpac_url, &pac_url);
- delegate_->ProxySettingsChangedTo(host, jport, pac_url);
+ std::vector<std::string> exclusion_list;
+ base::android::AppendJavaStringArrayToStringVector(
+ env, jexclusion_list, &exclusion_list);
+ delegate_->ProxySettingsChangedTo(host, jport, pac_url, exclusion_list);
}
virtual void ProxySettingsChanged(JNIEnv* env, jobject self) override {
« no previous file with comments | « net/proxy/proxy_config_service_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698