| 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 "chrome/browser/extensions/api/socket/udp_socket.h" | 5 #include "chrome/browser/extensions/api/socket/udp_socket.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/api_resource.h" | 7 #include "chrome/browser/extensions/api/api_resource.h" |
| 8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" | 8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" |
| 9 #include "net/base/ip_endpoint.h" | 9 #include "net/base/ip_endpoint.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "net/udp/datagram_socket.h" | 11 #include "net/udp/datagram_socket.h" |
| 12 #include "net/udp/udp_client_socket.h" | 12 #include "net/udp/udp_client_socket.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 | 15 |
| 16 UDPSocket::UDPSocket(APIResourceEventNotifier* event_notifier) | 16 UDPSocket::UDPSocket(ApiResourceEventNotifier* event_notifier) |
| 17 : Socket(event_notifier), | 17 : Socket(event_notifier), |
| 18 socket_(net::DatagramSocket::DEFAULT_BIND, | 18 socket_(net::DatagramSocket::DEFAULT_BIND, |
| 19 net::RandIntCallback(), | 19 net::RandIntCallback(), |
| 20 NULL, | 20 NULL, |
| 21 net::NetLog::Source()) { | 21 net::NetLog::Source()) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 UDPSocket::~UDPSocket() { | 24 UDPSocket::~UDPSocket() { |
| 25 if (is_connected_) { | 25 if (is_connected_) { |
| 26 Disconnect(); | 26 Disconnect(); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 recv_from_callback_.Reset(); | 205 recv_from_callback_.Reset(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void UDPSocket::OnSendToComplete(int result) { | 208 void UDPSocket::OnSendToComplete(int result) { |
| 209 DCHECK(!send_to_callback_.is_null()); | 209 DCHECK(!send_to_callback_.is_null()); |
| 210 send_to_callback_.Run(result); | 210 send_to_callback_.Run(result); |
| 211 send_to_callback_.Reset(); | 211 send_to_callback_.Reset(); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace extensions | 214 } // namespace extensions |
| OLD | NEW |