Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Side by Side Diff: extensions/browser/api/socket/socket_api.h

Issue 717263003: Use uint16 for port numbers, extensions/ edition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self-review Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_SOCKET_SOCKET_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_SOCKET_SOCKET_API_H_
6 #define EXTENSIONS_BROWSER_API_SOCKET_SOCKET_API_H_ 6 #define EXTENSIONS_BROWSER_API_SOCKET_SOCKET_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 // SocketExtensionWithDnsLookupFunction: 197 // SocketExtensionWithDnsLookupFunction:
198 void AfterDnsLookup(int lookup_result) override; 198 void AfterDnsLookup(int lookup_result) override;
199 199
200 private: 200 private:
201 void StartConnect(); 201 void StartConnect();
202 void OnConnect(int result); 202 void OnConnect(int result);
203 203
204 int socket_id_; 204 int socket_id_;
205 std::string hostname_; 205 std::string hostname_;
206 int port_; 206 uint16 port_;
207 }; 207 };
208 208
209 class SocketDisconnectFunction : public SocketAsyncApiFunction { 209 class SocketDisconnectFunction : public SocketAsyncApiFunction {
210 public: 210 public:
211 DECLARE_EXTENSION_FUNCTION("socket.disconnect", SOCKET_DISCONNECT) 211 DECLARE_EXTENSION_FUNCTION("socket.disconnect", SOCKET_DISCONNECT)
212 212
213 protected: 213 protected:
214 ~SocketDisconnectFunction() override {} 214 ~SocketDisconnectFunction() override {}
215 215
216 // AsyncApiFunction: 216 // AsyncApiFunction:
(...skipping 11 matching lines...) Expand all
228 protected: 228 protected:
229 ~SocketBindFunction() override {} 229 ~SocketBindFunction() override {}
230 230
231 // AsyncApiFunction: 231 // AsyncApiFunction:
232 bool Prepare() override; 232 bool Prepare() override;
233 void Work() override; 233 void Work() override;
234 234
235 private: 235 private:
236 int socket_id_; 236 int socket_id_;
237 std::string address_; 237 std::string address_;
238 int port_; 238 uint16 port_;
239 }; 239 };
240 240
241 class SocketListenFunction : public SocketAsyncApiFunction { 241 class SocketListenFunction : public SocketAsyncApiFunction {
242 public: 242 public:
243 DECLARE_EXTENSION_FUNCTION("socket.listen", SOCKET_LISTEN) 243 DECLARE_EXTENSION_FUNCTION("socket.listen", SOCKET_LISTEN)
244 244
245 SocketListenFunction(); 245 SocketListenFunction();
246 246
247 protected: 247 protected:
248 ~SocketListenFunction() override; 248 ~SocketListenFunction() override;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 protected: 321 protected:
322 ~SocketRecvFromFunction() override; 322 ~SocketRecvFromFunction() override;
323 323
324 // AsyncApiFunction 324 // AsyncApiFunction
325 bool Prepare() override; 325 bool Prepare() override;
326 void AsyncWorkStart() override; 326 void AsyncWorkStart() override;
327 void OnCompleted(int result, 327 void OnCompleted(int result,
328 scoped_refptr<net::IOBuffer> io_buffer, 328 scoped_refptr<net::IOBuffer> io_buffer,
329 const std::string& address, 329 const std::string& address,
330 int port); 330 uint16 port);
331 331
332 private: 332 private:
333 scoped_ptr<core_api::socket::RecvFrom::Params> params_; 333 scoped_ptr<core_api::socket::RecvFrom::Params> params_;
334 }; 334 };
335 335
336 class SocketSendToFunction : public SocketExtensionWithDnsLookupFunction { 336 class SocketSendToFunction : public SocketExtensionWithDnsLookupFunction {
337 public: 337 public:
338 DECLARE_EXTENSION_FUNCTION("socket.sendTo", SOCKET_SENDTO) 338 DECLARE_EXTENSION_FUNCTION("socket.sendTo", SOCKET_SENDTO)
339 339
340 SocketSendToFunction(); 340 SocketSendToFunction();
341 341
342 protected: 342 protected:
343 ~SocketSendToFunction() override; 343 ~SocketSendToFunction() override;
344 344
345 // AsyncApiFunction: 345 // AsyncApiFunction:
346 bool Prepare() override; 346 bool Prepare() override;
347 void AsyncWorkStart() override; 347 void AsyncWorkStart() override;
348 void OnCompleted(int result); 348 void OnCompleted(int result);
349 349
350 // SocketExtensionWithDnsLookupFunction: 350 // SocketExtensionWithDnsLookupFunction:
351 void AfterDnsLookup(int lookup_result) override; 351 void AfterDnsLookup(int lookup_result) override;
352 352
353 private: 353 private:
354 void StartSendTo(); 354 void StartSendTo();
355 355
356 int socket_id_; 356 int socket_id_;
357 scoped_refptr<net::IOBuffer> io_buffer_; 357 scoped_refptr<net::IOBuffer> io_buffer_;
358 size_t io_buffer_size_; 358 size_t io_buffer_size_;
359 std::string hostname_; 359 std::string hostname_;
360 int port_; 360 uint16 port_;
361 }; 361 };
362 362
363 class SocketSetKeepAliveFunction : public SocketAsyncApiFunction { 363 class SocketSetKeepAliveFunction : public SocketAsyncApiFunction {
364 public: 364 public:
365 DECLARE_EXTENSION_FUNCTION("socket.setKeepAlive", SOCKET_SETKEEPALIVE) 365 DECLARE_EXTENSION_FUNCTION("socket.setKeepAlive", SOCKET_SETKEEPALIVE)
366 366
367 SocketSetKeepAliveFunction(); 367 SocketSetKeepAliveFunction();
368 368
369 protected: 369 protected:
370 ~SocketSetKeepAliveFunction() override; 370 ~SocketSetKeepAliveFunction() override;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 531
532 scoped_ptr<core_api::socket::Secure::Params> params_; 532 scoped_ptr<core_api::socket::Secure::Params> params_;
533 scoped_refptr<net::URLRequestContextGetter> url_request_getter_; 533 scoped_refptr<net::URLRequestContextGetter> url_request_getter_;
534 534
535 DISALLOW_COPY_AND_ASSIGN(SocketSecureFunction); 535 DISALLOW_COPY_AND_ASSIGN(SocketSecureFunction);
536 }; 536 };
537 537
538 } // namespace extensions 538 } // namespace extensions
539 539
540 #endif // EXTENSIONS_BROWSER_API_SOCKET_SOCKET_API_H_ 540 #endif // EXTENSIONS_BROWSER_API_SOCKET_SOCKET_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698