| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "net/base/sys_addrinfo.h" | 12 #include "net/base/sys_addrinfo.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 std::unique_ptr<base::Value> NetLogAddressListCallback( | 18 std::unique_ptr<base::Value> NetLogAddressListCallback( |
| 19 const AddressList* address_list, | 19 const AddressList* address_list, |
| 20 NetLogCaptureMode capture_mode) { | 20 NetLogCaptureMode capture_mode) { |
| 21 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 21 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 22 std::unique_ptr<base::ListValue> list(new base::ListValue()); | 22 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
| 23 | 23 |
| 24 for (AddressList::const_iterator it = address_list->begin(); | 24 for (AddressList::const_iterator it = address_list->begin(); |
| 25 it != address_list->end(); ++it) { | 25 it != address_list->end(); ++it) { |
| 26 list->Append(new base::StringValue(it->ToString())); | 26 list->AppendString(it->ToString()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 dict->Set("address_list", std::move(list)); | 29 dict->Set("address_list", std::move(list)); |
| 30 return std::move(dict); | 30 return std::move(dict); |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 AddressList::AddressList() {} | 35 AddressList::AddressList() {} |
| 36 | 36 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 void AddressList::SetDefaultCanonicalName() { | 90 void AddressList::SetDefaultCanonicalName() { |
| 91 DCHECK(!empty()); | 91 DCHECK(!empty()); |
| 92 set_canonical_name(front().ToStringWithoutPort()); | 92 set_canonical_name(front().ToStringWithoutPort()); |
| 93 } | 93 } |
| 94 | 94 |
| 95 NetLog::ParametersCallback AddressList::CreateNetLogCallback() const { | 95 NetLog::ParametersCallback AddressList::CreateNetLogCallback() const { |
| 96 return base::Bind(&NetLogAddressListCallback, this); | 96 return base::Bind(&NetLogAddressListCallback, this); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace net | 99 } // namespace net |
| OLD | NEW |