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 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_UDP_SOCKET_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_UDP_SOCKET_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_UDP_SOCKET_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_UDP_SOCKET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/extensions/api/socket/socket.h" | 10 #include "chrome/browser/extensions/api/socket/socket.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 virtual int Bind(const std::string& address, int port) OVERRIDE; | 26 virtual int Bind(const std::string& address, int port) OVERRIDE; |
27 virtual void Read(int count, | 27 virtual void Read(int count, |
28 const ReadCompletionCallback& callback) OVERRIDE; | 28 const ReadCompletionCallback& callback) OVERRIDE; |
29 virtual void RecvFrom(int count, | 29 virtual void RecvFrom(int count, |
30 const RecvFromCompletionCallback& callback) OVERRIDE; | 30 const RecvFromCompletionCallback& callback) OVERRIDE; |
31 virtual void SendTo(scoped_refptr<net::IOBuffer> io_buffer, | 31 virtual void SendTo(scoped_refptr<net::IOBuffer> io_buffer, |
32 int byte_count, | 32 int byte_count, |
33 const std::string& address, | 33 const std::string& address, |
34 int port, | 34 int port, |
35 const CompletionCallback& callback) OVERRIDE; | 35 const CompletionCallback& callback) OVERRIDE; |
| 36 virtual Socket::SocketType socket_type() const OVERRIDE; |
36 | 37 |
37 protected: | 38 protected: |
38 virtual int WriteImpl(net::IOBuffer* io_buffer, | 39 virtual int WriteImpl(net::IOBuffer* io_buffer, |
39 int io_buffer_size, | 40 int io_buffer_size, |
40 const net::CompletionCallback& callback) OVERRIDE; | 41 const net::CompletionCallback& callback) OVERRIDE; |
41 | 42 |
42 private: | 43 private: |
43 // Make net::IPEndPoint can be refcounted | 44 // Make net::IPEndPoint can be refcounted |
44 typedef base::RefCountedData<net::IPEndPoint> IPEndPoint; | 45 typedef base::RefCountedData<net::IPEndPoint> IPEndPoint; |
45 | 46 |
46 void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, | 47 void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, |
47 int result); | 48 int result); |
48 void OnRecvFromComplete(scoped_refptr<net::IOBuffer> io_buffer, | 49 void OnRecvFromComplete(scoped_refptr<net::IOBuffer> io_buffer, |
49 scoped_refptr<IPEndPoint> address, | 50 scoped_refptr<IPEndPoint> address, |
50 int result); | 51 int result); |
51 void OnSendToComplete(int result); | 52 void OnSendToComplete(int result); |
52 | 53 |
53 net::UDPSocket socket_; | 54 net::UDPSocket socket_; |
54 | 55 |
55 ReadCompletionCallback read_callback_; | 56 ReadCompletionCallback read_callback_; |
56 | 57 |
57 RecvFromCompletionCallback recv_from_callback_; | 58 RecvFromCompletionCallback recv_from_callback_; |
58 | 59 |
59 CompletionCallback send_to_callback_; | 60 CompletionCallback send_to_callback_; |
60 }; | 61 }; |
61 | 62 |
62 } // namespace extensions | 63 } // namespace extensions |
63 | 64 |
64 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_UDP_SOCKET_H_ | 65 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_UDP_SOCKET_H_ |
OLD | NEW |