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/base/address_list.h" | 5 #include "net/base/address_list.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
11 #include "net/base/sys_addrinfo.h" | 11 #include "net/base/sys_addrinfo.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 base::Value* NetLogAddressListCallback(const AddressList* address_list, | 17 base::Value* NetLogAddressListCallback(const AddressList* address_list, |
18 NetLog::LogLevel log_level) { | 18 NetLogCaptureMode capture_mode) { |
19 base::DictionaryValue* dict = new base::DictionaryValue(); | 19 base::DictionaryValue* dict = new base::DictionaryValue(); |
20 base::ListValue* list = new base::ListValue(); | 20 base::ListValue* list = new base::ListValue(); |
21 | 21 |
22 for (AddressList::const_iterator it = address_list->begin(); | 22 for (AddressList::const_iterator it = address_list->begin(); |
23 it != address_list->end(); ++it) { | 23 it != address_list->end(); ++it) { |
24 list->Append(new base::StringValue(it->ToString())); | 24 list->Append(new base::StringValue(it->ToString())); |
25 } | 25 } |
26 | 26 |
27 dict->Set("address_list", list); | 27 dict->Set("address_list", list); |
28 return dict; | 28 return dict; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 void AddressList::SetDefaultCanonicalName() { | 86 void AddressList::SetDefaultCanonicalName() { |
87 DCHECK(!empty()); | 87 DCHECK(!empty()); |
88 set_canonical_name(front().ToStringWithoutPort()); | 88 set_canonical_name(front().ToStringWithoutPort()); |
89 } | 89 } |
90 | 90 |
91 NetLog::ParametersCallback AddressList::CreateNetLogCallback() const { | 91 NetLog::ParametersCallback AddressList::CreateNetLogCallback() const { |
92 return base::Bind(&NetLogAddressListCallback, this); | 92 return base::Bind(&NetLogAddressListCallback, this); |
93 } | 93 } |
94 | 94 |
95 } // namespace net | 95 } // namespace net |
OLD | NEW |