Index: components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc |
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc |
index 770e3316cf1ddb26fe353e3174b09ec9e3e99bb0..55c48efa52bc64c46bea0a65851c8dcecd2989fa 100644 |
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc |
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc |
@@ -9,6 +9,8 @@ |
#include "base/command_line.h" |
#include "base/metrics/field_trial.h" |
#include "base/strings/string_piece.h" |
+#include "base/values.h" |
+#include "components/data_reduction_proxy/core/common/client_config_parser.h" |
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" |
#include "net/base/host_port_pair.h" |
#include "net/proxy/proxy_server.h" |
@@ -386,6 +388,39 @@ bool DataReductionProxyParams::IsDataReductionProxy( |
return false; |
} |
+void DataReductionProxyParams::PopulateConfigResponse( |
+ base::DictionaryValue* response) const { |
+ scoped_ptr<base::Value> proxy_config(new base::DictionaryValue()); |
bengr
2015/03/19 16:31:15
#include "base/memory/scoped_ptr.h"
jeremyim
2015/03/20 16:21:12
Done.
|
+ if (!holdback_) { |
+ base::DictionaryValue* proxy_config_dict = nullptr; |
+ if (!proxy_config->GetAsDictionary(&proxy_config_dict)) |
+ return; |
+ |
+ scoped_ptr<base::Value> proxy_servers(new base::ListValue()); |
+ base::ListValue* proxy_servers_list = nullptr; |
+ if (!proxy_servers->GetAsList(&proxy_servers_list)) |
+ return; |
+ |
+ proxy_servers->GetAsList(&proxy_servers_list); |
+ scoped_ptr<base::DictionaryValue> server(new base::DictionaryValue()); |
+ |
+ server->SetString("scheme", GetSchemeString(origin_.scheme())); |
bengr
2015/03/19 16:31:15
It might be worthwhile to define constants for "sc
jeremyim
2015/03/20 16:21:12
Done.
|
+ server->SetString("host", origin_.host_port_pair().host()); |
+ server->SetInteger("port", origin_.host_port_pair().port()); |
+ proxy_servers_list->Append(server.release()); |
+ server.reset(new base::DictionaryValue()); |
+ |
+ server->SetString("scheme", GetSchemeString(fallback_origin_.scheme())); |
+ server->SetString("host", fallback_origin_.host_port_pair().host()); |
+ server->SetInteger("port", fallback_origin_.host_port_pair().port()); |
+ proxy_servers_list->Append(server.release()); |
+ |
+ proxy_config_dict->Set("httpProxyServers", proxy_servers.Pass()); |
+ } |
+ |
+ response->Set("proxyConfig", proxy_config.Pass()); |
+} |
+ |
// Returns the data reduction proxy primary origin. |
const net::ProxyServer& DataReductionProxyParams::origin() const { |
return origin_; |