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

Unified Diff: chrome/browser/extensions/api/proxy/proxy_api_helpers.cc

Issue 12315019: Change ProxyRules to handle ProxyLists rather than just single ProxyServer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 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/extensions/api/proxy/proxy_api_helpers.cc
diff --git a/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc b/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc
index 11e45fd2e665abf996652412096408c67e55ec4e..e88ff2f2c267fba44704a77da8f46a1dbfcf6036 100644
--- a/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc
+++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc
@@ -377,28 +377,31 @@ DictionaryValue* CreateProxyRulesDict(
case net::ProxyConfig::ProxyRules::TYPE_NO_RULES:
return NULL;
case net::ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY:
- if (rules.single_proxy.is_valid()) {
+ if (!rules.single_proxies.IsEmpty()) {
extension_proxy_rules->Set(keys::field_name[keys::SCHEME_ALL],
- CreateProxyServerDict(rules.single_proxy));
+ CreateProxyServerDict(rules.single_proxies));
}
break;
case net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME:
- if (rules.proxy_for_http.is_valid()) {
- extension_proxy_rules->Set(keys::field_name[keys::SCHEME_HTTP],
- CreateProxyServerDict(rules.proxy_for_http));
+ if (!rules.proxies_for_http.IsEmpty()) {
+ extension_proxy_rules->Set(
+ keys::field_name[keys::SCHEME_HTTP],
+ CreateProxyServerDict(rules.proxies_for_http));
}
- if (rules.proxy_for_https.is_valid()) {
+ if (!rules.proxies_for_https.IsEmpty()) {
extension_proxy_rules->Set(
keys::field_name[keys::SCHEME_HTTPS],
- CreateProxyServerDict(rules.proxy_for_https));
+ CreateProxyServerDict(rules.proxies_for_https));
}
- if (rules.proxy_for_ftp.is_valid()) {
- extension_proxy_rules->Set(keys::field_name[keys::SCHEME_FTP],
- CreateProxyServerDict(rules.proxy_for_ftp));
+ if (!rules.proxies_for_ftp.IsEmpty()) {
+ extension_proxy_rules->Set(
+ keys::field_name[keys::SCHEME_FTP],
+ CreateProxyServerDict(rules.proxies_for_ftp));
}
- if (rules.fallback_proxy.is_valid()) {
- extension_proxy_rules->Set(keys::field_name[keys::SCHEME_FALLBACK],
- CreateProxyServerDict(rules.fallback_proxy));
+ if (!rules.fallback_proxies.IsEmpty()) {
+ extension_proxy_rules->Set(
+ keys::field_name[keys::SCHEME_FALLBACK],
+ CreateProxyServerDict(rules.fallback_proxies));
}
break;
}
@@ -420,7 +423,9 @@ DictionaryValue* CreateProxyRulesDict(
return extension_proxy_rules.release();
}
-DictionaryValue* CreateProxyServerDict(const net::ProxyServer& proxy) {
+DictionaryValue* CreateProxyServerDict(const net::ProxyList& proxies) {
+ CHECK(proxies.size() == 1);
battre 2013/03/07 10:18:54 I think this can cause trouble. See CommandLinePre
marq_use_my_chromium_address 2013/03/07 20:26:15 Yeah, this is bad. Removed.
+ net::ProxyServer proxy = proxies.Get();
scoped_ptr<DictionaryValue> out(new DictionaryValue);
switch (proxy.scheme()) {
case net::ProxyServer::SCHEME_HTTP:
« no previous file with comments | « chrome/browser/extensions/api/proxy/proxy_api_helpers.h ('k') | chrome/browser/importer/firefox_proxy_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698