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/socket/socket_net_log_params.h" | 5 #include "net/socket/socket_net_log_params.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "net/base/host_port_pair.h" | 11 #include "net/base/host_port_pair.h" |
12 #include "net/base/ip_endpoint.h" | 12 #include "net/base/ip_endpoint.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> NetLogSocketErrorCallback( | 19 std::unique_ptr<base::Value> NetLogSocketErrorCallback( |
19 int net_error, | 20 int net_error, |
20 int os_error, | 21 int os_error, |
21 NetLogCaptureMode /* capture_mode */) { | 22 NetLogCaptureMode /* capture_mode */) { |
22 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 23 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
(...skipping 25 matching lines...) Expand all Loading... |
48 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 49 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
49 IPEndPoint ipe; | 50 IPEndPoint ipe; |
50 bool result = ipe.FromSockAddr(net_address, address_len); | 51 bool result = ipe.FromSockAddr(net_address, address_len); |
51 DCHECK(result); | 52 DCHECK(result); |
52 dict->SetString("source_address", ipe.ToString()); | 53 dict->SetString("source_address", ipe.ToString()); |
53 return std::move(dict); | 54 return std::move(dict); |
54 } | 55 } |
55 | 56 |
56 } // namespace | 57 } // namespace |
57 | 58 |
58 NetLog::ParametersCallback CreateNetLogSocketErrorCallback(int net_error, | 59 NetLogParametersCallback CreateNetLogSocketErrorCallback(int net_error, |
59 int os_error) { | 60 int os_error) { |
60 return base::Bind(&NetLogSocketErrorCallback, net_error, os_error); | 61 return base::Bind(&NetLogSocketErrorCallback, net_error, os_error); |
61 } | 62 } |
62 | 63 |
63 NetLog::ParametersCallback CreateNetLogHostPortPairCallback( | 64 NetLogParametersCallback CreateNetLogHostPortPairCallback( |
64 const HostPortPair* host_and_port) { | 65 const HostPortPair* host_and_port) { |
65 return base::Bind(&NetLogHostPortPairCallback, host_and_port); | 66 return base::Bind(&NetLogHostPortPairCallback, host_and_port); |
66 } | 67 } |
67 | 68 |
68 NetLog::ParametersCallback CreateNetLogIPEndPointCallback( | 69 NetLogParametersCallback CreateNetLogIPEndPointCallback( |
69 const IPEndPoint* address) { | 70 const IPEndPoint* address) { |
70 return base::Bind(&NetLogIPEndPointCallback, address); | 71 return base::Bind(&NetLogIPEndPointCallback, address); |
71 } | 72 } |
72 | 73 |
73 NetLog::ParametersCallback CreateNetLogSourceAddressCallback( | 74 NetLogParametersCallback CreateNetLogSourceAddressCallback( |
74 const struct sockaddr* net_address, | 75 const struct sockaddr* net_address, |
75 socklen_t address_len) { | 76 socklen_t address_len) { |
76 return base::Bind(&NetLogSourceAddressCallback, net_address, address_len); | 77 return base::Bind(&NetLogSourceAddressCallback, net_address, address_len); |
77 } | 78 } |
78 | 79 |
79 } // namespace net | 80 } // namespace net |
OLD | NEW |