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 10 matching lines...) Expand all Loading... |
21 namespace extensions { | 21 namespace extensions { |
22 namespace core_api { | 22 namespace core_api { |
23 | 23 |
24 // Dispatch events related to "sockets.tcp" sockets from callback on native | 24 // Dispatch events related to "sockets.tcp" sockets from callback on native |
25 // socket instances. There is one instance per profile. | 25 // socket instances. There is one instance per profile. |
26 class TCPServerSocketEventDispatcher | 26 class TCPServerSocketEventDispatcher |
27 : public BrowserContextKeyedAPI, | 27 : public BrowserContextKeyedAPI, |
28 public base::SupportsWeakPtr<TCPServerSocketEventDispatcher> { | 28 public base::SupportsWeakPtr<TCPServerSocketEventDispatcher> { |
29 public: | 29 public: |
30 explicit TCPServerSocketEventDispatcher(content::BrowserContext* context); | 30 explicit TCPServerSocketEventDispatcher(content::BrowserContext* context); |
31 virtual ~TCPServerSocketEventDispatcher(); | 31 ~TCPServerSocketEventDispatcher() override; |
32 | 32 |
33 // Server socket is active, start accepting connections from it. | 33 // Server socket is active, start accepting connections from it. |
34 void OnServerSocketListen(const std::string& extension_id, int socket_id); | 34 void OnServerSocketListen(const std::string& extension_id, int socket_id); |
35 | 35 |
36 // Server socket is active again, start accepting connections from it. | 36 // Server socket is active again, start accepting connections from it. |
37 void OnServerSocketResume(const std::string& extension_id, int socket_id); | 37 void OnServerSocketResume(const std::string& extension_id, int socket_id); |
38 | 38 |
39 // BrowserContextKeyedAPI implementation. | 39 // BrowserContextKeyedAPI implementation. |
40 static BrowserContextKeyedAPIFactory<TCPServerSocketEventDispatcher>* | 40 static BrowserContextKeyedAPIFactory<TCPServerSocketEventDispatcher>* |
41 GetFactoryInstance(); | 41 GetFactoryInstance(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 content::BrowserThread::ID thread_id_; | 91 content::BrowserThread::ID thread_id_; |
92 content::BrowserContext* const browser_context_; | 92 content::BrowserContext* const browser_context_; |
93 scoped_refptr<ServerSocketData> server_sockets_; | 93 scoped_refptr<ServerSocketData> server_sockets_; |
94 scoped_refptr<ClientSocketData> client_sockets_; | 94 scoped_refptr<ClientSocketData> client_sockets_; |
95 }; | 95 }; |
96 | 96 |
97 } // namespace core_api | 97 } // namespace core_api |
98 } // namespace extensions | 98 } // namespace extensions |
99 | 99 |
100 #endif // EXTENSIONS_BROWSER_API_SOCKETS_TCP_SERVER_TCP_SERVER_SOCKET_EVENT_DIS
PATCHER_H_ | 100 #endif // EXTENSIONS_BROWSER_API_SOCKETS_TCP_SERVER_TCP_SERVER_SOCKET_EVENT_DIS
PATCHER_H_ |
OLD | NEW |