OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ |
6 #define EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ | 6 #define EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
11 #include "extensions/browser/api/socket/socket.h" | 13 #include "extensions/browser/api/socket/socket.h" |
12 #include "net/udp/udp_socket.h" | 14 #include "net/udp/udp_socket.h" |
13 | 15 |
14 namespace extensions { | 16 namespace extensions { |
15 | 17 |
16 class UDPSocket : public Socket { | 18 class UDPSocket : public Socket { |
17 public: | 19 public: |
18 explicit UDPSocket(const std::string& owner_extension_id); | 20 explicit UDPSocket(const std::string& owner_extension_id); |
19 ~UDPSocket() override; | 21 ~UDPSocket() override; |
20 | 22 |
21 void Connect(const net::AddressList& address, | 23 void Connect(const net::AddressList& address, |
22 const CompletionCallback& callback) override; | 24 const CompletionCallback& callback) override; |
23 void Disconnect() override; | 25 void Disconnect() override; |
24 int Bind(const std::string& address, uint16 port) override; | 26 int Bind(const std::string& address, uint16_t port) override; |
25 void Read(int count, const ReadCompletionCallback& callback) override; | 27 void Read(int count, const ReadCompletionCallback& callback) override; |
26 void RecvFrom(int count, const RecvFromCompletionCallback& callback) override; | 28 void RecvFrom(int count, const RecvFromCompletionCallback& callback) override; |
27 void SendTo(scoped_refptr<net::IOBuffer> io_buffer, | 29 void SendTo(scoped_refptr<net::IOBuffer> io_buffer, |
28 int byte_count, | 30 int byte_count, |
29 const net::IPEndPoint& address, | 31 const net::IPEndPoint& address, |
30 const CompletionCallback& callback) override; | 32 const CompletionCallback& callback) override; |
31 | 33 |
32 bool IsConnected() override; | 34 bool IsConnected() override; |
33 | 35 |
34 bool GetPeerAddress(net::IPEndPoint* address) override; | 36 bool GetPeerAddress(net::IPEndPoint* address) override; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // The size of the buffer used to receive data - see sockets_udp.idl. | 109 // The size of the buffer used to receive data - see sockets_udp.idl. |
108 int buffer_size_; | 110 int buffer_size_; |
109 // Flag indicating whether a connected socket blocks its peer from sending | 111 // Flag indicating whether a connected socket blocks its peer from sending |
110 // more data - see sockets_udp.idl. | 112 // more data - see sockets_udp.idl. |
111 bool paused_; | 113 bool paused_; |
112 }; | 114 }; |
113 | 115 |
114 } // namespace extensions | 116 } // namespace extensions |
115 | 117 |
116 #endif // EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ | 118 #endif // EXTENSIONS_BROWSER_API_SOCKET_UDP_SOCKET_H_ |
OLD | NEW |