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

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: Add error if trying to bind TCP socket, remove TCP client socket bind. Created 8 years, 3 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 bool Socket::SetKeepAlive(bool enable, int delay) { 82 bool Socket::SetKeepAlive(bool enable, int delay) {
83 return false; 83 return false;
84 } 84 }
85 85
86 bool Socket::SetNoDelay(bool no_delay) { 86 bool Socket::SetNoDelay(bool no_delay) {
87 return false; 87 return false;
88 } 88 }
89 89
90 int Socket::Listen(const std::string& address, int port, int backlog,
91 std::string* error_msg) {
miket_OOO 2012/09/24 18:14:21 Can you put NOTREACHED in here? I think we want to
justinlin 2012/09/26 08:59:59 Done. This will happen if you try to call listen/a
miket_OOO 2012/09/26 17:17:55 Oh, OK, then my request was in error. NOTREACHED i
justinlin 2012/09/26 20:53:12 Done. Yea, I agree NOT_IMPLEMENTED might not be th
92 return net::ERR_NOT_IMPLEMENTED;
93 }
94
95 void Socket::Accept(const AcceptCompletionCallback& callback) {
96 callback.Run(net::ERR_NOT_IMPLEMENTED, NULL);
miket_OOO 2012/09/24 18:14:21 Same.
justinlin 2012/09/26 08:59:59 Done.
97 }
98
90 // static 99 // static
91 bool Socket::StringAndPortToIPEndPoint(const std::string& ip_address_str, 100 bool Socket::StringAndPortToIPEndPoint(const std::string& ip_address_str,
92 int port, 101 int port,
93 net::IPEndPoint* ip_end_point) { 102 net::IPEndPoint* ip_end_point) {
94 DCHECK(ip_end_point); 103 DCHECK(ip_end_point);
95 net::IPAddressNumber ip_number; 104 net::IPAddressNumber ip_number;
96 if (!net::ParseIPLiteralToNumber(ip_address_str, &ip_number)) 105 if (!net::ParseIPLiteralToNumber(ip_address_str, &ip_number))
97 return false; 106 return false;
98 107
99 *ip_end_point = net::IPEndPoint(ip_number, port); 108 *ip_end_point = net::IPEndPoint(ip_number, port);
(...skipping 30 matching lines...) Expand all
130 const CompletionCallback& callback) 139 const CompletionCallback& callback)
131 : io_buffer(io_buffer), 140 : io_buffer(io_buffer),
132 byte_count(byte_count), 141 byte_count(byte_count),
133 callback(callback), 142 callback(callback),
134 bytes_written(0) { 143 bytes_written(0) {
135 } 144 }
136 145
137 Socket::WriteRequest::~WriteRequest() { } 146 Socket::WriteRequest::~WriteRequest() { }
138 147
139 } // namespace extensions 148 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698