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

Unified Diff: extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc

Issue 183893041: Move sockets APIs out of src/chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename api targets Created 6 years, 9 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 | « extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h ('k') | extensions/common/api/api.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h ('k') | extensions/common/api/api.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698