Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: net/proxy/proxy_config_service_android.cc

Issue 1294883002: Revert of [Android] Add a java.lang.System wrapper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/dns/dns_config_service_posix.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/android/java_system.h" 7 #include <sys/system_properties.h>
8
8 #include "base/android/jni_array.h" 9 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/location.h" 15 #include "base/location.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
17 #include "base/observer_list.h" 18 #include "base/observer_list.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 rules->fallback_proxies.IsEmpty()); 149 rules->fallback_proxies.IsEmpty());
149 }; 150 };
150 151
151 void GetLatestProxyConfigInternal(const GetPropertyCallback& get_property, 152 void GetLatestProxyConfigInternal(const GetPropertyCallback& get_property,
152 ProxyConfig* config) { 153 ProxyConfig* config) {
153 if (!GetProxyRules(get_property, &config->proxy_rules())) 154 if (!GetProxyRules(get_property, &config->proxy_rules()))
154 *config = ProxyConfig::CreateDirect(); 155 *config = ProxyConfig::CreateDirect();
155 } 156 }
156 157
157 std::string GetJavaProperty(const std::string& property) { 158 std::string GetJavaProperty(const std::string& property) {
159 // Use Java System.getProperty to get configuration information.
158 // TODO(pliard): Conversion to/from UTF8 ok here? 160 // TODO(pliard): Conversion to/from UTF8 ok here?
159 return base::android::JavaSystem::GetProperty(property); 161 JNIEnv* env = AttachCurrentThread();
162 ScopedJavaLocalRef<jstring> str = ConvertUTF8ToJavaString(env, property);
163 ScopedJavaLocalRef<jstring> result =
164 Java_ProxyChangeListener_getProperty(env, str.obj());
165 return result.is_null() ?
166 std::string() : ConvertJavaStringToUTF8(env, result.obj());
160 } 167 }
161 168
162 void CreateStaticProxyConfig(const std::string& host, 169 void CreateStaticProxyConfig(const std::string& host,
163 int port, 170 int port,
164 const std::string& pac_url, 171 const std::string& pac_url,
165 const std::vector<std::string>& exclusion_list, 172 const std::vector<std::string>& exclusion_list,
166 ProxyConfig* config) { 173 ProxyConfig* config) {
167 if (!pac_url.empty()) { 174 if (!pac_url.empty()) {
168 config->set_pac_url(GURL(pac_url)); 175 config->set_pac_url(GURL(pac_url));
169 config->set_pac_mandatory(false); 176 config->set_pac_mandatory(false);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 network_task_runner, jni_task_runner, get_property_callback)) { 408 network_task_runner, jni_task_runner, get_property_callback)) {
402 delegate_->SetupJNI(); 409 delegate_->SetupJNI();
403 delegate_->FetchInitialConfig(); 410 delegate_->FetchInitialConfig();
404 } 411 }
405 412
406 void ProxyConfigServiceAndroid::ProxySettingsChanged() { 413 void ProxyConfigServiceAndroid::ProxySettingsChanged() {
407 delegate_->ProxySettingsChanged(); 414 delegate_->ProxySettingsChanged();
408 } 415 }
409 416
410 } // namespace net 417 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/dns_config_service_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698