diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-29 00:56:24 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-29 00:56:24 +0000 |
commit | 17e92030ad8eef809db6563d91a1328f96fbd24d (patch) | |
tree | 6a710fc10ea4bf34a3f075a48558972a41579c5a /net/dns | |
parent | b5bebc4add4d00422d0484701ffd230c6ff64df5 (diff) | |
download | chromium_src-17e92030ad8eef809db6563d91a1328f96fbd24d.zip chromium_src-17e92030ad8eef809db6563d91a1328f96fbd24d.tar.gz chromium_src-17e92030ad8eef809db6563d91a1328f96fbd24d.tar.bz2 |
Add DNS configuration information to about:net-internals#dns,
including log dumps, when Chrome's DNS resolver is enabled.
BUG=117258
Review URL: http://codereview.chromium.org/9854026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129545 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/dns')
-rw-r--r-- | net/dns/dns_config_service.cc | 25 | ||||
-rw-r--r-- | net/dns/dns_config_service.h | 10 |
2 files changed, 34 insertions, 1 deletions
diff --git a/net/dns/dns_config_service.cc b/net/dns/dns_config_service.cc index bd42b64..ffd5fe9 100644 --- a/net/dns/dns_config_service.cc +++ b/net/dns/dns_config_service.cc @@ -5,6 +5,7 @@ #include "net/dns/dns_config_service.h" #include "base/logging.h" +#include "base/values.h" #include "net/base/ip_endpoint.h" namespace net { @@ -46,6 +47,30 @@ void DnsConfig::CopyIgnoreHosts(const DnsConfig& d) { edns0 = d.edns0; } +base::Value* DnsConfig::ToValue() const { + DictionaryValue* dict = new DictionaryValue(); + + ListValue* list = new ListValue(); + for (size_t i = 0; i < nameservers.size(); ++i) + list->Append(Value::CreateStringValue(nameservers[i].ToString())); + dict->Set("nameservers", list); + + list = new ListValue(); + for (size_t i = 0; i < search.size(); ++i) + list->Append(Value::CreateStringValue(search[i])); + dict->Set("search", list); + + dict->SetBoolean("append_to_multi_label_name", append_to_multi_label_name); + dict->SetInteger("ndots", ndots); + dict->SetDouble("timeout", timeout.InSecondsF()); + dict->SetInteger("attempts", attempts); + dict->SetBoolean("rotate", rotate); + dict->SetBoolean("edns0", edns0); + dict->SetInteger("num_hosts", hosts.size()); + + return dict; +} + DnsConfigService::DnsConfigService() : have_config_(false), diff --git a/net/dns/dns_config_service.h b/net/dns/dns_config_service.h index e5794c2..8e7597d 100644 --- a/net/dns/dns_config_service.h +++ b/net/dns/dns_config_service.h @@ -19,6 +19,10 @@ #include "net/base/net_export.h" #include "net/dns/dns_hosts.h" +namespace base { +class Value; +} + namespace net { // DnsConfig stores configuration of the system resolver. @@ -32,6 +36,11 @@ struct NET_EXPORT_PRIVATE DnsConfig { void CopyIgnoreHosts(const DnsConfig& src); + // Returns a Value representation of |this|. Caller takes ownership of the + // returned Value. For performance reasons, the Value only contains the + // number of hosts rather than the full list. + base::Value* ToValue() const; + bool IsValid() const { return !nameservers.empty(); } @@ -123,7 +132,6 @@ class NET_EXPORT_PRIVATE DnsConfigService DISALLOW_COPY_AND_ASSIGN(DnsConfigService); }; - } // namespace net #endif // NET_DNS_DNS_CONFIG_SERVICE_H_ |