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 "chrome/browser/chromeos/proxy_cros_settings_parser.h" | 5 #include "chrome/browser/chromeos/proxy_cros_settings_parser.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } else if (path == kProxyHttpsPort) { | 351 } else if (path == kProxyHttpsPort) { |
352 data = CreateServerPortValue(config.https_proxy); | 352 data = CreateServerPortValue(config.https_proxy); |
353 } else if (path == kProxyFtpPort) { | 353 } else if (path == kProxyFtpPort) { |
354 data = CreateServerPortValue(config.ftp_proxy); | 354 data = CreateServerPortValue(config.ftp_proxy); |
355 } else if (path == kProxySocksPort) { | 355 } else if (path == kProxySocksPort) { |
356 data = CreateServerPortValue(config.socks_proxy); | 356 data = CreateServerPortValue(config.socks_proxy); |
357 } else if (path == kProxyIgnoreList) { | 357 } else if (path == kProxyIgnoreList) { |
358 base::ListValue* list = new base::ListValue(); | 358 base::ListValue* list = new base::ListValue(); |
359 net::ProxyBypassRules::RuleList bypass_rules = config.bypass_rules.rules(); | 359 net::ProxyBypassRules::RuleList bypass_rules = config.bypass_rules.rules(); |
360 for (size_t x = 0; x < bypass_rules.size(); x++) | 360 for (size_t x = 0; x < bypass_rules.size(); x++) |
361 list->Append(new base::StringValue(bypass_rules[x]->ToString())); | 361 list->AppendString(bypass_rules[x]->ToString()); |
362 data = list; | 362 data = list; |
363 } else { | 363 } else { |
364 *out_value = NULL; | 364 *out_value = NULL; |
365 return false; | 365 return false; |
366 } | 366 } |
367 | 367 |
368 // Decorate pref value as CoreOptionsHandler::CreateValueForPref() does. | 368 // Decorate pref value as CoreOptionsHandler::CreateValueForPref() does. |
369 base::DictionaryValue* dict = new base::DictionaryValue; | 369 base::DictionaryValue* dict = new base::DictionaryValue; |
370 if (!data) | 370 if (!data) |
371 data = new base::StringValue(""); | 371 data = new base::StringValue(""); |
372 dict->Set("value", data); | 372 dict->Set("value", data); |
373 if (path == kProxyType) { | 373 if (path == kProxyType) { |
374 if (!controlled_by.empty()) | 374 if (!controlled_by.empty()) |
375 dict->SetString("controlledBy", controlled_by); | 375 dict->SetString("controlledBy", controlled_by); |
376 dict->SetBoolean("disabled", !config.user_modifiable); | 376 dict->SetBoolean("disabled", !config.user_modifiable); |
377 } else { | 377 } else { |
378 dict->SetBoolean("disabled", false); | 378 dict->SetBoolean("disabled", false); |
379 } | 379 } |
380 *out_value = dict; | 380 *out_value = dict; |
381 return true; | 381 return true; |
382 } | 382 } |
383 | 383 |
384 } // namespace proxy_cros_settings_parser | 384 } // namespace proxy_cros_settings_parser |
385 | 385 |
386 } // namespace chromeos | 386 } // namespace chromeos |
OLD | NEW |