| 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/context_utils.h" | |
| 10 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.h" |
| 11 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 12 #include "base/bind.h" | 11 #include "base/bind.h" |
| 13 #include "base/callback.h" | 12 #include "base/callback.h" |
| 14 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 15 #include "base/location.h" | 14 #include "base/location.h" |
| 16 #include "base/logging.h" | 15 #include "base/logging.h" |
| 17 #include "base/macros.h" | 16 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 19 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 network_task_runner_(network_task_runner), | 200 network_task_runner_(network_task_runner), |
| 202 jni_task_runner_(jni_task_runner), | 201 jni_task_runner_(jni_task_runner), |
| 203 get_property_callback_(get_property_callback), | 202 get_property_callback_(get_property_callback), |
| 204 exclude_pac_url_(false) { | 203 exclude_pac_url_(false) { |
| 205 } | 204 } |
| 206 | 205 |
| 207 void SetupJNI() { | 206 void SetupJNI() { |
| 208 DCHECK(OnJNIThread()); | 207 DCHECK(OnJNIThread()); |
| 209 JNIEnv* env = AttachCurrentThread(); | 208 JNIEnv* env = AttachCurrentThread(); |
| 210 if (java_proxy_change_listener_.is_null()) { | 209 if (java_proxy_change_listener_.is_null()) { |
| 211 java_proxy_change_listener_.Reset( | 210 java_proxy_change_listener_.Reset(Java_ProxyChangeListener_create(env)); |
| 212 Java_ProxyChangeListener_create( | |
| 213 env, base::android::GetApplicationContext())); | |
| 214 CHECK(!java_proxy_change_listener_.is_null()); | 211 CHECK(!java_proxy_change_listener_.is_null()); |
| 215 } | 212 } |
| 216 Java_ProxyChangeListener_start(env, java_proxy_change_listener_, | 213 Java_ProxyChangeListener_start(env, java_proxy_change_listener_, |
| 217 reinterpret_cast<intptr_t>(&jni_delegate_)); | 214 reinterpret_cast<intptr_t>(&jni_delegate_)); |
| 218 } | 215 } |
| 219 | 216 |
| 220 void FetchInitialConfig() { | 217 void FetchInitialConfig() { |
| 221 DCHECK(OnJNIThread()); | 218 DCHECK(OnJNIThread()); |
| 222 ProxyConfig proxy_config; | 219 ProxyConfig proxy_config; |
| 223 GetLatestProxyConfigInternal(get_property_callback_, &proxy_config); | 220 GetLatestProxyConfigInternal(get_property_callback_, &proxy_config); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 network_task_runner, jni_task_runner, get_property_callback)) { | 403 network_task_runner, jni_task_runner, get_property_callback)) { |
| 407 delegate_->SetupJNI(); | 404 delegate_->SetupJNI(); |
| 408 delegate_->FetchInitialConfig(); | 405 delegate_->FetchInitialConfig(); |
| 409 } | 406 } |
| 410 | 407 |
| 411 void ProxyConfigServiceAndroid::ProxySettingsChanged() { | 408 void ProxyConfigServiceAndroid::ProxySettingsChanged() { |
| 412 delegate_->ProxySettingsChanged(); | 409 delegate_->ProxySettingsChanged(); |
| 413 } | 410 } |
| 414 | 411 |
| 415 } // namespace net | 412 } // namespace net |
| OLD | NEW |