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_array.h" | 9 #include "base/android/jni_array.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 295 } |
296 | 296 |
297 private: | 297 private: |
298 friend class base::RefCountedThreadSafe<Delegate>; | 298 friend class base::RefCountedThreadSafe<Delegate>; |
299 | 299 |
300 class JNIDelegateImpl : public ProxyConfigServiceAndroid::JNIDelegate { | 300 class JNIDelegateImpl : public ProxyConfigServiceAndroid::JNIDelegate { |
301 public: | 301 public: |
302 explicit JNIDelegateImpl(Delegate* delegate) : delegate_(delegate) {} | 302 explicit JNIDelegateImpl(Delegate* delegate) : delegate_(delegate) {} |
303 | 303 |
304 // ProxyConfigServiceAndroid::JNIDelegate overrides. | 304 // ProxyConfigServiceAndroid::JNIDelegate overrides. |
305 virtual void ProxySettingsChangedTo(JNIEnv* env, | 305 void ProxySettingsChangedTo(JNIEnv* env, |
306 jobject jself, | 306 jobject jself, |
307 jstring jhost, | 307 jstring jhost, |
308 jint jport, | 308 jint jport, |
309 jstring jpac_url, | 309 jstring jpac_url, |
310 jobjectArray jexclusion_list) override { | 310 jobjectArray jexclusion_list) override { |
311 std::string host = ConvertJavaStringToUTF8(env, jhost); | 311 std::string host = ConvertJavaStringToUTF8(env, jhost); |
312 std::string pac_url; | 312 std::string pac_url; |
313 if (jpac_url) | 313 if (jpac_url) |
314 ConvertJavaStringToUTF8(env, jpac_url, &pac_url); | 314 ConvertJavaStringToUTF8(env, jpac_url, &pac_url); |
315 std::vector<std::string> exclusion_list; | 315 std::vector<std::string> exclusion_list; |
316 base::android::AppendJavaStringArrayToStringVector( | 316 base::android::AppendJavaStringArrayToStringVector( |
317 env, jexclusion_list, &exclusion_list); | 317 env, jexclusion_list, &exclusion_list); |
318 delegate_->ProxySettingsChangedTo(host, jport, pac_url, exclusion_list); | 318 delegate_->ProxySettingsChangedTo(host, jport, pac_url, exclusion_list); |
319 } | 319 } |
320 | 320 |
321 virtual void ProxySettingsChanged(JNIEnv* env, jobject self) override { | 321 void ProxySettingsChanged(JNIEnv* env, jobject self) override { |
322 delegate_->ProxySettingsChanged(); | 322 delegate_->ProxySettingsChanged(); |
323 } | 323 } |
324 | 324 |
325 private: | 325 private: |
326 Delegate* const delegate_; | 326 Delegate* const delegate_; |
327 }; | 327 }; |
328 | 328 |
329 virtual ~Delegate() {} | 329 virtual ~Delegate() {} |
330 | 330 |
331 void ShutdownOnJNIThread() { | 331 void ShutdownOnJNIThread() { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 network_task_runner, jni_task_runner, get_property_callback)) { | 408 network_task_runner, jni_task_runner, get_property_callback)) { |
409 delegate_->SetupJNI(); | 409 delegate_->SetupJNI(); |
410 delegate_->FetchInitialConfig(); | 410 delegate_->FetchInitialConfig(); |
411 } | 411 } |
412 | 412 |
413 void ProxyConfigServiceAndroid::ProxySettingsChanged() { | 413 void ProxyConfigServiceAndroid::ProxySettingsChanged() { |
414 delegate_->ProxySettingsChanged(); | 414 delegate_->ProxySettingsChanged(); |
415 } | 415 } |
416 | 416 |
417 } // namespace net | 417 } // namespace net |
OLD | NEW |