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