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