| 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_TCP_TCP_SOCKET_EVENT_DISPATCHER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SOCKETS_TCP_TCP_SOCKET_EVENT_DISPATCHER_H_ |
| 6 #define EXTENSIONS_BROWSER_API_SOCKETS_TCP_TCP_SOCKET_EVENT_DISPATCHER_H_ | 6 #define EXTENSIONS_BROWSER_API_SOCKETS_TCP_TCP_SOCKET_EVENT_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "extensions/browser/api/api_resource_manager.h" | 10 #include "extensions/browser/api/api_resource_manager.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 // Start a receive and register a callback. | 72 // Start a receive and register a callback. |
| 73 static void StartRead(const ReadParams& params); | 73 static void StartRead(const ReadParams& params); |
| 74 | 74 |
| 75 // Called when socket receive data. | 75 // Called when socket receive data. |
| 76 static void ReadCallback(const ReadParams& params, | 76 static void ReadCallback(const ReadParams& params, |
| 77 int bytes_read, | 77 int bytes_read, |
| 78 scoped_refptr<net::IOBuffer> io_buffer); | 78 scoped_refptr<net::IOBuffer> io_buffer); |
| 79 | 79 |
| 80 // Post an extension event from IO to UI thread | 80 // Post an extension event from IO to UI thread |
| 81 static void PostEvent(const ReadParams& params, scoped_ptr<Event> event); | 81 static void PostEvent(const ReadParams& params, std::unique_ptr<Event> event); |
| 82 | 82 |
| 83 // Dispatch an extension event on to EventRouter instance on UI thread. | 83 // Dispatch an extension event on to EventRouter instance on UI thread. |
| 84 static void DispatchEvent(void* browser_context_id, | 84 static void DispatchEvent(void* browser_context_id, |
| 85 const std::string& extension_id, | 85 const std::string& extension_id, |
| 86 scoped_ptr<Event> event); | 86 std::unique_ptr<Event> event); |
| 87 | 87 |
| 88 // Usually IO thread (except for unit testing). | 88 // Usually IO thread (except for unit testing). |
| 89 content::BrowserThread::ID thread_id_; | 89 content::BrowserThread::ID thread_id_; |
| 90 content::BrowserContext* const browser_context_; | 90 content::BrowserContext* const browser_context_; |
| 91 scoped_refptr<SocketData> sockets_; | 91 scoped_refptr<SocketData> sockets_; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 } // namespace api | 94 } // namespace api |
| 95 } // namespace extensions | 95 } // namespace extensions |
| 96 | 96 |
| 97 #endif // EXTENSIONS_BROWSER_API_SOCKETS_TCP_TCP_SOCKET_EVENT_DISPATCHER_H_ | 97 #endif // EXTENSIONS_BROWSER_API_SOCKETS_TCP_TCP_SOCKET_EVENT_DISPATCHER_H_ |
| OLD | NEW |