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/udp/udp_net_log_parameters.h" | 5 #include "net/udp/udp_net_log_parameters.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.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> NetLogUDPDataTranferCallback( | 18 std::unique_ptr<base::Value> NetLogUDPDataTranferCallback( |
19 int byte_count, | 19 int byte_count, |
20 const char* bytes, | 20 const char* bytes, |
21 const IPEndPoint* address, | 21 const IPEndPoint* address, |
22 NetLogCaptureMode capture_mode) { | 22 NetLogCaptureMode capture_mode) { |
23 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 23 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
24 dict->SetInteger("byte_count", byte_count); | 24 dict->SetInteger("byte_count", byte_count); |
25 if (capture_mode.include_socket_bytes()) | 25 if (capture_mode.include_socket_bytes()) |
26 dict->SetString("hex_encoded_bytes", base::HexEncode(bytes, byte_count)); | 26 dict->SetString("hex_encoded_bytes", base::HexEncode(bytes, byte_count)); |
27 if (address) | 27 if (address) |
28 dict->SetString("address", address->ToString()); | 28 dict->SetString("address", address->ToString()); |
29 return std::move(dict); | 29 return std::move(dict); |
30 } | 30 } |
31 | 31 |
32 scoped_ptr<base::Value> NetLogUDPConnectCallback( | 32 std::unique_ptr<base::Value> NetLogUDPConnectCallback( |
33 const IPEndPoint* address, | 33 const IPEndPoint* address, |
34 NetLogCaptureMode /* capture_mode */) { | 34 NetLogCaptureMode /* capture_mode */) { |
35 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 35 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
36 dict->SetString("address", address->ToString()); | 36 dict->SetString("address", address->ToString()); |
37 return std::move(dict); | 37 return std::move(dict); |
38 } | 38 } |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 NetLog::ParametersCallback CreateNetLogUDPDataTranferCallback( | 42 NetLog::ParametersCallback CreateNetLogUDPDataTranferCallback( |
43 int byte_count, | 43 int byte_count, |
44 const char* bytes, | 44 const char* bytes, |
45 const IPEndPoint* address) { | 45 const IPEndPoint* address) { |
46 DCHECK(bytes); | 46 DCHECK(bytes); |
47 return base::Bind(&NetLogUDPDataTranferCallback, byte_count, bytes, address); | 47 return base::Bind(&NetLogUDPDataTranferCallback, byte_count, bytes, address); |
48 } | 48 } |
49 | 49 |
50 NetLog::ParametersCallback CreateNetLogUDPConnectCallback( | 50 NetLog::ParametersCallback CreateNetLogUDPConnectCallback( |
51 const IPEndPoint* address) { | 51 const IPEndPoint* address) { |
52 DCHECK(address); | 52 DCHECK(address); |
53 return base::Bind(&NetLogUDPConnectCallback, address); | 53 return base::Bind(&NetLogUDPConnectCallback, address); |
54 } | 54 } |
55 | 55 |
56 } // namespace net | 56 } // namespace net |
OLD | NEW |