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_SOCKET_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "chrome/browser/extensions/api/api_function.h" | 9 #include "chrome/browser/extensions/api/api_function.h" |
10 #include "chrome/browser/extensions/api/api_resource_manager.h" | 10 #include "chrome/browser/extensions/api/api_resource_manager.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // SocketExtensionWithDnsLookupFunction: | 118 // SocketExtensionWithDnsLookupFunction: |
119 virtual void AfterDnsLookup(int lookup_result) OVERRIDE; | 119 virtual void AfterDnsLookup(int lookup_result) OVERRIDE; |
120 | 120 |
121 private: | 121 private: |
122 void StartConnect(); | 122 void StartConnect(); |
123 void OnConnect(int result); | 123 void OnConnect(int result); |
124 | 124 |
125 int socket_id_; | 125 int socket_id_; |
126 std::string hostname_; | 126 std::string hostname_; |
127 int port_; | 127 int port_; |
| 128 Socket* socket_; |
128 }; | 129 }; |
129 | 130 |
130 class SocketDisconnectFunction : public SocketAsyncApiFunction { | 131 class SocketDisconnectFunction : public SocketAsyncApiFunction { |
131 public: | 132 public: |
132 DECLARE_EXTENSION_FUNCTION_NAME("socket.disconnect") | 133 DECLARE_EXTENSION_FUNCTION_NAME("socket.disconnect") |
133 | 134 |
134 protected: | 135 protected: |
135 virtual ~SocketDisconnectFunction() {} | 136 virtual ~SocketDisconnectFunction() {} |
136 | 137 |
137 // AsyncApiFunction: | 138 // AsyncApiFunction: |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 virtual void AfterDnsLookup(int lookup_result) OVERRIDE; | 237 virtual void AfterDnsLookup(int lookup_result) OVERRIDE; |
237 | 238 |
238 private: | 239 private: |
239 void StartSendTo(); | 240 void StartSendTo(); |
240 | 241 |
241 int socket_id_; | 242 int socket_id_; |
242 scoped_refptr<net::IOBuffer> io_buffer_; | 243 scoped_refptr<net::IOBuffer> io_buffer_; |
243 size_t io_buffer_size_; | 244 size_t io_buffer_size_; |
244 std::string hostname_; | 245 std::string hostname_; |
245 int port_; | 246 int port_; |
| 247 Socket* socket_; |
246 }; | 248 }; |
247 | 249 |
248 class SocketSetKeepAliveFunction : public SocketAsyncApiFunction { | 250 class SocketSetKeepAliveFunction : public SocketAsyncApiFunction { |
249 public: | 251 public: |
250 DECLARE_EXTENSION_FUNCTION_NAME("socket.setKeepAlive") | 252 DECLARE_EXTENSION_FUNCTION_NAME("socket.setKeepAlive") |
251 | 253 |
252 SocketSetKeepAliveFunction(); | 254 SocketSetKeepAliveFunction(); |
253 | 255 |
254 protected: | 256 protected: |
255 virtual ~SocketSetKeepAliveFunction(); | 257 virtual ~SocketSetKeepAliveFunction(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 virtual bool Prepare() OVERRIDE; | 294 virtual bool Prepare() OVERRIDE; |
293 virtual void Work() OVERRIDE; | 295 virtual void Work() OVERRIDE; |
294 | 296 |
295 private: | 297 private: |
296 scoped_ptr<api::socket::GetInfo::Params> params_; | 298 scoped_ptr<api::socket::GetInfo::Params> params_; |
297 }; | 299 }; |
298 | 300 |
299 } // namespace extensions | 301 } // namespace extensions |
300 | 302 |
301 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ | 303 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ |
OLD | NEW |