| 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 #include "net/log/net_log_capture_mode.h" |
| 13 | 14 |
| 14 namespace net { | 15 namespace net { |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 std::unique_ptr<base::Value> NetLogAddressListCallback( | 19 std::unique_ptr<base::Value> NetLogAddressListCallback( |
| 19 const AddressList* address_list, | 20 const AddressList* address_list, |
| 20 NetLogCaptureMode capture_mode) { | 21 NetLogCaptureMode capture_mode) { |
| 21 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 22 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 22 std::unique_ptr<base::ListValue> list(new base::ListValue()); | 23 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 for (size_t i = 0; i < list.size(); ++i) | 86 for (size_t i = 0; i < list.size(); ++i) |
| 86 out.push_back(IPEndPoint(list[i].address(), port)); | 87 out.push_back(IPEndPoint(list[i].address(), port)); |
| 87 return out; | 88 return out; |
| 88 } | 89 } |
| 89 | 90 |
| 90 void AddressList::SetDefaultCanonicalName() { | 91 void AddressList::SetDefaultCanonicalName() { |
| 91 DCHECK(!empty()); | 92 DCHECK(!empty()); |
| 92 set_canonical_name(front().ToStringWithoutPort()); | 93 set_canonical_name(front().ToStringWithoutPort()); |
| 93 } | 94 } |
| 94 | 95 |
| 95 NetLog::ParametersCallback AddressList::CreateNetLogCallback() const { | 96 NetLogParametersCallback AddressList::CreateNetLogCallback() const { |
| 96 return base::Bind(&NetLogAddressListCallback, this); | 97 return base::Bind(&NetLogAddressListCallback, this); |
| 97 } | 98 } |
| 98 | 99 |
| 99 } // namespace net | 100 } // namespace net |
| OLD | NEW |