OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_SOCKETS_TCP_SOCKETS_TCP_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SOCKETS_TCP_SOCKETS_TCP_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKETS_TCP_SOCKETS_TCP_API_H_ | 6 #define EXTENSIONS_BROWSER_API_SOCKETS_TCP_SOCKETS_TCP_API_H_ |
7 | 7 |
8 #include "chrome/browser/extensions/api/socket/socket_api.h" | 8 #include "extensions/browser/api/socket/socket_api.h" |
9 #include "chrome/common/extensions/api/sockets_tcp.h" | 9 #include "extensions/common/api/sockets_tcp.h" |
10 | 10 |
11 namespace extensions { | 11 namespace extensions { |
12 class ResumableTCPSocket; | 12 class ResumableTCPSocket; |
13 } | 13 } |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 namespace api { | 16 namespace core_api { |
| 17 |
| 18 class TCPSocketEventDispatcher; |
17 | 19 |
18 class TCPSocketAsyncApiFunction : public SocketAsyncApiFunction { | 20 class TCPSocketAsyncApiFunction : public SocketAsyncApiFunction { |
19 protected: | 21 protected: |
20 virtual ~TCPSocketAsyncApiFunction(); | 22 virtual ~TCPSocketAsyncApiFunction(); |
21 | 23 |
22 virtual scoped_ptr<SocketResourceManagerInterface> | 24 virtual scoped_ptr<SocketResourceManagerInterface> |
23 CreateSocketResourceManager() OVERRIDE; | 25 CreateSocketResourceManager() OVERRIDE; |
24 | 26 |
25 ResumableTCPSocket* GetTcpSocket(int socket_id); | 27 ResumableTCPSocket* GetTcpSocket(int socket_id); |
26 }; | 28 }; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 virtual ~SocketsTcpUpdateFunction(); | 66 virtual ~SocketsTcpUpdateFunction(); |
65 | 67 |
66 // AsyncApiFunction: | 68 // AsyncApiFunction: |
67 virtual bool Prepare() OVERRIDE; | 69 virtual bool Prepare() OVERRIDE; |
68 virtual void Work() OVERRIDE; | 70 virtual void Work() OVERRIDE; |
69 | 71 |
70 private: | 72 private: |
71 scoped_ptr<sockets_tcp::Update::Params> params_; | 73 scoped_ptr<sockets_tcp::Update::Params> params_; |
72 }; | 74 }; |
73 | 75 |
74 class SocketsTcpSetPausedFunction | 76 class SocketsTcpSetPausedFunction : public TCPSocketAsyncApiFunction { |
75 : public TCPSocketAsyncApiFunction { | |
76 public: | 77 public: |
77 DECLARE_EXTENSION_FUNCTION("sockets.tcp.setPaused", SOCKETS_TCP_SETPAUSED) | 78 DECLARE_EXTENSION_FUNCTION("sockets.tcp.setPaused", SOCKETS_TCP_SETPAUSED) |
78 | 79 |
79 SocketsTcpSetPausedFunction(); | 80 SocketsTcpSetPausedFunction(); |
80 | 81 |
81 protected: | 82 protected: |
82 virtual ~SocketsTcpSetPausedFunction(); | 83 virtual ~SocketsTcpSetPausedFunction(); |
83 | 84 |
84 // AsyncApiFunction | 85 // AsyncApiFunction |
85 virtual bool Prepare() OVERRIDE; | 86 virtual bool Prepare() OVERRIDE; |
86 virtual void Work() OVERRIDE; | 87 virtual void Work() OVERRIDE; |
87 | 88 |
88 private: | 89 private: |
89 scoped_ptr<sockets_tcp::SetPaused::Params> params_; | 90 scoped_ptr<sockets_tcp::SetPaused::Params> params_; |
90 TCPSocketEventDispatcher* socket_event_dispatcher_; | 91 TCPSocketEventDispatcher* socket_event_dispatcher_; |
91 }; | 92 }; |
92 | 93 |
93 class SocketsTcpSetKeepAliveFunction | 94 class SocketsTcpSetKeepAliveFunction : public TCPSocketAsyncApiFunction { |
94 : public TCPSocketAsyncApiFunction { | |
95 public: | 95 public: |
96 DECLARE_EXTENSION_FUNCTION("sockets.tcp.setKeepAlive", | 96 DECLARE_EXTENSION_FUNCTION("sockets.tcp.setKeepAlive", |
97 SOCKETS_TCP_SETKEEPALIVE) | 97 SOCKETS_TCP_SETKEEPALIVE) |
98 | 98 |
99 SocketsTcpSetKeepAliveFunction(); | 99 SocketsTcpSetKeepAliveFunction(); |
100 | 100 |
101 protected: | 101 protected: |
102 virtual ~SocketsTcpSetKeepAliveFunction(); | 102 virtual ~SocketsTcpSetKeepAliveFunction(); |
103 | 103 |
104 // AsyncApiFunction | 104 // AsyncApiFunction |
105 virtual bool Prepare() OVERRIDE; | 105 virtual bool Prepare() OVERRIDE; |
106 virtual void Work() OVERRIDE; | 106 virtual void Work() OVERRIDE; |
107 | 107 |
108 private: | 108 private: |
109 scoped_ptr<sockets_tcp::SetKeepAlive::Params> params_; | 109 scoped_ptr<sockets_tcp::SetKeepAlive::Params> params_; |
110 }; | 110 }; |
111 | 111 |
112 class SocketsTcpSetNoDelayFunction | 112 class SocketsTcpSetNoDelayFunction : public TCPSocketAsyncApiFunction { |
113 : public TCPSocketAsyncApiFunction { | |
114 public: | 113 public: |
115 DECLARE_EXTENSION_FUNCTION("sockets.tcp.setNoDelay", SOCKETS_TCP_SETNODELAY) | 114 DECLARE_EXTENSION_FUNCTION("sockets.tcp.setNoDelay", SOCKETS_TCP_SETNODELAY) |
116 | 115 |
117 SocketsTcpSetNoDelayFunction(); | 116 SocketsTcpSetNoDelayFunction(); |
118 | 117 |
119 protected: | 118 protected: |
120 virtual ~SocketsTcpSetNoDelayFunction(); | 119 virtual ~SocketsTcpSetNoDelayFunction(); |
121 | 120 |
122 // AsyncApiFunction | 121 // AsyncApiFunction |
123 virtual bool Prepare() OVERRIDE; | 122 virtual bool Prepare() OVERRIDE; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 SocketsTcpGetSocketsFunction(); | 231 SocketsTcpGetSocketsFunction(); |
233 | 232 |
234 protected: | 233 protected: |
235 virtual ~SocketsTcpGetSocketsFunction(); | 234 virtual ~SocketsTcpGetSocketsFunction(); |
236 | 235 |
237 // AsyncApiFunction: | 236 // AsyncApiFunction: |
238 virtual bool Prepare() OVERRIDE; | 237 virtual bool Prepare() OVERRIDE; |
239 virtual void Work() OVERRIDE; | 238 virtual void Work() OVERRIDE; |
240 }; | 239 }; |
241 | 240 |
242 } // namespace api | 241 } // namespace core_api |
243 } // namespace extensions | 242 } // namespace extensions |
244 | 243 |
245 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKETS_TCP_SOCKETS_TCP_API_H_ | 244 #endif // EXTENSIONS_BROWSER_API_SOCKETS_TCP_SOCKETS_TCP_API_H_ |
OLD | NEW |