Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: net/dns/dns_config_service.cc

Issue 2899723003: Remove raw base::DictionaryValue::Set in //net (Closed)
Patch Set: Rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/http/http_request_headers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h"
8 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
9 #include "base/values.h" 12 #include "base/values.h"
10 #include "net/base/ip_endpoint.h" 13 #include "net/base/ip_endpoint.h"
11 #include "net/base/ip_pattern.h" 14 #include "net/base/ip_pattern.h"
12 15
13 namespace net { 16 namespace net {
14 17
15 // Default values are taken from glibc resolv.h except timeout which is set to 18 // Default values are taken from glibc resolv.h except timeout which is set to
16 // |kDnsDefaultTimeoutMs|. 19 // |kDnsDefaultTimeoutMs|.
17 DnsConfig::DnsConfig() 20 DnsConfig::DnsConfig()
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 append_to_multi_label_name = d.append_to_multi_label_name; 56 append_to_multi_label_name = d.append_to_multi_label_name;
54 ndots = d.ndots; 57 ndots = d.ndots;
55 timeout = d.timeout; 58 timeout = d.timeout;
56 attempts = d.attempts; 59 attempts = d.attempts;
57 rotate = d.rotate; 60 rotate = d.rotate;
58 edns0 = d.edns0; 61 edns0 = d.edns0;
59 use_local_ipv6 = d.use_local_ipv6; 62 use_local_ipv6 = d.use_local_ipv6;
60 } 63 }
61 64
62 std::unique_ptr<base::Value> DnsConfig::ToValue() const { 65 std::unique_ptr<base::Value> DnsConfig::ToValue() const {
63 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 66 auto dict = base::MakeUnique<base::DictionaryValue>();
64 67
65 base::ListValue* list = new base::ListValue(); 68 auto list = base::MakeUnique<base::ListValue>();
66 for (size_t i = 0; i < nameservers.size(); ++i) 69 for (size_t i = 0; i < nameservers.size(); ++i)
67 list->AppendString(nameservers[i].ToString()); 70 list->AppendString(nameservers[i].ToString());
68 dict->Set("nameservers", list); 71 dict->Set("nameservers", std::move(list));
69 72
70 list = new base::ListValue(); 73 list = base::MakeUnique<base::ListValue>();
71 for (size_t i = 0; i < search.size(); ++i) 74 for (size_t i = 0; i < search.size(); ++i)
72 list->AppendString(search[i]); 75 list->AppendString(search[i]);
73 dict->Set("search", list); 76 dict->Set("search", std::move(list));
74 77
75 dict->SetBoolean("unhandled_options", unhandled_options); 78 dict->SetBoolean("unhandled_options", unhandled_options);
76 dict->SetBoolean("append_to_multi_label_name", append_to_multi_label_name); 79 dict->SetBoolean("append_to_multi_label_name", append_to_multi_label_name);
77 dict->SetInteger("ndots", ndots); 80 dict->SetInteger("ndots", ndots);
78 dict->SetDouble("timeout", timeout.InSecondsF()); 81 dict->SetDouble("timeout", timeout.InSecondsF());
79 dict->SetInteger("attempts", attempts); 82 dict->SetInteger("attempts", attempts);
80 dict->SetBoolean("rotate", rotate); 83 dict->SetBoolean("rotate", rotate);
81 dict->SetBoolean("edns0", edns0); 84 dict->SetBoolean("edns0", edns0);
82 dict->SetBoolean("use_local_ipv6", use_local_ipv6); 85 dict->SetBoolean("use_local_ipv6", use_local_ipv6);
83 dict->SetInteger("num_hosts", hosts.size()); 86 dict->SetInteger("num_hosts", hosts.size());
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 last_sent_empty_ = false; 229 last_sent_empty_ = false;
227 if (watch_failed_) { 230 if (watch_failed_) {
228 // If a watch failed, the config may not be accurate, so report empty. 231 // If a watch failed, the config may not be accurate, so report empty.
229 callback_.Run(DnsConfig()); 232 callback_.Run(DnsConfig());
230 } else { 233 } else {
231 callback_.Run(dns_config_); 234 callback_.Run(dns_config_);
232 } 235 }
233 } 236 }
234 237
235 } // namespace net 238 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_request_headers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698