OLD | NEW |
| (Empty) |
1 // Copyright 2013 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. | |
4 | |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKETS_TCP_SERVER_SOCKETS_TCP_SERVER_API_
H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKETS_TCP_SERVER_SOCKETS_TCP_SERVER_API_
H_ | |
7 | |
8 #include "chrome/browser/extensions/api/socket/socket_api.h" | |
9 #include "chrome/common/extensions/api/sockets_tcp_server.h" | |
10 | |
11 namespace extensions { | |
12 class ResumableTCPServerSocket; | |
13 } | |
14 | |
15 namespace extensions { | |
16 namespace api { | |
17 | |
18 class TCPServerSocketAsyncApiFunction : public SocketAsyncApiFunction { | |
19 protected: | |
20 virtual ~TCPServerSocketAsyncApiFunction(); | |
21 | |
22 virtual scoped_ptr<SocketResourceManagerInterface> | |
23 CreateSocketResourceManager() OVERRIDE; | |
24 | |
25 ResumableTCPServerSocket* GetTcpSocket(int socket_id); | |
26 }; | |
27 | |
28 class SocketsTcpServerCreateFunction : public TCPServerSocketAsyncApiFunction { | |
29 public: | |
30 DECLARE_EXTENSION_FUNCTION("sockets.tcpServer.create", | |
31 SOCKETS_TCP_SERVER_CREATE) | |
32 | |
33 SocketsTcpServerCreateFunction(); | |
34 | |
35 protected: | |
36 virtual ~SocketsTcpServerCreateFunction(); | |
37 | |
38 // AsyncApiFunction: | |
39 virtual bool Prepare() OVERRIDE; | |
40 virtual void Work() OVERRIDE; | |
41 | |
42 private: | |
43 FRIEND_TEST_ALL_PREFIXES(SocketsTcpServerUnitTest, Create); | |
44 scoped_ptr<sockets_tcp_server::Create::Params> params_; | |
45 }; | |
46 | |
47 class SocketsTcpServerUpdateFunction : public TCPServerSocketAsyncApiFunction { | |
48 public: | |
49 DECLARE_EXTENSION_FUNCTION("sockets.tcpServer.update", | |
50 SOCKETS_TCP_SERVER_UPDATE) | |
51 | |
52 SocketsTcpServerUpdateFunction(); | |
53 | |
54 protected: | |
55 virtual ~SocketsTcpServerUpdateFunction(); | |
56 | |
57 // AsyncApiFunction: | |
58 virtual bool Prepare() OVERRIDE; | |
59 virtual void Work() OVERRIDE; | |
60 | |
61 private: | |
62 scoped_ptr<sockets_tcp_server::Update::Params> params_; | |
63 }; | |
64 | |
65 class SocketsTcpServerSetPausedFunction | |
66 : public TCPServerSocketAsyncApiFunction { | |
67 public: | |
68 DECLARE_EXTENSION_FUNCTION("sockets.tcpServer.setPaused", | |
69 SOCKETS_TCP_SERVER_SETPAUSED) | |
70 | |
71 SocketsTcpServerSetPausedFunction(); | |
72 | |
73 protected: | |
74 virtual ~SocketsTcpServerSetPausedFunction(); | |
75 | |
76 // AsyncApiFunction | |
77 virtual bool Prepare() OVERRIDE; | |
78 virtual void Work() OVERRIDE; | |
79 | |
80 private: | |
81 scoped_ptr<sockets_tcp_server::SetPaused::Params> params_; | |
82 TCPServerSocketEventDispatcher* socket_event_dispatcher_; | |
83 }; | |
84 | |
85 class SocketsTcpServerListenFunction | |
86 : public TCPServerSocketAsyncApiFunction { | |
87 public: | |
88 DECLARE_EXTENSION_FUNCTION("sockets.tcpServer.listen", | |
89 SOCKETS_TCP_SERVER_LISTEN) | |
90 | |
91 SocketsTcpServerListenFunction(); | |
92 | |
93 protected: | |
94 virtual ~SocketsTcpServerListenFunction(); | |
95 | |
96 // AsyncApiFunction: | |
97 virtual bool Prepare() OVERRIDE; | |
98 virtual void Work() OVERRIDE; | |
99 | |
100 private: | |
101 scoped_ptr<sockets_tcp_server::Listen::Params> params_; | |
102 TCPServerSocketEventDispatcher* socket_event_dispatcher_; | |
103 }; | |
104 | |
105 class SocketsTcpServerDisconnectFunction | |
106 : public TCPServerSocketAsyncApiFunction { | |
107 public: | |
108 DECLARE_EXTENSION_FUNCTION("sockets.tcpServer.disconnect", | |
109 SOCKETS_TCP_SERVER_DISCONNECT) | |
110 | |
111 SocketsTcpServerDisconnectFunction(); | |
112 | |
113 protected: | |
114 virtual ~SocketsTcpServerDisconnectFunction(); | |
115 | |
116 // AsyncApiFunction: | |
117 virtual bool Prepare() OVERRIDE; | |
118 virtual void Work() OVERRIDE; | |
119 | |
120 private: | |
121 scoped_ptr<sockets_tcp_server::Disconnect::Params> params_; | |
122 }; | |
123 | |
124 class SocketsTcpServerCloseFunction : public TCPServerSocketAsyncApiFunction { | |
125 public: | |
126 DECLARE_EXTENSION_FUNCTION("sockets.tcpServer.close", | |
127 SOCKETS_TCP_SERVER_CLOSE) | |
128 | |
129 SocketsTcpServerCloseFunction(); | |
130 | |
131 protected: | |
132 virtual ~SocketsTcpServerCloseFunction(); | |
133 | |
134 // AsyncApiFunction: | |
135 virtual bool Prepare() OVERRIDE; | |
136 virtual void Work() OVERRIDE; | |
137 | |
138 private: | |
139 scoped_ptr<sockets_tcp_server::Close::Params> params_; | |
140 }; | |
141 | |
142 class SocketsTcpServerGetInfoFunction : public TCPServerSocketAsyncApiFunction { | |
143 public: | |
144 DECLARE_EXTENSION_FUNCTION("sockets.tcpServer.getInfo", | |
145 SOCKETS_TCP_SERVER_GETINFO) | |
146 | |
147 SocketsTcpServerGetInfoFunction(); | |
148 | |
149 protected: | |
150 virtual ~SocketsTcpServerGetInfoFunction(); | |
151 | |
152 // AsyncApiFunction: | |
153 virtual bool Prepare() OVERRIDE; | |
154 virtual void Work() OVERRIDE; | |
155 | |
156 private: | |
157 scoped_ptr<sockets_tcp_server::GetInfo::Params> params_; | |
158 }; | |
159 | |
160 class SocketsTcpServerGetSocketsFunction | |
161 : public TCPServerSocketAsyncApiFunction { | |
162 public: | |
163 DECLARE_EXTENSION_FUNCTION("sockets.tcpServer.getSockets", | |
164 SOCKETS_TCP_SERVER_GETSOCKETS) | |
165 | |
166 SocketsTcpServerGetSocketsFunction(); | |
167 | |
168 protected: | |
169 virtual ~SocketsTcpServerGetSocketsFunction(); | |
170 | |
171 // AsyncApiFunction: | |
172 virtual bool Prepare() OVERRIDE; | |
173 virtual void Work() OVERRIDE; | |
174 }; | |
175 | |
176 } // namespace api | |
177 } // namespace extensions | |
178 | |
179 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKETS_TCP_SERVER_SOCKETS_TCP_SERVER_A
PI_H_ | |
OLD | NEW |