OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/proxy/proxy_config_service_android.h" | 5 #include "net/proxy/proxy_config_service_android.h" |
6 | 6 |
7 #include <sys/system_properties.h> | 7 #include <sys/system_properties.h> |
8 | 8 |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // http.nonProxyHosts property to *.android.com|*.kernel.org will cause | 99 // http.nonProxyHosts property to *.android.com|*.kernel.org will cause |
100 // requests to http://developer.android.com to be made without a proxy. | 100 // requests to http://developer.android.com to be made without a proxy. |
101 std::string non_proxy_hosts = | 101 std::string non_proxy_hosts = |
102 get_property.Run(scheme + ".nonProxyHosts"); | 102 get_property.Run(scheme + ".nonProxyHosts"); |
103 if (non_proxy_hosts.empty()) | 103 if (non_proxy_hosts.empty()) |
104 return; | 104 return; |
105 base::StringTokenizer tokenizer(non_proxy_hosts, "|"); | 105 base::StringTokenizer tokenizer(non_proxy_hosts, "|"); |
106 while (tokenizer.GetNext()) { | 106 while (tokenizer.GetNext()) { |
107 std::string token = tokenizer.token(); | 107 std::string token = tokenizer.token(); |
108 std::string pattern; | 108 std::string pattern; |
109 TrimWhitespaceASCII(token, TRIM_ALL, &pattern); | 109 base::TrimWhitespaceASCII(token, base::TRIM_ALL, &pattern); |
110 if (pattern.empty()) | 110 if (pattern.empty()) |
111 continue; | 111 continue; |
112 // '?' is not one of the specified pattern characters above. | 112 // '?' is not one of the specified pattern characters above. |
113 DCHECK_EQ(std::string::npos, pattern.find('?')); | 113 DCHECK_EQ(std::string::npos, pattern.find('?')); |
114 bypass_rules->AddRuleForHostname(scheme, pattern, -1); | 114 bypass_rules->AddRuleForHostname(scheme, pattern, -1); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 // Returns true if a valid proxy was found. | 118 // Returns true if a valid proxy was found. |
119 bool GetProxyRules(const GetPropertyCallback& get_property, | 119 bool GetProxyRules(const GetPropertyCallback& get_property, |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 network_task_runner, jni_task_runner, get_property_callback)) { | 358 network_task_runner, jni_task_runner, get_property_callback)) { |
359 delegate_->SetupJNI(); | 359 delegate_->SetupJNI(); |
360 delegate_->FetchInitialConfig(); | 360 delegate_->FetchInitialConfig(); |
361 } | 361 } |
362 | 362 |
363 void ProxyConfigServiceAndroid::ProxySettingsChanged() { | 363 void ProxyConfigServiceAndroid::ProxySettingsChanged() { |
364 delegate_->ProxySettingsChanged(); | 364 delegate_->ProxySettingsChanged(); |
365 } | 365 } |
366 | 366 |
367 } // namespace net | 367 } // namespace net |
OLD | NEW |