summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/proxy/proxy_config.cc4
-rw-r--r--net/proxy/proxy_list.cc8
-rw-r--r--net/proxy/proxy_list.h7
3 files changed, 17 insertions, 2 deletions
diff --git a/net/proxy/proxy_config.cc b/net/proxy/proxy_config.cc
index 91122dd..84b3d7a 100644
--- a/net/proxy/proxy_config.cc
+++ b/net/proxy/proxy_config.cc
@@ -19,7 +19,7 @@ void AddProxyListToValue(const char* name,
const ProxyList& proxies,
base::DictionaryValue* dict) {
if (!proxies.IsEmpty())
- dict->SetString(name, proxies.ToPacString());
+ dict->Set(name, proxies.ToValue());
}
// Split the |uri_list| on commas and add each entry to |proxy_list| in turn.
@@ -234,7 +234,7 @@ base::Value* ProxyConfig::ToValue() const {
if (proxy_rules_.type != ProxyRules::TYPE_NO_RULES) {
switch (proxy_rules_.type) {
case ProxyRules::TYPE_SINGLE_PROXY:
- AddProxyListToValue("single_proxies",
+ AddProxyListToValue("single_proxy",
proxy_rules_.single_proxies, dict);
break;
case ProxyRules::TYPE_PROXY_PER_SCHEME: {
diff --git a/net/proxy/proxy_list.cc b/net/proxy/proxy_list.cc
index 4a49501..a3ab02c 100644
--- a/net/proxy/proxy_list.cc
+++ b/net/proxy/proxy_list.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/strings/string_tokenizer.h"
#include "base/time.h"
+#include "base/values.h"
#include "net/proxy/proxy_server.h"
using base::TimeDelta;
@@ -155,6 +156,13 @@ std::string ProxyList::ToPacString() const {
return proxy_list.empty() ? std::string() : proxy_list;
}
+base::ListValue* ProxyList::ToValue() const {
+ base::ListValue* list = new base::ListValue();
+ for (size_t i = 0; i < proxies_.size(); ++i)
+ list->AppendString(proxies_[i].ToURI());
+ return list;
+}
+
bool ProxyList::Fallback(ProxyRetryInfoMap* proxy_retry_info,
const BoundNetLog& net_log) {
diff --git a/net/proxy/proxy_list.h b/net/proxy/proxy_list.h
index 70208a1..9f5fa59 100644
--- a/net/proxy/proxy_list.h
+++ b/net/proxy/proxy_list.h
@@ -12,6 +12,10 @@
#include "net/base/net_log.h"
#include "net/proxy/proxy_retry_info.h"
+namespace base {
+class ListValue;
+}
+
namespace net {
class ProxyServer;
@@ -74,6 +78,9 @@ class NET_EXPORT_PRIVATE ProxyList {
// For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy".
std::string ToPacString() const;
+ // Returns a serialized value for the list. The caller takes ownership of it.
+ base::ListValue* ToValue() const;
+
// Marks the current proxy server as bad and deletes it from the list. The
// list of known bad proxies is given by proxy_retry_info. Returns true if
// there is another server available in the list.