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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "chrome/browser/extensions/api/api_function.h" | 10 #include "chrome/browser/extensions/api/api_function.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 protected: | 129 protected: |
130 virtual ~SocketReadFunction() {} | 130 virtual ~SocketReadFunction() {} |
131 | 131 |
132 // AsyncAPIFunction: | 132 // AsyncAPIFunction: |
133 virtual bool Prepare() OVERRIDE; | 133 virtual bool Prepare() OVERRIDE; |
134 virtual void AsyncWorkStart() OVERRIDE; | 134 virtual void AsyncWorkStart() OVERRIDE; |
135 | 135 |
136 private: | 136 private: |
137 int socket_id_; | 137 int socket_id_; |
| 138 int buffer_size_; |
138 }; | 139 }; |
139 | 140 |
140 class SocketWriteFunction : public SocketExtensionFunction { | 141 class SocketWriteFunction : public SocketExtensionFunction { |
141 public: | 142 public: |
142 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.write") | 143 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.write") |
143 | 144 |
144 SocketWriteFunction(); | 145 SocketWriteFunction(); |
145 void OnCompleted(int result); | 146 void OnCompleted(int result); |
146 | 147 |
147 protected: | 148 protected: |
(...skipping 19 matching lines...) Expand all Loading... |
167 | 168 |
168 protected: | 169 protected: |
169 virtual ~SocketRecvFromFunction(); | 170 virtual ~SocketRecvFromFunction(); |
170 | 171 |
171 // AsyncAPIFunction | 172 // AsyncAPIFunction |
172 virtual bool Prepare() OVERRIDE; | 173 virtual bool Prepare() OVERRIDE; |
173 virtual void AsyncWorkStart() OVERRIDE; | 174 virtual void AsyncWorkStart() OVERRIDE; |
174 | 175 |
175 private: | 176 private: |
176 int socket_id_; | 177 int socket_id_; |
| 178 int buffer_size_; |
177 }; | 179 }; |
178 | 180 |
179 class SocketSendToFunction : public SocketExtensionFunction { | 181 class SocketSendToFunction : public SocketExtensionFunction { |
180 public: | 182 public: |
181 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.sendTo") | 183 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.sendTo") |
182 | 184 |
183 SocketSendToFunction(); | 185 SocketSendToFunction(); |
184 | 186 |
185 protected: | 187 protected: |
186 virtual ~SocketSendToFunction(); | 188 virtual ~SocketSendToFunction(); |
187 void OnCompleted(int result); | 189 void OnCompleted(int result); |
188 | 190 |
189 // AsyncAPIFunction: | 191 // AsyncAPIFunction: |
190 virtual bool Prepare() OVERRIDE; | 192 virtual bool Prepare() OVERRIDE; |
191 virtual void AsyncWorkStart() OVERRIDE; | 193 virtual void AsyncWorkStart() OVERRIDE; |
192 | 194 |
193 private: | 195 private: |
194 int socket_id_; | 196 int socket_id_; |
195 scoped_refptr<net::IOBufferWithSize> io_buffer_; | 197 scoped_refptr<net::IOBufferWithSize> io_buffer_; |
196 std::string address_; | 198 std::string address_; |
197 int port_; | 199 int port_; |
198 }; | 200 }; |
199 | 201 |
200 } // namespace extensions | 202 } // namespace extensions |
201 | 203 |
202 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ | 204 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ |
OLD | NEW |