Delete unused downloads page asset.
[chromium-blink-merge.git] / net / socket / socket_net_log_params.cc
blob64012f4264ce6bfa824e92cad1ee8007851a56af
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
3 // found in the LICENSE file.
5 #include "net/socket/socket_net_log_params.h"
7 #include "base/bind.h"
8 #include "base/values.h"
9 #include "net/base/host_port_pair.h"
10 #include "net/base/ip_endpoint.h"
11 #include "net/base/net_util.h"
13 namespace net {
15 namespace {
17 scoped_ptr<base::Value> NetLogSocketErrorCallback(
18 int net_error,
19 int os_error,
20 NetLogCaptureMode /* capture_mode */) {
21 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
22 dict->SetInteger("net_error", net_error);
23 dict->SetInteger("os_error", os_error);
24 return dict.Pass();
27 scoped_ptr<base::Value> NetLogHostPortPairCallback(
28 const HostPortPair* host_and_port,
29 NetLogCaptureMode /* capture_mode */) {
30 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
31 dict->SetString("host_and_port", host_and_port->ToString());
32 return dict.Pass();
35 scoped_ptr<base::Value> NetLogIPEndPointCallback(
36 const IPEndPoint* address,
37 NetLogCaptureMode /* capture_mode */) {
38 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
39 dict->SetString("address", address->ToString());
40 return dict.Pass();
43 scoped_ptr<base::Value> NetLogSourceAddressCallback(
44 const struct sockaddr* net_address,
45 socklen_t address_len,
46 NetLogCaptureMode /* capture_mode */) {
47 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
48 dict->SetString("source_address",
49 NetAddressToStringWithPort(net_address, address_len));
50 return dict.Pass();
53 } // namespace
55 NetLog::ParametersCallback CreateNetLogSocketErrorCallback(int net_error,
56 int os_error) {
57 return base::Bind(&NetLogSocketErrorCallback, net_error, os_error);
60 NetLog::ParametersCallback CreateNetLogHostPortPairCallback(
61 const HostPortPair* host_and_port) {
62 return base::Bind(&NetLogHostPortPairCallback, host_and_port);
65 NetLog::ParametersCallback CreateNetLogIPEndPointCallback(
66 const IPEndPoint* address) {
67 return base::Bind(&NetLogIPEndPointCallback, address);
70 NetLog::ParametersCallback CreateNetLogSourceAddressCallback(
71 const struct sockaddr* net_address,
72 socklen_t address_len) {
73 return base::Bind(&NetLogSourceAddressCallback, net_address, address_len);
76 } // namespace net