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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 const std::string& proxy_host, | 51 const std::string& proxy_host, |
52 const std::string& proxy_port) { | 52 const std::string& proxy_port) { |
53 DCHECK(!proxy_host.empty()); | 53 DCHECK(!proxy_host.empty()); |
54 int port_as_int = 0; | 54 int port_as_int = 0; |
55 if (proxy_port.empty()) | 55 if (proxy_port.empty()) |
56 port_as_int = ProxyServer::GetDefaultPortForScheme(scheme); | 56 port_as_int = ProxyServer::GetDefaultPortForScheme(scheme); |
57 else if (!ConvertStringToPort(proxy_port, &port_as_int)) | 57 else if (!ConvertStringToPort(proxy_port, &port_as_int)) |
58 return ProxyServer(); | 58 return ProxyServer(); |
59 DCHECK(port_as_int > 0); | 59 DCHECK(port_as_int > 0); |
60 return ProxyServer( | 60 return ProxyServer( |
61 scheme, | 61 scheme, HostPortPair(proxy_host, static_cast<uint16>(port_as_int))); |
62 HostPortPair(proxy_host, static_cast<uint16>(port_as_int))); | |
63 } | 62 } |
64 | 63 |
65 ProxyServer LookupProxy(const std::string& prefix, | 64 ProxyServer LookupProxy(const std::string& prefix, |
66 const GetPropertyCallback& get_property, | 65 const GetPropertyCallback& get_property, |
67 ProxyServer::Scheme scheme) { | 66 ProxyServer::Scheme scheme) { |
68 DCHECK(!prefix.empty()); | 67 DCHECK(!prefix.empty()); |
69 std::string proxy_host = get_property.Run(prefix + ".proxyHost"); | 68 std::string proxy_host = get_property.Run(prefix + ".proxyHost"); |
70 if (!proxy_host.empty()) { | 69 if (!proxy_host.empty()) { |
71 std::string proxy_port = get_property.Run(prefix + ".proxyPort"); | 70 std::string proxy_port = get_property.Run(prefix + ".proxyPort"); |
72 return ConstructProxyServer(scheme, proxy_host, proxy_port); | 71 return ConstructProxyServer(scheme, proxy_host, proxy_port); |
73 } | 72 } |
74 // Fall back to default proxy, if any. | 73 // Fall back to default proxy, if any. |
75 proxy_host = get_property.Run("proxyHost"); | 74 proxy_host = get_property.Run("proxyHost"); |
76 if (!proxy_host.empty()) { | 75 if (!proxy_host.empty()) { |
77 std::string proxy_port = get_property.Run("proxyPort"); | 76 std::string proxy_port = get_property.Run("proxyPort"); |
78 return ConstructProxyServer(scheme, proxy_host, proxy_port); | 77 return ConstructProxyServer(scheme, proxy_host, proxy_port); |
79 } | 78 } |
80 return ProxyServer(); | 79 return ProxyServer(); |
81 } | 80 } |
82 | 81 |
83 ProxyServer LookupSocksProxy(const GetPropertyCallback& get_property) { | 82 ProxyServer LookupSocksProxy(const GetPropertyCallback& get_property) { |
84 std::string proxy_host = get_property.Run("socksProxyHost"); | 83 std::string proxy_host = get_property.Run("socksProxyHost"); |
85 if (!proxy_host.empty()) { | 84 if (!proxy_host.empty()) { |
86 std::string proxy_port = get_property.Run("socksProxyPort"); | 85 std::string proxy_port = get_property.Run("socksProxyPort"); |
87 return ConstructProxyServer(ProxyServer::SCHEME_SOCKS5, proxy_host, | 86 return ConstructProxyServer( |
88 proxy_port); | 87 ProxyServer::SCHEME_SOCKS5, proxy_host, proxy_port); |
89 } | 88 } |
90 return ProxyServer(); | 89 return ProxyServer(); |
91 } | 90 } |
92 | 91 |
93 void AddBypassRules(const std::string& scheme, | 92 void AddBypassRules(const std::string& scheme, |
94 const GetPropertyCallback& get_property, | 93 const GetPropertyCallback& get_property, |
95 ProxyBypassRules* bypass_rules) { | 94 ProxyBypassRules* bypass_rules) { |
96 // The format of a hostname pattern is a list of hostnames that are separated | 95 // The format of a hostname pattern is a list of hostnames that are separated |
97 // by | and that use * as a wildcard. For example, setting the | 96 // by | and that use * as a wildcard. For example, setting the |
98 // http.nonProxyHosts property to *.android.com|*.kernel.org will cause | 97 // http.nonProxyHosts property to *.android.com|*.kernel.org will cause |
99 // requests to http://developer.android.com to be made without a proxy. | 98 // requests to http://developer.android.com to be made without a proxy. |
100 std::string non_proxy_hosts = | 99 std::string non_proxy_hosts = get_property.Run(scheme + ".nonProxyHosts"); |
101 get_property.Run(scheme + ".nonProxyHosts"); | |
102 if (non_proxy_hosts.empty()) | 100 if (non_proxy_hosts.empty()) |
103 return; | 101 return; |
104 base::StringTokenizer tokenizer(non_proxy_hosts, "|"); | 102 base::StringTokenizer tokenizer(non_proxy_hosts, "|"); |
105 while (tokenizer.GetNext()) { | 103 while (tokenizer.GetNext()) { |
106 std::string token = tokenizer.token(); | 104 std::string token = tokenizer.token(); |
107 std::string pattern; | 105 std::string pattern; |
108 base::TrimWhitespaceASCII(token, base::TRIM_ALL, &pattern); | 106 base::TrimWhitespaceASCII(token, base::TRIM_ALL, &pattern); |
109 if (pattern.empty()) | 107 if (pattern.empty()) |
110 continue; | 108 continue; |
111 // '?' is not one of the specified pattern characters above. | 109 // '?' is not one of the specified pattern characters above. |
(...skipping 18 matching lines...) Expand all Loading... |
130 LookupProxy("https", get_property, ProxyServer::SCHEME_HTTP)); | 128 LookupProxy("https", get_property, ProxyServer::SCHEME_HTTP)); |
131 rules->proxies_for_ftp.SetSingleProxyServer( | 129 rules->proxies_for_ftp.SetSingleProxyServer( |
132 LookupProxy("ftp", get_property, ProxyServer::SCHEME_HTTP)); | 130 LookupProxy("ftp", get_property, ProxyServer::SCHEME_HTTP)); |
133 rules->fallback_proxies.SetSingleProxyServer(LookupSocksProxy(get_property)); | 131 rules->fallback_proxies.SetSingleProxyServer(LookupSocksProxy(get_property)); |
134 rules->bypass_rules.Clear(); | 132 rules->bypass_rules.Clear(); |
135 AddBypassRules("ftp", get_property, &rules->bypass_rules); | 133 AddBypassRules("ftp", get_property, &rules->bypass_rules); |
136 AddBypassRules("http", get_property, &rules->bypass_rules); | 134 AddBypassRules("http", get_property, &rules->bypass_rules); |
137 AddBypassRules("https", get_property, &rules->bypass_rules); | 135 AddBypassRules("https", get_property, &rules->bypass_rules); |
138 // We know a proxy was found if not all of the proxy lists are empty. | 136 // We know a proxy was found if not all of the proxy lists are empty. |
139 return !(rules->proxies_for_http.IsEmpty() && | 137 return !(rules->proxies_for_http.IsEmpty() && |
140 rules->proxies_for_https.IsEmpty() && | 138 rules->proxies_for_https.IsEmpty() && |
141 rules->proxies_for_ftp.IsEmpty() && | 139 rules->proxies_for_ftp.IsEmpty() && |
142 rules->fallback_proxies.IsEmpty()); | 140 rules->fallback_proxies.IsEmpty()); |
143 }; | 141 }; |
144 | 142 |
145 void GetLatestProxyConfigInternal(const GetPropertyCallback& get_property, | 143 void GetLatestProxyConfigInternal(const GetPropertyCallback& get_property, |
146 ProxyConfig* config) { | 144 ProxyConfig* config) { |
147 if (!GetProxyRules(get_property, &config->proxy_rules())) | 145 if (!GetProxyRules(get_property, &config->proxy_rules())) |
148 *config = ProxyConfig::CreateDirect(); | 146 *config = ProxyConfig::CreateDirect(); |
149 } | 147 } |
150 | 148 |
151 std::string GetJavaProperty(const std::string& property) { | 149 std::string GetJavaProperty(const std::string& property) { |
152 // Use Java System.getProperty to get configuration information. | 150 // Use Java System.getProperty to get configuration information. |
153 // TODO(pliard): Conversion to/from UTF8 ok here? | 151 // TODO(pliard): Conversion to/from UTF8 ok here? |
154 JNIEnv* env = AttachCurrentThread(); | 152 JNIEnv* env = AttachCurrentThread(); |
155 ScopedJavaLocalRef<jstring> str = ConvertUTF8ToJavaString(env, property); | 153 ScopedJavaLocalRef<jstring> str = ConvertUTF8ToJavaString(env, property); |
156 ScopedJavaLocalRef<jstring> result = | 154 ScopedJavaLocalRef<jstring> result = |
157 Java_ProxyChangeListener_getProperty(env, str.obj()); | 155 Java_ProxyChangeListener_getProperty(env, str.obj()); |
158 return result.is_null() ? | 156 return result.is_null() ? std::string() |
159 std::string() : ConvertJavaStringToUTF8(env, result.obj()); | 157 : ConvertJavaStringToUTF8(env, result.obj()); |
160 } | 158 } |
161 | 159 |
162 void CreateStaticProxyConfig(const std::string& host, int port, | 160 void CreateStaticProxyConfig(const std::string& host, |
| 161 int port, |
163 ProxyConfig* config) { | 162 ProxyConfig* config) { |
164 if (port != 0) { | 163 if (port != 0) { |
165 std::string rules = base::StringPrintf("%s:%d", host.c_str(), port); | 164 std::string rules = base::StringPrintf("%s:%d", host.c_str(), port); |
166 config->proxy_rules().ParseFromString(rules); | 165 config->proxy_rules().ParseFromString(rules); |
167 } else { | 166 } else { |
168 *config = ProxyConfig::CreateDirect(); | 167 *config = ProxyConfig::CreateDirect(); |
169 } | 168 } |
170 } | 169 } |
171 | 170 |
172 } // namespace | 171 } // namespace |
173 | 172 |
174 class ProxyConfigServiceAndroid::Delegate | 173 class ProxyConfigServiceAndroid::Delegate |
175 : public base::RefCountedThreadSafe<Delegate> { | 174 : public base::RefCountedThreadSafe<Delegate> { |
176 public: | 175 public: |
177 Delegate(base::SequencedTaskRunner* network_task_runner, | 176 Delegate(base::SequencedTaskRunner* network_task_runner, |
178 base::SequencedTaskRunner* jni_task_runner, | 177 base::SequencedTaskRunner* jni_task_runner, |
179 const GetPropertyCallback& get_property_callback) | 178 const GetPropertyCallback& get_property_callback) |
180 : jni_delegate_(this), | 179 : jni_delegate_(this), |
181 network_task_runner_(network_task_runner), | 180 network_task_runner_(network_task_runner), |
182 jni_task_runner_(jni_task_runner), | 181 jni_task_runner_(jni_task_runner), |
183 get_property_callback_(get_property_callback) { | 182 get_property_callback_(get_property_callback) {} |
184 } | |
185 | 183 |
186 void SetupJNI() { | 184 void SetupJNI() { |
187 DCHECK(OnJNIThread()); | 185 DCHECK(OnJNIThread()); |
188 JNIEnv* env = AttachCurrentThread(); | 186 JNIEnv* env = AttachCurrentThread(); |
189 if (java_proxy_change_listener_.is_null()) { | 187 if (java_proxy_change_listener_.is_null()) { |
190 java_proxy_change_listener_.Reset( | 188 java_proxy_change_listener_.Reset(Java_ProxyChangeListener_create( |
191 Java_ProxyChangeListener_create( | 189 env, base::android::GetApplicationContext())); |
192 env, base::android::GetApplicationContext())); | |
193 CHECK(!java_proxy_change_listener_.is_null()); | 190 CHECK(!java_proxy_change_listener_.is_null()); |
194 } | 191 } |
195 Java_ProxyChangeListener_start( | 192 Java_ProxyChangeListener_start(env, |
196 env, | 193 java_proxy_change_listener_.obj(), |
197 java_proxy_change_listener_.obj(), | 194 reinterpret_cast<intptr_t>(&jni_delegate_)); |
198 reinterpret_cast<intptr_t>(&jni_delegate_)); | |
199 } | 195 } |
200 | 196 |
201 void FetchInitialConfig() { | 197 void FetchInitialConfig() { |
202 DCHECK(OnJNIThread()); | 198 DCHECK(OnJNIThread()); |
203 ProxyConfig proxy_config; | 199 ProxyConfig proxy_config; |
204 GetLatestProxyConfigInternal(get_property_callback_, &proxy_config); | 200 GetLatestProxyConfigInternal(get_property_callback_, &proxy_config); |
205 network_task_runner_->PostTask( | 201 network_task_runner_->PostTask( |
206 FROM_HERE, | 202 FROM_HERE, |
207 base::Bind(&Delegate::SetNewConfigOnNetworkThread, this, proxy_config)); | 203 base::Bind(&Delegate::SetNewConfigOnNetworkThread, this, proxy_config)); |
208 } | 204 } |
209 | 205 |
210 void Shutdown() { | 206 void Shutdown() { |
211 if (OnJNIThread()) { | 207 if (OnJNIThread()) { |
212 ShutdownOnJNIThread(); | 208 ShutdownOnJNIThread(); |
213 } else { | 209 } else { |
214 jni_task_runner_->PostTask( | 210 jni_task_runner_->PostTask( |
215 FROM_HERE, | 211 FROM_HERE, base::Bind(&Delegate::ShutdownOnJNIThread, this)); |
216 base::Bind(&Delegate::ShutdownOnJNIThread, this)); | |
217 } | 212 } |
218 } | 213 } |
219 | 214 |
220 // Called only on the network thread. | 215 // Called only on the network thread. |
221 void AddObserver(Observer* observer) { | 216 void AddObserver(Observer* observer) { |
222 DCHECK(OnNetworkThread()); | 217 DCHECK(OnNetworkThread()); |
223 observers_.AddObserver(observer); | 218 observers_.AddObserver(observer); |
224 } | 219 } |
225 | 220 |
226 void RemoveObserver(Observer* observer) { | 221 void RemoveObserver(Observer* observer) { |
227 DCHECK(OnNetworkThread()); | 222 DCHECK(OnNetworkThread()); |
228 observers_.RemoveObserver(observer); | 223 observers_.RemoveObserver(observer); |
229 } | 224 } |
230 | 225 |
231 ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) { | 226 ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) { |
232 DCHECK(OnNetworkThread()); | 227 DCHECK(OnNetworkThread()); |
233 if (!config) | 228 if (!config) |
234 return ProxyConfigService::CONFIG_UNSET; | 229 return ProxyConfigService::CONFIG_UNSET; |
235 *config = proxy_config_; | 230 *config = proxy_config_; |
236 return ProxyConfigService::CONFIG_VALID; | 231 return ProxyConfigService::CONFIG_VALID; |
237 } | 232 } |
238 | 233 |
239 // Called on the JNI thread. | 234 // Called on the JNI thread. |
240 void ProxySettingsChanged() { | 235 void ProxySettingsChanged() { |
241 DCHECK(OnJNIThread()); | 236 DCHECK(OnJNIThread()); |
242 ProxyConfig proxy_config; | 237 ProxyConfig proxy_config; |
243 GetLatestProxyConfigInternal(get_property_callback_, &proxy_config); | 238 GetLatestProxyConfigInternal(get_property_callback_, &proxy_config); |
244 network_task_runner_->PostTask( | 239 network_task_runner_->PostTask( |
245 FROM_HERE, | 240 FROM_HERE, |
246 base::Bind( | 241 base::Bind(&Delegate::SetNewConfigOnNetworkThread, this, proxy_config)); |
247 &Delegate::SetNewConfigOnNetworkThread, this, proxy_config)); | |
248 } | 242 } |
249 | 243 |
250 // Called on the JNI thread. | 244 // Called on the JNI thread. |
251 void ProxySettingsChangedTo(const std::string& host, int port) { | 245 void ProxySettingsChangedTo(const std::string& host, int port) { |
252 DCHECK(OnJNIThread()); | 246 DCHECK(OnJNIThread()); |
253 ProxyConfig proxy_config; | 247 ProxyConfig proxy_config; |
254 CreateStaticProxyConfig(host, port, &proxy_config); | 248 CreateStaticProxyConfig(host, port, &proxy_config); |
255 network_task_runner_->PostTask( | 249 network_task_runner_->PostTask( |
256 FROM_HERE, | 250 FROM_HERE, |
257 base::Bind( | 251 base::Bind(&Delegate::SetNewConfigOnNetworkThread, this, proxy_config)); |
258 &Delegate::SetNewConfigOnNetworkThread, this, proxy_config)); | |
259 } | 252 } |
260 | 253 |
261 private: | 254 private: |
262 friend class base::RefCountedThreadSafe<Delegate>; | 255 friend class base::RefCountedThreadSafe<Delegate>; |
263 | 256 |
264 class JNIDelegateImpl : public ProxyConfigServiceAndroid::JNIDelegate { | 257 class JNIDelegateImpl : public ProxyConfigServiceAndroid::JNIDelegate { |
265 public: | 258 public: |
266 explicit JNIDelegateImpl(Delegate* delegate) : delegate_(delegate) {} | 259 explicit JNIDelegateImpl(Delegate* delegate) : delegate_(delegate) {} |
267 | 260 |
268 // ProxyConfigServiceAndroid::JNIDelegate overrides. | 261 // ProxyConfigServiceAndroid::JNIDelegate overrides. |
269 virtual void ProxySettingsChangedTo(JNIEnv* env, jobject jself, | 262 virtual void ProxySettingsChangedTo(JNIEnv* env, |
270 jstring jhost, jint jport) OVERRIDE { | 263 jobject jself, |
| 264 jstring jhost, |
| 265 jint jport) OVERRIDE { |
271 std::string host = ConvertJavaStringToUTF8(env, jhost); | 266 std::string host = ConvertJavaStringToUTF8(env, jhost); |
272 delegate_->ProxySettingsChangedTo(host, jport); | 267 delegate_->ProxySettingsChangedTo(host, jport); |
273 } | 268 } |
274 | 269 |
275 virtual void ProxySettingsChanged(JNIEnv* env, jobject self) OVERRIDE { | 270 virtual void ProxySettingsChanged(JNIEnv* env, jobject self) OVERRIDE { |
276 delegate_->ProxySettingsChanged(); | 271 delegate_->ProxySettingsChanged(); |
277 } | 272 } |
278 | 273 |
279 private: | 274 private: |
280 Delegate* const delegate_; | 275 Delegate* const delegate_; |
281 }; | 276 }; |
282 | 277 |
283 virtual ~Delegate() {} | 278 virtual ~Delegate() {} |
284 | 279 |
285 void ShutdownOnJNIThread() { | 280 void ShutdownOnJNIThread() { |
286 if (java_proxy_change_listener_.is_null()) | 281 if (java_proxy_change_listener_.is_null()) |
287 return; | 282 return; |
288 JNIEnv* env = AttachCurrentThread(); | 283 JNIEnv* env = AttachCurrentThread(); |
289 Java_ProxyChangeListener_stop(env, java_proxy_change_listener_.obj()); | 284 Java_ProxyChangeListener_stop(env, java_proxy_change_listener_.obj()); |
290 } | 285 } |
291 | 286 |
292 // Called on the network thread. | 287 // Called on the network thread. |
293 void SetNewConfigOnNetworkThread(const ProxyConfig& proxy_config) { | 288 void SetNewConfigOnNetworkThread(const ProxyConfig& proxy_config) { |
294 DCHECK(OnNetworkThread()); | 289 DCHECK(OnNetworkThread()); |
295 proxy_config_ = proxy_config; | 290 proxy_config_ = proxy_config; |
296 FOR_EACH_OBSERVER(Observer, observers_, | 291 FOR_EACH_OBSERVER( |
297 OnProxyConfigChanged(proxy_config, | 292 Observer, |
298 ProxyConfigService::CONFIG_VALID)); | 293 observers_, |
| 294 OnProxyConfigChanged(proxy_config, ProxyConfigService::CONFIG_VALID)); |
299 } | 295 } |
300 | 296 |
301 bool OnJNIThread() const { | 297 bool OnJNIThread() const { |
302 return jni_task_runner_->RunsTasksOnCurrentThread(); | 298 return jni_task_runner_->RunsTasksOnCurrentThread(); |
303 } | 299 } |
304 | 300 |
305 bool OnNetworkThread() const { | 301 bool OnNetworkThread() const { |
306 return network_task_runner_->RunsTasksOnCurrentThread(); | 302 return network_task_runner_->RunsTasksOnCurrentThread(); |
307 } | 303 } |
308 | 304 |
309 ScopedJavaGlobalRef<jobject> java_proxy_change_listener_; | 305 ScopedJavaGlobalRef<jobject> java_proxy_change_listener_; |
310 | 306 |
311 JNIDelegateImpl jni_delegate_; | 307 JNIDelegateImpl jni_delegate_; |
312 ObserverList<Observer> observers_; | 308 ObserverList<Observer> observers_; |
313 scoped_refptr<base::SequencedTaskRunner> network_task_runner_; | 309 scoped_refptr<base::SequencedTaskRunner> network_task_runner_; |
314 scoped_refptr<base::SequencedTaskRunner> jni_task_runner_; | 310 scoped_refptr<base::SequencedTaskRunner> jni_task_runner_; |
315 GetPropertyCallback get_property_callback_; | 311 GetPropertyCallback get_property_callback_; |
316 ProxyConfig proxy_config_; | 312 ProxyConfig proxy_config_; |
317 | 313 |
318 DISALLOW_COPY_AND_ASSIGN(Delegate); | 314 DISALLOW_COPY_AND_ASSIGN(Delegate); |
319 }; | 315 }; |
320 | 316 |
321 ProxyConfigServiceAndroid::ProxyConfigServiceAndroid( | 317 ProxyConfigServiceAndroid::ProxyConfigServiceAndroid( |
322 base::SequencedTaskRunner* network_task_runner, | 318 base::SequencedTaskRunner* network_task_runner, |
323 base::SequencedTaskRunner* jni_task_runner) | 319 base::SequencedTaskRunner* jni_task_runner) |
324 : delegate_(new Delegate( | 320 : delegate_(new Delegate(network_task_runner, |
325 network_task_runner, jni_task_runner, base::Bind(&GetJavaProperty))) { | 321 jni_task_runner, |
| 322 base::Bind(&GetJavaProperty))) { |
326 delegate_->SetupJNI(); | 323 delegate_->SetupJNI(); |
327 delegate_->FetchInitialConfig(); | 324 delegate_->FetchInitialConfig(); |
328 } | 325 } |
329 | 326 |
330 ProxyConfigServiceAndroid::~ProxyConfigServiceAndroid() { | 327 ProxyConfigServiceAndroid::~ProxyConfigServiceAndroid() { |
331 delegate_->Shutdown(); | 328 delegate_->Shutdown(); |
332 } | 329 } |
333 | 330 |
334 // static | 331 // static |
335 bool ProxyConfigServiceAndroid::Register(JNIEnv* env) { | 332 bool ProxyConfigServiceAndroid::Register(JNIEnv* env) { |
(...skipping 10 matching lines...) Expand all Loading... |
346 | 343 |
347 ProxyConfigService::ConfigAvailability | 344 ProxyConfigService::ConfigAvailability |
348 ProxyConfigServiceAndroid::GetLatestProxyConfig(ProxyConfig* config) { | 345 ProxyConfigServiceAndroid::GetLatestProxyConfig(ProxyConfig* config) { |
349 return delegate_->GetLatestProxyConfig(config); | 346 return delegate_->GetLatestProxyConfig(config); |
350 } | 347 } |
351 | 348 |
352 ProxyConfigServiceAndroid::ProxyConfigServiceAndroid( | 349 ProxyConfigServiceAndroid::ProxyConfigServiceAndroid( |
353 base::SequencedTaskRunner* network_task_runner, | 350 base::SequencedTaskRunner* network_task_runner, |
354 base::SequencedTaskRunner* jni_task_runner, | 351 base::SequencedTaskRunner* jni_task_runner, |
355 GetPropertyCallback get_property_callback) | 352 GetPropertyCallback get_property_callback) |
356 : delegate_(new Delegate( | 353 : delegate_(new Delegate(network_task_runner, |
357 network_task_runner, jni_task_runner, get_property_callback)) { | 354 jni_task_runner, |
| 355 get_property_callback)) { |
358 delegate_->SetupJNI(); | 356 delegate_->SetupJNI(); |
359 delegate_->FetchInitialConfig(); | 357 delegate_->FetchInitialConfig(); |
360 } | 358 } |
361 | 359 |
362 void ProxyConfigServiceAndroid::ProxySettingsChanged() { | 360 void ProxyConfigServiceAndroid::ProxySettingsChanged() { |
363 delegate_->ProxySettingsChanged(); | 361 delegate_->ProxySettingsChanged(); |
364 } | 362 } |
365 | 363 |
366 } // namespace net | 364 } // namespace net |
OLD | NEW |