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

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

Issue 1135373002: Updated NetLog::ParametersCallback & all related calbacks returning value as scoped_ptr<base::Value… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « net/dns/dns_config_service.h ('k') | net/dns/dns_transaction.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 "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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 unhandled_options = d.unhandled_options; 131 unhandled_options = d.unhandled_options;
132 append_to_multi_label_name = d.append_to_multi_label_name; 132 append_to_multi_label_name = d.append_to_multi_label_name;
133 ndots = d.ndots; 133 ndots = d.ndots;
134 timeout = d.timeout; 134 timeout = d.timeout;
135 attempts = d.attempts; 135 attempts = d.attempts;
136 rotate = d.rotate; 136 rotate = d.rotate;
137 edns0 = d.edns0; 137 edns0 = d.edns0;
138 use_local_ipv6 = d.use_local_ipv6; 138 use_local_ipv6 = d.use_local_ipv6;
139 } 139 }
140 140
141 base::Value* DnsConfig::ToValue() const { 141 scoped_ptr<base::Value> DnsConfig::ToValue() const {
142 base::DictionaryValue* dict = new base::DictionaryValue(); 142 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
143 143
144 base::ListValue* list = new base::ListValue(); 144 scoped_ptr<base::ListValue> list(new base::ListValue());
145 for (size_t i = 0; i < nameservers.size(); ++i) 145 for (size_t i = 0; i < nameservers.size(); ++i)
146 list->Append(new base::StringValue(nameservers[i].ToString())); 146 list->Append(new base::StringValue(nameservers[i].ToString()));
147 dict->Set("nameservers", list); 147 dict->Set("nameservers", list.Pass());
148 148
149 list = new base::ListValue(); 149 list.reset(new base::ListValue());
150 for (size_t i = 0; i < search.size(); ++i) 150 for (size_t i = 0; i < search.size(); ++i)
151 list->Append(new base::StringValue(search[i])); 151 list->Append(new base::StringValue(search[i]));
152 dict->Set("search", list); 152 dict->Set("search", list.Pass());
153 153
154 dict->SetBoolean("unhandled_options", unhandled_options); 154 dict->SetBoolean("unhandled_options", unhandled_options);
155 dict->SetBoolean("append_to_multi_label_name", append_to_multi_label_name); 155 dict->SetBoolean("append_to_multi_label_name", append_to_multi_label_name);
156 dict->SetInteger("ndots", ndots); 156 dict->SetInteger("ndots", ndots);
157 dict->SetDouble("timeout", timeout.InSecondsF()); 157 dict->SetDouble("timeout", timeout.InSecondsF());
158 dict->SetInteger("attempts", attempts); 158 dict->SetInteger("attempts", attempts);
159 dict->SetBoolean("rotate", rotate); 159 dict->SetBoolean("rotate", rotate);
160 dict->SetBoolean("edns0", edns0); 160 dict->SetBoolean("edns0", edns0);
161 dict->SetBoolean("use_local_ipv6", use_local_ipv6); 161 dict->SetBoolean("use_local_ipv6", use_local_ipv6);
162 dict->SetInteger("num_hosts", hosts.size()); 162 dict->SetInteger("num_hosts", hosts.size());
163 163
164 return dict; 164 return dict.Pass();
165 } 165 }
166 166
167 167
168 DnsConfigService::DnsConfigService() 168 DnsConfigService::DnsConfigService()
169 : watch_failed_(false), 169 : watch_failed_(false),
170 have_config_(false), 170 have_config_(false),
171 have_hosts_(false), 171 have_hosts_(false),
172 need_update_(false), 172 need_update_(false),
173 last_sent_empty_(true) {} 173 last_sent_empty_(true) {}
174 174
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 if (watch_failed_) { 311 if (watch_failed_) {
312 // If a watch failed, the config may not be accurate, so report empty. 312 // If a watch failed, the config may not be accurate, so report empty.
313 callback_.Run(DnsConfig()); 313 callback_.Run(DnsConfig());
314 } else { 314 } else {
315 callback_.Run(dns_config_); 315 callback_.Run(dns_config_);
316 } 316 }
317 } 317 }
318 318
319 } // namespace net 319 } // namespace net
320 320
OLDNEW
« no previous file with comments | « net/dns/dns_config_service.h ('k') | net/dns/dns_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698