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.h" | 8 #include "base/metrics/histogram.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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 search = d.search; | 44 search = d.search; |
45 append_to_multi_label_name = d.append_to_multi_label_name; | 45 append_to_multi_label_name = d.append_to_multi_label_name; |
46 ndots = d.ndots; | 46 ndots = d.ndots; |
47 timeout = d.timeout; | 47 timeout = d.timeout; |
48 attempts = d.attempts; | 48 attempts = d.attempts; |
49 rotate = d.rotate; | 49 rotate = d.rotate; |
50 edns0 = d.edns0; | 50 edns0 = d.edns0; |
51 } | 51 } |
52 | 52 |
53 base::Value* DnsConfig::ToValue() const { | 53 base::Value* DnsConfig::ToValue() const { |
54 DictionaryValue* dict = new DictionaryValue(); | 54 base::DictionaryValue* dict = new base::DictionaryValue(); |
55 | 55 |
56 ListValue* list = new ListValue(); | 56 base::ListValue* list = new base::ListValue(); |
57 for (size_t i = 0; i < nameservers.size(); ++i) | 57 for (size_t i = 0; i < nameservers.size(); ++i) |
58 list->Append(Value::CreateStringValue(nameservers[i].ToString())); | 58 list->Append(new base::StringValue(nameservers[i].ToString())); |
59 dict->Set("nameservers", list); | 59 dict->Set("nameservers", list); |
60 | 60 |
61 list = new ListValue(); | 61 list = new base::ListValue(); |
62 for (size_t i = 0; i < search.size(); ++i) | 62 for (size_t i = 0; i < search.size(); ++i) |
63 list->Append(Value::CreateStringValue(search[i])); | 63 list->Append(new base::StringValue(search[i])); |
64 dict->Set("search", list); | 64 dict->Set("search", list); |
65 | 65 |
66 dict->SetBoolean("append_to_multi_label_name", append_to_multi_label_name); | 66 dict->SetBoolean("append_to_multi_label_name", append_to_multi_label_name); |
67 dict->SetInteger("ndots", ndots); | 67 dict->SetInteger("ndots", ndots); |
68 dict->SetDouble("timeout", timeout.InSecondsF()); | 68 dict->SetDouble("timeout", timeout.InSecondsF()); |
69 dict->SetInteger("attempts", attempts); | 69 dict->SetInteger("attempts", attempts); |
70 dict->SetBoolean("rotate", rotate); | 70 dict->SetBoolean("rotate", rotate); |
71 dict->SetBoolean("edns0", edns0); | 71 dict->SetBoolean("edns0", edns0); |
72 dict->SetInteger("num_hosts", hosts.size()); | 72 dict->SetInteger("num_hosts", hosts.size()); |
73 | 73 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 if (watch_failed_) { | 217 if (watch_failed_) { |
218 // If a watch failed, the config may not be accurate, so report empty. | 218 // If a watch failed, the config may not be accurate, so report empty. |
219 callback_.Run(DnsConfig()); | 219 callback_.Run(DnsConfig()); |
220 } else { | 220 } else { |
221 callback_.Run(dns_config_); | 221 callback_.Run(dns_config_); |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 } // namespace net | 225 } // namespace net |
226 | 226 |
OLD | NEW |