| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 class JNIDelegateImpl : public ProxyConfigServiceAndroid::JNIDelegate { | 271 class JNIDelegateImpl : public ProxyConfigServiceAndroid::JNIDelegate { |
| 272 public: | 272 public: |
| 273 explicit JNIDelegateImpl(Delegate* delegate) : delegate_(delegate) {} | 273 explicit JNIDelegateImpl(Delegate* delegate) : delegate_(delegate) {} |
| 274 | 274 |
| 275 // ProxyConfigServiceAndroid::JNIDelegate overrides. | 275 // ProxyConfigServiceAndroid::JNIDelegate overrides. |
| 276 virtual void ProxySettingsChangedTo(JNIEnv* env, | 276 virtual void ProxySettingsChangedTo(JNIEnv* env, |
| 277 jobject jself, | 277 jobject jself, |
| 278 jstring jhost, | 278 jstring jhost, |
| 279 jint jport, | 279 jint jport, |
| 280 jstring jpac_url) OVERRIDE { | 280 jstring jpac_url) override { |
| 281 std::string host = ConvertJavaStringToUTF8(env, jhost); | 281 std::string host = ConvertJavaStringToUTF8(env, jhost); |
| 282 std::string pac_url; | 282 std::string pac_url; |
| 283 if (jpac_url) | 283 if (jpac_url) |
| 284 ConvertJavaStringToUTF8(env, jpac_url, &pac_url); | 284 ConvertJavaStringToUTF8(env, jpac_url, &pac_url); |
| 285 delegate_->ProxySettingsChangedTo(host, jport, pac_url); | 285 delegate_->ProxySettingsChangedTo(host, jport, pac_url); |
| 286 } | 286 } |
| 287 | 287 |
| 288 virtual void ProxySettingsChanged(JNIEnv* env, jobject self) OVERRIDE { | 288 virtual void ProxySettingsChanged(JNIEnv* env, jobject self) override { |
| 289 delegate_->ProxySettingsChanged(); | 289 delegate_->ProxySettingsChanged(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 private: | 292 private: |
| 293 Delegate* const delegate_; | 293 Delegate* const delegate_; |
| 294 }; | 294 }; |
| 295 | 295 |
| 296 virtual ~Delegate() {} | 296 virtual ~Delegate() {} |
| 297 | 297 |
| 298 void ShutdownOnJNIThread() { | 298 void ShutdownOnJNIThread() { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 network_task_runner, jni_task_runner, get_property_callback)) { | 370 network_task_runner, jni_task_runner, get_property_callback)) { |
| 371 delegate_->SetupJNI(); | 371 delegate_->SetupJNI(); |
| 372 delegate_->FetchInitialConfig(); | 372 delegate_->FetchInitialConfig(); |
| 373 } | 373 } |
| 374 | 374 |
| 375 void ProxyConfigServiceAndroid::ProxySettingsChanged() { | 375 void ProxyConfigServiceAndroid::ProxySettingsChanged() { |
| 376 delegate_->ProxySettingsChanged(); | 376 delegate_->ProxySettingsChanged(); |
| 377 } | 377 } |
| 378 | 378 |
| 379 } // namespace net | 379 } // namespace net |
| OLD | NEW |