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

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

Issue 8091002: PART2: Make SignedSettings use proper Value types instead of string all around the place. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments and fixed an issue with user whitelist checks. Created 9 years, 2 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_provider.cc
diff --git a/chrome/browser/chromeos/proxy_cros_settings_provider.cc b/chrome/browser/chromeos/proxy_cros_settings_provider.cc
index 7faf0d47543f5015260a9b6496d584d97fdcc304..0c3745b865689a56a746185e568b1d54558bd68f 100644
--- a/chrome/browser/chromeos/proxy_cros_settings_provider.cc
+++ b/chrome/browser/chromeos/proxy_cros_settings_provider.cc
@@ -70,11 +70,7 @@ const std::string& ProxyCrosSettingsProvider::GetCurrentNetworkName() const {
}
void ProxyCrosSettingsProvider::DoSet(const std::string& path,
- Value* in_value) {
- if (!in_value) {
- return;
- }
-
+ const base::Value& in_value) {
chromeos::ProxyConfigServiceImpl* config_service = GetConfigService();
// Retrieve proxy config.
chromeos::ProxyConfigServiceImpl::ProxyConfig config;
@@ -82,7 +78,7 @@ void ProxyCrosSettingsProvider::DoSet(const std::string& path,
if (path == kProxyPacUrl) {
std::string val;
- if (in_value->GetAsString(&val)) {
+ if (in_value.GetAsString(&val)) {
GURL url(val);
if (url.is_valid())
config_service->UISetProxyConfigToPACScript(url);
@@ -91,47 +87,47 @@ void ProxyCrosSettingsProvider::DoSet(const std::string& path,
}
} else if (path == kProxySingleHttp) {
std::string val;
- if (in_value->GetAsString(&val)) {
+ if (in_value.GetAsString(&val)) {
config_service->UISetProxyConfigToSingleProxy(CreateProxyServerFromHost(
val, config.single_proxy, net::ProxyServer::SCHEME_HTTP));
}
} else if (path == kProxySingleHttpPort) {
int val;
- if (in_value->GetAsInteger(&val)) {
+ if (in_value.GetAsInteger(&val)) {
config_service->UISetProxyConfigToSingleProxy(CreateProxyServerFromPort(
val, config.single_proxy, net::ProxyServer::SCHEME_HTTP));
}
} else if (path == kProxyHttpUrl) {
std::string val;
- if (in_value->GetAsString(&val)) {
+ if (in_value.GetAsString(&val)) {
config_service->UISetProxyConfigToProxyPerScheme("http",
CreateProxyServerFromHost(
val, config.http_proxy, net::ProxyServer::SCHEME_HTTP));
}
} else if (path == kProxyHttpPort) {
int val;
- if (in_value->GetAsInteger(&val)) {
+ if (in_value.GetAsInteger(&val)) {
config_service->UISetProxyConfigToProxyPerScheme("http",
CreateProxyServerFromPort(
val, config.http_proxy, net::ProxyServer::SCHEME_HTTP));
}
} else if (path == kProxyHttpsUrl) {
std::string val;
- if (in_value->GetAsString(&val)) {
+ if (in_value.GetAsString(&val)) {
config_service->UISetProxyConfigToProxyPerScheme("https",
CreateProxyServerFromHost(
val, config.https_proxy, net::ProxyServer::SCHEME_HTTP));
}
} else if (path == kProxyHttpsPort) {
int val;
- if (in_value->GetAsInteger(&val)) {
+ if (in_value.GetAsInteger(&val)) {
config_service->UISetProxyConfigToProxyPerScheme("https",
CreateProxyServerFromPort(
val, config.https_proxy, net::ProxyServer::SCHEME_HTTP));
}
} else if (path == kProxyType) {
int val;
- if (in_value->GetAsInteger(&val)) {
+ if (in_value.GetAsInteger(&val)) {
if (val == 3) {
if (config.automatic_proxy.pac_url.is_valid())
config_service->UISetProxyConfigToPACScript(
@@ -175,7 +171,7 @@ void ProxyCrosSettingsProvider::DoSet(const std::string& path,
}
} else if (path == kProxySingle) {
bool val;
- if (in_value->GetAsBoolean(&val)) {
+ if (in_value.GetAsBoolean(&val)) {
if (val)
config_service->UISetProxyConfigToSingleProxy(
config.single_proxy.server);
@@ -185,21 +181,21 @@ void ProxyCrosSettingsProvider::DoSet(const std::string& path,
}
} else if (path == kProxyFtpUrl) {
std::string val;
- if (in_value->GetAsString(&val)) {
+ if (in_value.GetAsString(&val)) {
config_service->UISetProxyConfigToProxyPerScheme("ftp",
CreateProxyServerFromHost(
val, config.ftp_proxy, net::ProxyServer::SCHEME_HTTP));
}
} else if (path == kProxyFtpPort) {
int val;
- if (in_value->GetAsInteger(&val)) {
+ if (in_value.GetAsInteger(&val)) {
config_service->UISetProxyConfigToProxyPerScheme("ftp",
CreateProxyServerFromPort(
val, config.ftp_proxy, net::ProxyServer::SCHEME_HTTP));
}
} else if (path == kProxySocks) {
std::string val;
- if (in_value->GetAsString(&val)) {
+ if (in_value.GetAsString(&val)) {
config_service->UISetProxyConfigToProxyPerScheme("socks",
CreateProxyServerFromHost(val, config.socks_proxy,
StartsWithASCII(val, "socks5://", false) ?
@@ -208,7 +204,7 @@ void ProxyCrosSettingsProvider::DoSet(const std::string& path,
}
} else if (path == kProxySocksPort) {
int val;
- if (in_value->GetAsInteger(&val)) {
+ if (in_value.GetAsInteger(&val)) {
std::string host = config.socks_proxy.server.host_port_pair().host();
config_service->UISetProxyConfigToProxyPerScheme("socks",
CreateProxyServerFromPort(val, config.socks_proxy,
@@ -218,11 +214,12 @@ void ProxyCrosSettingsProvider::DoSet(const std::string& path,
}
} else if (path == kProxyIgnoreList) {
net::ProxyBypassRules bypass_rules;
- if (in_value->GetType() == Value::TYPE_LIST) {
- const ListValue* list_value = static_cast<const ListValue*>(in_value);
- for (size_t x = 0; x < list_value->GetSize(); x++) {
+ if (in_value.GetType() == base::Value::TYPE_LIST) {
+ const base::ListValue& list_value =
+ static_cast<const base::ListValue&>(in_value);
+ for (size_t x = 0; x < list_value.GetSize(); x++) {
std::string val;
- if (list_value->GetString(x, &val)) {
+ if (list_value.GetString(x, &val)) {
bypass_rules.AddRuleFromString(val);
}
}
@@ -233,7 +230,7 @@ void ProxyCrosSettingsProvider::DoSet(const std::string& path,
const Value* ProxyCrosSettingsProvider::Get(const std::string& path) const {
bool found = false;
- Value* data = NULL;
+ base::Value* data = NULL;
chromeos::ProxyConfigServiceImpl* config_service = GetConfigService();
chromeos::ProxyConfigServiceImpl::ProxyConfig config;
config_service->UIGetProxyConfig(&config);

Powered by Google App Engine
This is Rietveld 408576698