| 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_SERVER_TCP_SERVER_SOCKET_EVENT_DISPAT
CHER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SOCKETS_TCP_SERVER_TCP_SERVER_SOCKET_EVENT_DISPAT
CHER_H_ |
| 6 #define EXTENSIONS_BROWSER_API_SOCKETS_TCP_SERVER_TCP_SERVER_SOCKET_EVENT_DISPAT
CHER_H_ | 6 #define EXTENSIONS_BROWSER_API_SOCKETS_TCP_SERVER_TCP_SERVER_SOCKET_EVENT_DISPAT
CHER_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_tcp/sockets_tcp_api.h" | 9 #include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h" |
| 10 #include "extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.h" | 10 #include "extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 // Start an accept and register a callback. | 72 // Start an accept and register a callback. |
| 73 void StartSocketAccept(const std::string& extension_id, int socket_id); | 73 void StartSocketAccept(const std::string& extension_id, int socket_id); |
| 74 | 74 |
| 75 // Start an accept and register a callback. | 75 // Start an accept and register a callback. |
| 76 static void StartAccept(const AcceptParams& params); | 76 static void StartAccept(const AcceptParams& params); |
| 77 | 77 |
| 78 // Called when socket accepts a new connection. | 78 // Called when socket accepts a new connection. |
| 79 static void AcceptCallback(const AcceptParams& params, | 79 static void AcceptCallback(const AcceptParams& params, |
| 80 int result_code, | 80 int result_code, |
| 81 scoped_ptr<net::TCPClientSocket> socket); | 81 std::unique_ptr<net::TCPClientSocket> socket); |
| 82 | 82 |
| 83 // Post an extension event from |thread_id| to UI thread | 83 // Post an extension event from |thread_id| to UI thread |
| 84 static void PostEvent(const AcceptParams& params, scoped_ptr<Event> event); | 84 static void PostEvent(const AcceptParams& params, |
| 85 std::unique_ptr<Event> event); |
| 85 | 86 |
| 86 // Dispatch an extension event on to EventRouter instance on UI thread. | 87 // Dispatch an extension event on to EventRouter instance on UI thread. |
| 87 static void DispatchEvent(void* browser_context_id, | 88 static void DispatchEvent(void* browser_context_id, |
| 88 const std::string& extension_id, | 89 const std::string& extension_id, |
| 89 scoped_ptr<Event> event); | 90 std::unique_ptr<Event> event); |
| 90 | 91 |
| 91 // Usually IO thread (except for unit testing). | 92 // Usually IO thread (except for unit testing). |
| 92 content::BrowserThread::ID thread_id_; | 93 content::BrowserThread::ID thread_id_; |
| 93 content::BrowserContext* const browser_context_; | 94 content::BrowserContext* const browser_context_; |
| 94 scoped_refptr<ServerSocketData> server_sockets_; | 95 scoped_refptr<ServerSocketData> server_sockets_; |
| 95 scoped_refptr<ClientSocketData> client_sockets_; | 96 scoped_refptr<ClientSocketData> client_sockets_; |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 } // namespace api | 99 } // namespace api |
| 99 } // namespace extensions | 100 } // namespace extensions |
| 100 | 101 |
| 101 #endif // EXTENSIONS_BROWSER_API_SOCKETS_TCP_SERVER_TCP_SERVER_SOCKET_EVENT_DIS
PATCHER_H_ | 102 #endif // EXTENSIONS_BROWSER_API_SOCKETS_TCP_SERVER_TCP_SERVER_SOCKET_EVENT_DIS
PATCHER_H_ |
| OLD | NEW |