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

Side by Side Diff: chrome/browser/extensions/api/socket/socket.cc

Issue 10827390: Implement chrome.socket.bind/listen/accept for TCP server socket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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 | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/extensions/api/socket/socket.h" 5 #include "chrome/browser/extensions/api/socket/socket.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" 8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h"
9 #include "net/base/address_list.h" 9 #include "net/base/address_list.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 bool Socket::SetKeepAlive(bool enable, int delay) { 81 bool Socket::SetKeepAlive(bool enable, int delay) {
82 return false; 82 return false;
83 } 83 }
84 84
85 bool Socket::SetNoDelay(bool no_delay) { 85 bool Socket::SetNoDelay(bool no_delay) {
86 return false; 86 return false;
87 } 87 }
88 88
89 bool Socket::Listen(int backlog) {
90 return net::ERR_NOT_IMPLEMENTED;
91 }
92
93 void Socket::Accept(const AcceptCompletionCallback &callback) {
miket_OOO 2012/08/31 23:18:01 whitespace (& callback)
justinlin 2012/09/11 04:32:32 Done.
94 callback.Run(net::ERR_NOT_IMPLEMENTED, NULL);
95 }
96
89 // static 97 // static
90 bool Socket::StringAndPortToIPEndPoint(const std::string& ip_address_str, 98 bool Socket::StringAndPortToIPEndPoint(const std::string& ip_address_str,
91 int port, 99 int port,
92 net::IPEndPoint* ip_end_point) { 100 net::IPEndPoint* ip_end_point) {
93 DCHECK(ip_end_point); 101 DCHECK(ip_end_point);
94 net::IPAddressNumber ip_number; 102 net::IPAddressNumber ip_number;
95 if (!net::ParseIPLiteralToNumber(ip_address_str, &ip_number)) 103 if (!net::ParseIPLiteralToNumber(ip_address_str, &ip_number))
96 return false; 104 return false;
97 105
98 *ip_end_point = net::IPEndPoint(ip_number, port); 106 *ip_end_point = net::IPEndPoint(ip_number, port);
(...skipping 19 matching lines...) Expand all
118 DCHECK(port); 126 DCHECK(port);
119 *ip_address_str = address.ToStringWithoutPort(); 127 *ip_address_str = address.ToStringWithoutPort();
120 if (ip_address_str->empty()) { 128 if (ip_address_str->empty()) {
121 *port = 0; 129 *port = 0;
122 } else { 130 } else {
123 *port = address.port(); 131 *port = address.port();
124 } 132 }
125 } 133 }
126 134
127 } // namespace extensions 135 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698