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

Unified Diff: chrome/browser/extensions/api/socket/socket.cc

Issue 10273016: Refactor the socket API to remove onEvent callback in socket.create() function. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/socket/socket.h ('k') | chrome/browser/extensions/api/socket/socket_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/socket/socket.cc
diff --git a/chrome/browser/extensions/api/socket/socket.cc b/chrome/browser/extensions/api/socket/socket.cc
index be20438db232bd3d11dafd6386cfdf61e832b05f..60f3d8dd26350bd026dd700c1af158390675b960 100644
--- a/chrome/browser/extensions/api/socket/socket.cc
+++ b/chrome/browser/extensions/api/socket/socket.cc
@@ -25,30 +25,6 @@ Socket::~Socket() {
DCHECK(!is_connected_);
}
-void Socket::OnDataRead(scoped_refptr<net::IOBuffer> io_buffer,
- net::IPEndPoint* address,
- int result) {
- // OnDataRead will take ownership of data_value.
- ListValue* data_value = new ListValue();
- if (result >= 0) {
- size_t bytes_size = static_cast<size_t>(result);
- const char* io_buffer_start = io_buffer->data();
- for (size_t i = 0; i < bytes_size; ++i) {
- data_value->Set(i, Value::CreateIntegerValue(io_buffer_start[i]));
- }
- }
-
- std::string ip_address_str;
- int port = 0;
- if (address)
- IPEndPointToStringAndPort(*address, &ip_address_str, &port);
- event_notifier()->OnDataRead(result, data_value, ip_address_str, port);
-}
-
-void Socket::OnWriteComplete(int result) {
- event_notifier()->OnWriteComplete(result);
-}
-
// static
bool Socket::StringAndPortToIPEndPoint(const std::string& ip_address_str,
int port,
« no previous file with comments | « chrome/browser/extensions/api/socket/socket.h ('k') | chrome/browser/extensions/api/socket/socket_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698