| Index: extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc
|
| diff --git a/chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.cc b/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc
|
| similarity index 88%
|
| rename from chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.cc
|
| rename to extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc
|
| index ae105e66979fe0e4b9d2ab2ce3b721bdec4be398..7df02709790a34b547c1fc1968c4d5352d019f32 100644
|
| --- a/chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.cc
|
| +++ b/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc
|
| @@ -2,16 +2,16 @@
|
| // 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_udp/udp_socket_event_dispatcher.h"
|
| +#include "extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h"
|
|
|
| -#include "chrome/browser/extensions/api/socket/udp_socket.h"
|
| +#include "extensions/browser/api/socket/udp_socket.h"
|
| #include "extensions/browser/event_router.h"
|
| #include "extensions/browser/extension_system.h"
|
| #include "extensions/browser/extensions_browser_client.h"
|
| #include "net/base/net_errors.h"
|
|
|
| namespace extensions {
|
| -namespace api {
|
| +namespace core_api {
|
|
|
| using content::BrowserThread;
|
|
|
| @@ -38,10 +38,11 @@ UDPSocketEventDispatcher::UDPSocketEventDispatcher(
|
| : thread_id_(Socket::kThreadId), browser_context_(context) {
|
| ApiResourceManager<ResumableUDPSocket>* manager =
|
| ApiResourceManager<ResumableUDPSocket>::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<ResumableUDPSocket>.";
|
| + 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<ResumableUDPSocket>.";
|
| sockets_ = manager->data_;
|
| }
|
|
|
| @@ -81,16 +82,16 @@ void UDPSocketEventDispatcher::StartReceive(const ReceiveParams& 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())
|
| return;
|
|
|
| int buffer_size = (socket->buffer_size() <= 0 ? 4096 : socket->buffer_size());
|
| - socket->RecvFrom(buffer_size,
|
| - base::Bind(&UDPSocketEventDispatcher::ReceiveCallback,
|
| - params));
|
| + socket->RecvFrom(
|
| + buffer_size,
|
| + base::Bind(&UDPSocketEventDispatcher::ReceiveCallback, params));
|
| }
|
|
|
| /* static */
|
| @@ -116,13 +117,14 @@ void UDPSocketEventDispatcher::ReceiveCallback(
|
| scoped_ptr<base::ListValue> args =
|
| sockets_udp::OnReceive::Create(receive_info);
|
| scoped_ptr<Event> event(
|
| - new Event(sockets_udp::OnReceive::kEventName, args.Pass()));
|
| + new Event(sockets_udp::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(&UDPSocketEventDispatcher::StartReceive, params));
|
| } else if (bytes_read == net::ERR_IO_PENDING) {
|
| // This happens when resuming a socket which already had an
|
| @@ -136,7 +138,7 @@ void UDPSocketEventDispatcher::ReceiveCallback(
|
| scoped_ptr<base::ListValue> args =
|
| sockets_udp::OnReceiveError::Create(receive_error_info);
|
| scoped_ptr<Event> event(
|
| - new Event(sockets_udp::OnReceiveError::kEventName, args.Pass()));
|
| + new Event(sockets_udp::OnReceiveError::kEventName, args.Pass()));
|
| PostEvent(params, event.Pass());
|
|
|
| // Since we got an error, the socket is now "paused" until the application
|
| @@ -177,5 +179,5 @@ void UDPSocketEventDispatcher::DispatchEvent(void* browser_context_id,
|
| router->DispatchEventToExtension(extension_id, event.Pass());
|
| }
|
|
|
| -} // namespace api
|
| +} // namespace core_api
|
| } // namespace extensions
|
|
|