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

Unified Diff: chrome/browser/chromeos/proxy_cros_settings_parser.cc

Issue 10834109: Consistently decorate pref values sent to the settings UI code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Silly me, made a CrOS-only change and tested it on a desktop build... Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/proxy_cros_settings_parser.cc
diff --git a/chrome/browser/chromeos/proxy_cros_settings_parser.cc b/chrome/browser/chromeos/proxy_cros_settings_parser.cc
index 7ec1bf2b4702aeb02fd37fb6f641175f590f4939..158db4e31260579671ba9369112d801765bb4de9 100644
--- a/chrome/browser/chromeos/proxy_cros_settings_parser.cc
+++ b/chrome/browser/chromeos/proxy_cros_settings_parser.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -286,8 +286,6 @@ void SetProxyPrefValue(Profile* profile,
bool GetProxyPrefValue(Profile* profile,
const std::string& path,
base::Value** out_value) {
- bool found = false;
- bool managed = false;
std::string controlled_by;
base::Value* data = NULL;
chromeos::ProxyConfigServiceImpl* config_service =
@@ -303,19 +301,14 @@ bool GetProxyPrefValue(Profile* profile,
data =
base::Value::CreateStringValue(config.automatic_proxy.pac_url.spec());
}
- found = true;
} else if (path == kProxySingleHttp) {
data = CreateServerHostValue(config.single_proxy);
- found = true;
} else if (path == kProxySingleHttpPort) {
data = CreateServerPortValue(config.single_proxy);
- found = true;
} else if (path == kProxyHttpUrl) {
data = CreateServerHostValue(config.http_proxy);
- found = true;
} else if (path == kProxyHttpsUrl) {
data = CreateServerHostValue(config.https_proxy);
- found = true;
} else if (path == kProxyType) {
if (config.mode ==
chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_AUTO_DETECT ||
@@ -345,54 +338,46 @@ bool GetProxyPrefValue(Profile* profile,
controlled_by = "enableSharedProxiesBannerText";
break;
}
- found = true;
} else if (path == kProxySingle) {
data = base::Value::CreateBooleanValue(config.mode ==
chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_SINGLE_PROXY);
- found = true;
} else if (path == kProxyFtpUrl) {
data = CreateServerHostValue(config.ftp_proxy);
- found = true;
} else if (path == kProxySocks) {
data = CreateServerHostValue(config.socks_proxy);
- found = true;
} else if (path == kProxyHttpPort) {
data = CreateServerPortValue(config.http_proxy);
- found = true;
} else if (path == kProxyHttpsPort) {
data = CreateServerPortValue(config.https_proxy);
- found = true;
} else if (path == kProxyFtpPort) {
data = CreateServerPortValue(config.ftp_proxy);
- found = true;
} else if (path == kProxySocksPort) {
data = CreateServerPortValue(config.socks_proxy);
- found = true;
} else if (path == kProxyIgnoreList) {
ListValue* list = new ListValue();
net::ProxyBypassRules::RuleList bypass_rules = config.bypass_rules.rules();
for (size_t x = 0; x < bypass_rules.size(); x++) {
list->Append(base::Value::CreateStringValue(bypass_rules[x]->ToString()));
}
- *out_value = list;
- return true;
- }
- if (found) {
- DictionaryValue* dict = new DictionaryValue;
- if (!data)
- data = base::Value::CreateStringValue("");
- dict->Set("value", data);
- dict->SetBoolean("managed", managed);
- if (path == kProxyType) {
- dict->SetString("controlledBy", controlled_by);
- dict->SetBoolean("disabled", !config.user_modifiable);
- }
- *out_value = dict;
- return true;
+ data = list;
} else {
*out_value = NULL;
return false;
}
+
+ // Decorate pref value as CoreOptionsHandler::CreateValueForPref() does.
+ DictionaryValue* dict = new DictionaryValue;
+ if (!data)
+ data = base::Value::CreateStringValue("");
+ dict->Set("value", data);
+ if (path == kProxyType) {
+ dict->SetString("controlledBy", controlled_by);
+ dict->SetBoolean("disabled", !config.user_modifiable);
+ } else {
+ dict->SetBoolean("disabled", false);
+ }
+ *out_value = dict;
+ return true;
}
} // namespace proxy_cros_settings_parser

Powered by Google App Engine
This is Rietveld 408576698