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 4129bf24c2f958d268cddc7282e049f3836ccb68..5efc2735f3bb6bb252c914683aa538504665d82b 100644 |
--- a/net/proxy/proxy_config_service_android.cc |
+++ b/net/proxy/proxy_config_service_android.cc |
@@ -58,8 +58,7 @@ ProxyServer ConstructProxyServer(ProxyServer::Scheme scheme, |
return ProxyServer(); |
DCHECK(port_as_int > 0); |
return ProxyServer( |
- scheme, |
- HostPortPair(proxy_host, static_cast<uint16>(port_as_int))); |
+ scheme, HostPortPair(proxy_host, static_cast<uint16>(port_as_int))); |
} |
ProxyServer LookupProxy(const std::string& prefix, |
@@ -84,8 +83,8 @@ ProxyServer LookupSocksProxy(const GetPropertyCallback& get_property) { |
std::string proxy_host = get_property.Run("socksProxyHost"); |
if (!proxy_host.empty()) { |
std::string proxy_port = get_property.Run("socksProxyPort"); |
- return ConstructProxyServer(ProxyServer::SCHEME_SOCKS5, proxy_host, |
- proxy_port); |
+ return ConstructProxyServer( |
+ ProxyServer::SCHEME_SOCKS5, proxy_host, proxy_port); |
} |
return ProxyServer(); |
} |
@@ -97,8 +96,7 @@ void AddBypassRules(const std::string& scheme, |
// by | and that use * as a wildcard. For example, setting the |
// http.nonProxyHosts property to *.android.com|*.kernel.org will cause |
// requests to http://developer.android.com to be made without a proxy. |
- std::string non_proxy_hosts = |
- get_property.Run(scheme + ".nonProxyHosts"); |
+ std::string non_proxy_hosts = get_property.Run(scheme + ".nonProxyHosts"); |
if (non_proxy_hosts.empty()) |
return; |
base::StringTokenizer tokenizer(non_proxy_hosts, "|"); |
@@ -137,9 +135,9 @@ bool GetProxyRules(const GetPropertyCallback& get_property, |
AddBypassRules("https", get_property, &rules->bypass_rules); |
// We know a proxy was found if not all of the proxy lists are empty. |
return !(rules->proxies_for_http.IsEmpty() && |
- rules->proxies_for_https.IsEmpty() && |
- rules->proxies_for_ftp.IsEmpty() && |
- rules->fallback_proxies.IsEmpty()); |
+ rules->proxies_for_https.IsEmpty() && |
+ rules->proxies_for_ftp.IsEmpty() && |
+ rules->fallback_proxies.IsEmpty()); |
}; |
void GetLatestProxyConfigInternal(const GetPropertyCallback& get_property, |
@@ -155,11 +153,12 @@ std::string GetJavaProperty(const std::string& property) { |
ScopedJavaLocalRef<jstring> str = ConvertUTF8ToJavaString(env, property); |
ScopedJavaLocalRef<jstring> result = |
Java_ProxyChangeListener_getProperty(env, str.obj()); |
- return result.is_null() ? |
- std::string() : ConvertJavaStringToUTF8(env, result.obj()); |
+ return result.is_null() ? std::string() |
+ : ConvertJavaStringToUTF8(env, result.obj()); |
} |
-void CreateStaticProxyConfig(const std::string& host, int port, |
+void CreateStaticProxyConfig(const std::string& host, |
+ int port, |
ProxyConfig* config) { |
if (port != 0) { |
std::string rules = base::StringPrintf("%s:%d", host.c_str(), port); |
@@ -180,22 +179,19 @@ class ProxyConfigServiceAndroid::Delegate |
: jni_delegate_(this), |
network_task_runner_(network_task_runner), |
jni_task_runner_(jni_task_runner), |
- get_property_callback_(get_property_callback) { |
- } |
+ get_property_callback_(get_property_callback) {} |
void SetupJNI() { |
DCHECK(OnJNIThread()); |
JNIEnv* env = AttachCurrentThread(); |
if (java_proxy_change_listener_.is_null()) { |
- java_proxy_change_listener_.Reset( |
- Java_ProxyChangeListener_create( |
- env, base::android::GetApplicationContext())); |
+ java_proxy_change_listener_.Reset(Java_ProxyChangeListener_create( |
+ env, base::android::GetApplicationContext())); |
CHECK(!java_proxy_change_listener_.is_null()); |
} |
- Java_ProxyChangeListener_start( |
- env, |
- java_proxy_change_listener_.obj(), |
- reinterpret_cast<intptr_t>(&jni_delegate_)); |
+ Java_ProxyChangeListener_start(env, |
+ java_proxy_change_listener_.obj(), |
+ reinterpret_cast<intptr_t>(&jni_delegate_)); |
} |
void FetchInitialConfig() { |
@@ -212,8 +208,7 @@ class ProxyConfigServiceAndroid::Delegate |
ShutdownOnJNIThread(); |
} else { |
jni_task_runner_->PostTask( |
- FROM_HERE, |
- base::Bind(&Delegate::ShutdownOnJNIThread, this)); |
+ FROM_HERE, base::Bind(&Delegate::ShutdownOnJNIThread, this)); |
} |
} |
@@ -243,8 +238,7 @@ class ProxyConfigServiceAndroid::Delegate |
GetLatestProxyConfigInternal(get_property_callback_, &proxy_config); |
network_task_runner_->PostTask( |
FROM_HERE, |
- base::Bind( |
- &Delegate::SetNewConfigOnNetworkThread, this, proxy_config)); |
+ base::Bind(&Delegate::SetNewConfigOnNetworkThread, this, proxy_config)); |
} |
// Called on the JNI thread. |
@@ -254,8 +248,7 @@ class ProxyConfigServiceAndroid::Delegate |
CreateStaticProxyConfig(host, port, &proxy_config); |
network_task_runner_->PostTask( |
FROM_HERE, |
- base::Bind( |
- &Delegate::SetNewConfigOnNetworkThread, this, proxy_config)); |
+ base::Bind(&Delegate::SetNewConfigOnNetworkThread, this, proxy_config)); |
} |
private: |
@@ -266,8 +259,10 @@ class ProxyConfigServiceAndroid::Delegate |
explicit JNIDelegateImpl(Delegate* delegate) : delegate_(delegate) {} |
// ProxyConfigServiceAndroid::JNIDelegate overrides. |
- virtual void ProxySettingsChangedTo(JNIEnv* env, jobject jself, |
- jstring jhost, jint jport) OVERRIDE { |
+ virtual void ProxySettingsChangedTo(JNIEnv* env, |
+ jobject jself, |
+ jstring jhost, |
+ jint jport) OVERRIDE { |
std::string host = ConvertJavaStringToUTF8(env, jhost); |
delegate_->ProxySettingsChangedTo(host, jport); |
} |
@@ -293,9 +288,10 @@ class ProxyConfigServiceAndroid::Delegate |
void SetNewConfigOnNetworkThread(const ProxyConfig& proxy_config) { |
DCHECK(OnNetworkThread()); |
proxy_config_ = proxy_config; |
- FOR_EACH_OBSERVER(Observer, observers_, |
- OnProxyConfigChanged(proxy_config, |
- ProxyConfigService::CONFIG_VALID)); |
+ FOR_EACH_OBSERVER( |
+ Observer, |
+ observers_, |
+ OnProxyConfigChanged(proxy_config, ProxyConfigService::CONFIG_VALID)); |
} |
bool OnJNIThread() const { |
@@ -321,8 +317,9 @@ class ProxyConfigServiceAndroid::Delegate |
ProxyConfigServiceAndroid::ProxyConfigServiceAndroid( |
base::SequencedTaskRunner* network_task_runner, |
base::SequencedTaskRunner* jni_task_runner) |
- : delegate_(new Delegate( |
- network_task_runner, jni_task_runner, base::Bind(&GetJavaProperty))) { |
+ : delegate_(new Delegate(network_task_runner, |
+ jni_task_runner, |
+ base::Bind(&GetJavaProperty))) { |
delegate_->SetupJNI(); |
delegate_->FetchInitialConfig(); |
} |
@@ -353,8 +350,9 @@ ProxyConfigServiceAndroid::ProxyConfigServiceAndroid( |
base::SequencedTaskRunner* network_task_runner, |
base::SequencedTaskRunner* jni_task_runner, |
GetPropertyCallback get_property_callback) |
- : delegate_(new Delegate( |
- network_task_runner, jni_task_runner, get_property_callback)) { |
+ : delegate_(new Delegate(network_task_runner, |
+ jni_task_runner, |
+ get_property_callback)) { |
delegate_->SetupJNI(); |
delegate_->FetchInitialConfig(); |
} |
@@ -363,4 +361,4 @@ void ProxyConfigServiceAndroid::ProxySettingsChanged() { |
delegate_->ProxySettingsChanged(); |
} |
-} // namespace net |
+} // namespace net |