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

Side by Side Diff: chrome/browser/chromeos/proxy_cros_settings_provider.cc

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/proxy_cros_settings_provider.h" 5 #include "chrome/browser/chromeos/proxy_cros_settings_provider.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chromeos/cros_settings.h" 10 #include "chrome/browser/chromeos/cros_settings.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 Value* data = NULL; 240 Value* data = NULL;
241 chromeos::ProxyConfigServiceImpl* config_service = GetConfigService(); 241 chromeos::ProxyConfigServiceImpl* config_service = GetConfigService();
242 chromeos::ProxyConfigServiceImpl::ProxyConfig config; 242 chromeos::ProxyConfigServiceImpl::ProxyConfig config;
243 config_service->UIGetProxyConfig(&config); 243 config_service->UIGetProxyConfig(&config);
244 244
245 if (path == kProxyPacUrl) { 245 if (path == kProxyPacUrl) {
246 // Only show pacurl for pac-script mode. 246 // Only show pacurl for pac-script mode.
247 if (config.mode == 247 if (config.mode ==
248 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PAC_SCRIPT && 248 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PAC_SCRIPT &&
249 config.automatic_proxy.pac_url.is_valid()) { 249 config.automatic_proxy.pac_url.is_valid()) {
250 data = Value::CreateStringValue(config.automatic_proxy.pac_url.spec()); 250 data = base::StringValue::New(config.automatic_proxy.pac_url.spec());
251 } 251 }
252 found = true; 252 found = true;
253 } else if (path == kProxySingleHttp) { 253 } else if (path == kProxySingleHttp) {
254 data = CreateServerHostValue(config.single_proxy); 254 data = CreateServerHostValue(config.single_proxy);
255 found = true; 255 found = true;
256 } else if (path == kProxySingleHttpPort) { 256 } else if (path == kProxySingleHttpPort) {
257 data = CreateServerPortValue(config.single_proxy); 257 data = CreateServerPortValue(config.single_proxy);
258 found = true; 258 found = true;
259 } else if (path == kProxyHttpUrl) { 259 } else if (path == kProxyHttpUrl) {
260 data = CreateServerHostValue(config.http_proxy); 260 data = CreateServerHostValue(config.http_proxy);
261 found = true; 261 found = true;
262 } else if (path == kProxyHttpsUrl) { 262 } else if (path == kProxyHttpsUrl) {
263 data = CreateServerHostValue(config.https_proxy); 263 data = CreateServerHostValue(config.https_proxy);
264 found = true; 264 found = true;
265 } else if (path == kProxyType) { 265 } else if (path == kProxyType) {
266 if (config.mode == 266 if (config.mode ==
267 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_AUTO_DETECT || 267 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_AUTO_DETECT ||
268 config.mode == 268 config.mode ==
269 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PAC_SCRIPT) { 269 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PAC_SCRIPT) {
270 data = Value::CreateIntegerValue(3); 270 data = base::NumberValue::New(3);
271 } else if (config.mode == 271 } else if (config.mode ==
272 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_SINGLE_PROXY || 272 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_SINGLE_PROXY ||
273 config.mode == 273 config.mode ==
274 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PROXY_PER_SCHEME) { 274 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PROXY_PER_SCHEME) {
275 data = Value::CreateIntegerValue(2); 275 data = base::NumberValue::New(2);
276 } else { 276 } else {
277 data = Value::CreateIntegerValue(1); 277 data = base::NumberValue::New(1);
278 } 278 }
279 found = true; 279 found = true;
280 } else if (path == kProxySingle) { 280 } else if (path == kProxySingle) {
281 data = Value::CreateBooleanValue(config.mode == 281 data = base::BooleanValue::New(config.mode ==
282 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_SINGLE_PROXY); 282 chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_SINGLE_PROXY);
283 found = true; 283 found = true;
284 } else if (path == kProxyFtpUrl) { 284 } else if (path == kProxyFtpUrl) {
285 data = CreateServerHostValue(config.ftp_proxy); 285 data = CreateServerHostValue(config.ftp_proxy);
286 found = true; 286 found = true;
287 } else if (path == kProxySocks) { 287 } else if (path == kProxySocks) {
288 data = CreateServerHostValue(config.socks_proxy); 288 data = CreateServerHostValue(config.socks_proxy);
289 found = true; 289 found = true;
290 } else if (path == kProxyHttpPort) { 290 } else if (path == kProxyHttpPort) {
291 data = CreateServerPortValue(config.http_proxy); 291 data = CreateServerPortValue(config.http_proxy);
292 found = true; 292 found = true;
293 } else if (path == kProxyHttpsPort) { 293 } else if (path == kProxyHttpsPort) {
294 data = CreateServerPortValue(config.https_proxy); 294 data = CreateServerPortValue(config.https_proxy);
295 found = true; 295 found = true;
296 } else if (path == kProxyFtpPort) { 296 } else if (path == kProxyFtpPort) {
297 data = CreateServerPortValue(config.ftp_proxy); 297 data = CreateServerPortValue(config.ftp_proxy);
298 found = true; 298 found = true;
299 } else if (path == kProxySocksPort) { 299 } else if (path == kProxySocksPort) {
300 data = CreateServerPortValue(config.socks_proxy); 300 data = CreateServerPortValue(config.socks_proxy);
301 found = true; 301 found = true;
302 } else if (path == kProxyIgnoreList) { 302 } else if (path == kProxyIgnoreList) {
303 ListValue* list = new ListValue(); 303 ListValue* list = new ListValue();
304 net::ProxyBypassRules::RuleList bypass_rules = config.bypass_rules.rules(); 304 net::ProxyBypassRules::RuleList bypass_rules = config.bypass_rules.rules();
305 for (size_t x = 0; x < bypass_rules.size(); x++) { 305 for (size_t x = 0; x < bypass_rules.size(); x++) {
306 list->Append(Value::CreateStringValue(bypass_rules[x]->ToString())); 306 list->Append(base::StringValue::New(bypass_rules[x]->ToString()));
307 } 307 }
308 *out_value = list; 308 *out_value = list;
309 return true; 309 return true;
310 } 310 }
311 if (found) { 311 if (found) {
312 DictionaryValue* dict = new DictionaryValue; 312 DictionaryValue* dict = new DictionaryValue;
313 if (!data) 313 if (!data)
314 data = Value::CreateStringValue(""); 314 data = base::StringValue::New("");
315 dict->Set("value", data); 315 dict->Set("value", data);
316 dict->SetBoolean("managed", managed); 316 dict->SetBoolean("managed", managed);
317 *out_value = dict; 317 *out_value = dict;
318 return true; 318 return true;
319 } else { 319 } else {
320 *out_value = NULL; 320 *out_value = NULL;
321 return false; 321 return false;
322 } 322 }
323 } 323 }
324 324
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 host = proxy.server.host_port_pair().host(); 357 host = proxy.server.host_port_pair().host();
358 if (host.length() == 0 && port == 0) 358 if (host.length() == 0 && port == 0)
359 return net::ProxyServer(); 359 return net::ProxyServer();
360 net::HostPortPair host_port_pair(host, port); 360 net::HostPortPair host_port_pair(host, port);
361 return net::ProxyServer(scheme, host_port_pair); 361 return net::ProxyServer(scheme, host_port_pair);
362 } 362 }
363 363
364 Value* ProxyCrosSettingsProvider::CreateServerHostValue( 364 Value* ProxyCrosSettingsProvider::CreateServerHostValue(
365 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const { 365 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const {
366 return proxy.server.is_valid() ? 366 return proxy.server.is_valid() ?
367 Value::CreateStringValue(proxy.server.host_port_pair().host()) : 367 base::StringValue::New(proxy.server.host_port_pair().host()) :
368 NULL; 368 NULL;
369 } 369 }
370 370
371 Value* ProxyCrosSettingsProvider::CreateServerPortValue( 371 Value* ProxyCrosSettingsProvider::CreateServerPortValue(
372 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const { 372 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const {
373 return proxy.server.is_valid() ? 373 return proxy.server.is_valid() ?
374 Value::CreateIntegerValue(proxy.server.host_port_pair().port()) : 374 base::NumberValue::New(proxy.server.host_port_pair().port()) :
375 NULL; 375 NULL;
376 } 376 }
377 377
378 } // namespace chromeos 378 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager.cc ('k') | chrome/browser/chromeos/user_cros_settings_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698