OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/dns/dns_config_service.h" | 5 #include "net/dns/dns_config_service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 rotate = d.rotate; | 57 rotate = d.rotate; |
58 edns0 = d.edns0; | 58 edns0 = d.edns0; |
59 use_local_ipv6 = d.use_local_ipv6; | 59 use_local_ipv6 = d.use_local_ipv6; |
60 } | 60 } |
61 | 61 |
62 std::unique_ptr<base::Value> DnsConfig::ToValue() const { | 62 std::unique_ptr<base::Value> DnsConfig::ToValue() const { |
63 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 63 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
64 | 64 |
65 base::ListValue* list = new base::ListValue(); | 65 base::ListValue* list = new base::ListValue(); |
66 for (size_t i = 0; i < nameservers.size(); ++i) | 66 for (size_t i = 0; i < nameservers.size(); ++i) |
67 list->Append(new base::StringValue(nameservers[i].ToString())); | 67 list->AppendString(nameservers[i].ToString()); |
68 dict->Set("nameservers", list); | 68 dict->Set("nameservers", list); |
69 | 69 |
70 list = new base::ListValue(); | 70 list = new base::ListValue(); |
71 for (size_t i = 0; i < search.size(); ++i) | 71 for (size_t i = 0; i < search.size(); ++i) |
72 list->Append(new base::StringValue(search[i])); | 72 list->AppendString(search[i]); |
73 dict->Set("search", list); | 73 dict->Set("search", list); |
74 | 74 |
75 dict->SetBoolean("unhandled_options", unhandled_options); | 75 dict->SetBoolean("unhandled_options", unhandled_options); |
76 dict->SetBoolean("append_to_multi_label_name", append_to_multi_label_name); | 76 dict->SetBoolean("append_to_multi_label_name", append_to_multi_label_name); |
77 dict->SetInteger("ndots", ndots); | 77 dict->SetInteger("ndots", ndots); |
78 dict->SetDouble("timeout", timeout.InSecondsF()); | 78 dict->SetDouble("timeout", timeout.InSecondsF()); |
79 dict->SetInteger("attempts", attempts); | 79 dict->SetInteger("attempts", attempts); |
80 dict->SetBoolean("rotate", rotate); | 80 dict->SetBoolean("rotate", rotate); |
81 dict->SetBoolean("edns0", edns0); | 81 dict->SetBoolean("edns0", edns0); |
82 dict->SetBoolean("use_local_ipv6", use_local_ipv6); | 82 dict->SetBoolean("use_local_ipv6", use_local_ipv6); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 if (watch_failed_) { | 227 if (watch_failed_) { |
228 // If a watch failed, the config may not be accurate, so report empty. | 228 // If a watch failed, the config may not be accurate, so report empty. |
229 callback_.Run(DnsConfig()); | 229 callback_.Run(DnsConfig()); |
230 } else { | 230 } else { |
231 callback_.Run(dns_config_); | 231 callback_.Run(dns_config_); |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 } // namespace net | 235 } // namespace net |
236 | 236 |
OLD | NEW |