| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ |
| 6 #define EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ | 6 #define EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "extensions/browser/api/api_resource_manager.h" | 8 #include "extensions/browser/api/api_resource_manager.h" |
| 9 #include "extensions/browser/api/sockets_udp/sockets_udp_api.h" | 9 #include "extensions/browser/api/sockets_udp/sockets_udp_api.h" |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 // Start a receive and register a callback. | 66 // Start a receive and register a callback. |
| 67 static void StartReceive(const ReceiveParams& params); | 67 static void StartReceive(const ReceiveParams& params); |
| 68 | 68 |
| 69 // Called when socket receive data. | 69 // Called when socket receive data. |
| 70 static void ReceiveCallback(const ReceiveParams& params, | 70 static void ReceiveCallback(const ReceiveParams& params, |
| 71 int bytes_read, | 71 int bytes_read, |
| 72 scoped_refptr<net::IOBuffer> io_buffer, | 72 scoped_refptr<net::IOBuffer> io_buffer, |
| 73 const std::string& address, | 73 const std::string& address, |
| 74 int port); | 74 uint16 port); |
| 75 | 75 |
| 76 // Post an extension event from IO to UI thread | 76 // Post an extension event from IO to UI thread |
| 77 static void PostEvent(const ReceiveParams& params, scoped_ptr<Event> event); | 77 static void PostEvent(const ReceiveParams& params, scoped_ptr<Event> event); |
| 78 | 78 |
| 79 // Dispatch an extension event on to EventRouter instance on UI thread. | 79 // Dispatch an extension event on to EventRouter instance on UI thread. |
| 80 static void DispatchEvent(void* browser_context_id, | 80 static void DispatchEvent(void* browser_context_id, |
| 81 const std::string& extension_id, | 81 const std::string& extension_id, |
| 82 scoped_ptr<Event> event); | 82 scoped_ptr<Event> event); |
| 83 | 83 |
| 84 // Usually IO thread (except for unit testing). | 84 // Usually IO thread (except for unit testing). |
| 85 content::BrowserThread::ID thread_id_; | 85 content::BrowserThread::ID thread_id_; |
| 86 content::BrowserContext* const browser_context_; | 86 content::BrowserContext* const browser_context_; |
| 87 scoped_refptr<SocketData> sockets_; | 87 scoped_refptr<SocketData> sockets_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace core_api | 90 } // namespace core_api |
| 91 } // namespace extensions | 91 } // namespace extensions |
| 92 | 92 |
| 93 #endif // EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ | 93 #endif // EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ |
| OLD | NEW |