Index: extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc |
diff --git a/chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.cc b/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc |
similarity index 90% |
rename from chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.cc |
rename to extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc |
index f9d4a4885253df532c3212173b64e705218ebec0..fd042ba480e6d9cca67554336cc603591bb58be9 100644 |
--- a/chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.cc |
+++ b/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc |
@@ -2,9 +2,9 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.h" |
+#include "extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.h" |
-#include "chrome/browser/extensions/api/socket/tcp_socket.h" |
+#include "extensions/browser/api/socket/tcp_socket.h" |
#include "extensions/browser/event_router.h" |
#include "extensions/browser/extension_system.h" |
#include "extensions/browser/extensions_browser_client.h" |
@@ -15,7 +15,7 @@ int kDefaultBufferSize = 4096; |
} |
namespace extensions { |
-namespace api { |
+namespace core_api { |
using content::BrowserThread; |
@@ -42,10 +42,11 @@ TCPSocketEventDispatcher::TCPSocketEventDispatcher( |
: thread_id_(Socket::kThreadId), browser_context_(context) { |
ApiResourceManager<ResumableTCPSocket>* manager = |
ApiResourceManager<ResumableTCPSocket>::Get(browser_context_); |
- DCHECK(manager) << "There is no socket manager. " |
- "If this assertion is failing during a test, then it is likely that " |
- "TestExtensionSystem is failing to provide an instance of " |
- "ApiResourceManager<ResumableTCPSocket>."; |
+ DCHECK(manager) |
+ << "There is no socket manager. " |
+ "If this assertion is failing during a test, then it is likely that " |
+ "TestExtensionSystem is failing to provide an instance of " |
+ "ApiResourceManager<ResumableTCPSocket>."; |
sockets_ = manager->data_; |
} |
@@ -94,7 +95,7 @@ void TCPSocketEventDispatcher::StartRead(const ReadParams& params) { |
return; |
} |
DCHECK(params.extension_id == socket->owner_extension_id()) |
- << "Socket has wrong owner."; |
+ << "Socket has wrong owner."; |
// Don't start another read if the socket has been paused. |
if (socket->paused()) |
@@ -104,8 +105,7 @@ void TCPSocketEventDispatcher::StartRead(const ReadParams& params) { |
if (buffer_size <= 0) |
buffer_size = kDefaultBufferSize; |
socket->Read(buffer_size, |
- base::Bind(&TCPSocketEventDispatcher::ReadCallback, |
- params)); |
+ base::Bind(&TCPSocketEventDispatcher::ReadCallback, params)); |
} |
// static |
@@ -131,13 +131,14 @@ void TCPSocketEventDispatcher::ReadCallback( |
scoped_ptr<base::ListValue> args = |
sockets_tcp::OnReceive::Create(receive_info); |
scoped_ptr<Event> event( |
- new Event(sockets_tcp::OnReceive::kEventName, args.Pass())); |
+ new Event(sockets_tcp::OnReceive::kEventName, args.Pass())); |
PostEvent(params, event.Pass()); |
// Post a task to delay the read until the socket is available, as |
// calling StartReceive at this point would error with ERR_IO_PENDING. |
BrowserThread::PostTask( |
- params.thread_id, FROM_HERE, |
+ params.thread_id, |
+ FROM_HERE, |
base::Bind(&TCPSocketEventDispatcher::StartRead, params)); |
} else if (bytes_read == net::ERR_IO_PENDING) { |
// This happens when resuming a socket which already had an |
@@ -151,7 +152,7 @@ void TCPSocketEventDispatcher::ReadCallback( |
scoped_ptr<base::ListValue> args = |
sockets_tcp::OnReceiveError::Create(receive_error_info); |
scoped_ptr<Event> event( |
- new Event(sockets_tcp::OnReceiveError::kEventName, args.Pass())); |
+ new Event(sockets_tcp::OnReceiveError::kEventName, args.Pass())); |
PostEvent(params, event.Pass()); |
// Since we got an error, the socket is now "paused" until the application |
@@ -193,5 +194,5 @@ void TCPSocketEventDispatcher::DispatchEvent(void* browser_context_id, |
router->DispatchEventToExtension(extension_id, event.Pass()); |
} |
-} // namespace api |
+} // namespace core_api |
} // namespace extensions |