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 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 scoped_ptr<base::Value> NetLogSocketErrorCallback( | 18 std::unique_ptr<base::Value> NetLogSocketErrorCallback( |
19 int net_error, | 19 int net_error, |
20 int os_error, | 20 int os_error, |
21 NetLogCaptureMode /* capture_mode */) { | 21 NetLogCaptureMode /* capture_mode */) { |
22 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 22 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
23 dict->SetInteger("net_error", net_error); | 23 dict->SetInteger("net_error", net_error); |
24 dict->SetInteger("os_error", os_error); | 24 dict->SetInteger("os_error", os_error); |
25 return std::move(dict); | 25 return std::move(dict); |
26 } | 26 } |
27 | 27 |
28 scoped_ptr<base::Value> NetLogHostPortPairCallback( | 28 std::unique_ptr<base::Value> NetLogHostPortPairCallback( |
29 const HostPortPair* host_and_port, | 29 const HostPortPair* host_and_port, |
30 NetLogCaptureMode /* capture_mode */) { | 30 NetLogCaptureMode /* capture_mode */) { |
31 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 31 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
32 dict->SetString("host_and_port", host_and_port->ToString()); | 32 dict->SetString("host_and_port", host_and_port->ToString()); |
33 return std::move(dict); | 33 return std::move(dict); |
34 } | 34 } |
35 | 35 |
36 scoped_ptr<base::Value> NetLogIPEndPointCallback( | 36 std::unique_ptr<base::Value> NetLogIPEndPointCallback( |
37 const IPEndPoint* address, | 37 const IPEndPoint* address, |
38 NetLogCaptureMode /* capture_mode */) { | 38 NetLogCaptureMode /* capture_mode */) { |
39 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 39 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
40 dict->SetString("address", address->ToString()); | 40 dict->SetString("address", address->ToString()); |
41 return std::move(dict); | 41 return std::move(dict); |
42 } | 42 } |
43 | 43 |
44 scoped_ptr<base::Value> NetLogSourceAddressCallback( | 44 std::unique_ptr<base::Value> NetLogSourceAddressCallback( |
45 const struct sockaddr* net_address, | 45 const struct sockaddr* net_address, |
46 socklen_t address_len, | 46 socklen_t address_len, |
47 NetLogCaptureMode /* capture_mode */) { | 47 NetLogCaptureMode /* capture_mode */) { |
48 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 48 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
49 IPEndPoint ipe; | 49 IPEndPoint ipe; |
50 bool result = ipe.FromSockAddr(net_address, address_len); | 50 bool result = ipe.FromSockAddr(net_address, address_len); |
51 DCHECK(result); | 51 DCHECK(result); |
52 dict->SetString("source_address", ipe.ToString()); | 52 dict->SetString("source_address", ipe.ToString()); |
53 return std::move(dict); | 53 return std::move(dict); |
54 } | 54 } |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 NetLog::ParametersCallback CreateNetLogSocketErrorCallback(int net_error, | 58 NetLog::ParametersCallback CreateNetLogSocketErrorCallback(int net_error, |
(...skipping 11 matching lines...) Expand all Loading... |
70 return base::Bind(&NetLogIPEndPointCallback, address); | 70 return base::Bind(&NetLogIPEndPointCallback, address); |
71 } | 71 } |
72 | 72 |
73 NetLog::ParametersCallback CreateNetLogSourceAddressCallback( | 73 NetLog::ParametersCallback CreateNetLogSourceAddressCallback( |
74 const struct sockaddr* net_address, | 74 const struct sockaddr* net_address, |
75 socklen_t address_len) { | 75 socklen_t address_len) { |
76 return base::Bind(&NetLogSourceAddressCallback, net_address, address_len); | 76 return base::Bind(&NetLogSourceAddressCallback, net_address, address_len); |
77 } | 77 } |
78 | 78 |
79 } // namespace net | 79 } // namespace net |
OLD | NEW |