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 bool IsTCPSocket() OVERRIDE; | |
37 virtual bool GetPeerAddress(net::IPEndPoint* address) OVERRIDE; | 36 virtual bool GetPeerAddress(net::IPEndPoint* address) OVERRIDE; |
38 virtual bool GetLocalAddress(net::IPEndPoint* address) OVERRIDE; | 37 virtual bool GetLocalAddress(net::IPEndPoint* address) OVERRIDE; |
| 38 virtual Socket::SocketType socket_type() const OVERRIDE; |
39 | 39 |
40 protected: | 40 protected: |
41 virtual int WriteImpl(net::IOBuffer* io_buffer, | 41 virtual int WriteImpl(net::IOBuffer* io_buffer, |
42 int io_buffer_size, | 42 int io_buffer_size, |
43 const net::CompletionCallback& callback) OVERRIDE; | 43 const net::CompletionCallback& callback) OVERRIDE; |
44 | 44 |
45 private: | 45 private: |
46 // Make net::IPEndPoint can be refcounted | 46 // Make net::IPEndPoint can be refcounted |
47 typedef base::RefCountedData<net::IPEndPoint> IPEndPoint; | 47 typedef base::RefCountedData<net::IPEndPoint> IPEndPoint; |
48 | 48 |
49 void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, | 49 void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, |
50 int result); | 50 int result); |
51 void OnRecvFromComplete(scoped_refptr<net::IOBuffer> io_buffer, | 51 void OnRecvFromComplete(scoped_refptr<net::IOBuffer> io_buffer, |
52 scoped_refptr<IPEndPoint> address, | 52 scoped_refptr<IPEndPoint> address, |
53 int result); | 53 int result); |
54 void OnSendToComplete(int result); | 54 void OnSendToComplete(int result); |
55 | 55 |
56 net::UDPSocket socket_; | 56 net::UDPSocket socket_; |
57 | 57 |
58 ReadCompletionCallback read_callback_; | 58 ReadCompletionCallback read_callback_; |
59 | 59 |
60 RecvFromCompletionCallback recv_from_callback_; | 60 RecvFromCompletionCallback recv_from_callback_; |
61 | 61 |
62 CompletionCallback send_to_callback_; | 62 CompletionCallback send_to_callback_; |
63 }; | 63 }; |
64 | 64 |
65 } // namespace extensions | 65 } // namespace extensions |
66 | 66 |
67 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_UDP_SOCKET_H_ | 67 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_UDP_SOCKET_H_ |
OLD | NEW |