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" |
11 #include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h" | 11 #include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class BrowserContext; | 14 class BrowserContext; |
15 } | 15 } |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 struct Event; | 18 struct Event; |
19 class ResumableTCPSocket; | 19 class ResumableTCPSocket; |
20 } | 20 } |
21 | 21 |
22 namespace extensions { | 22 namespace extensions { |
23 namespace core_api { | 23 namespace api { |
24 | 24 |
25 // Dispatch events related to "sockets.tcp" sockets from callback on native | 25 // Dispatch events related to "sockets.tcp" sockets from callback on native |
26 // socket instances. There is one instance per profile. | 26 // socket instances. There is one instance per profile. |
27 class TCPSocketEventDispatcher | 27 class TCPSocketEventDispatcher |
28 : public BrowserContextKeyedAPI, | 28 : public BrowserContextKeyedAPI, |
29 public base::SupportsWeakPtr<TCPSocketEventDispatcher> { | 29 public base::SupportsWeakPtr<TCPSocketEventDispatcher> { |
30 public: | 30 public: |
31 explicit TCPSocketEventDispatcher(content::BrowserContext* context); | 31 explicit TCPSocketEventDispatcher(content::BrowserContext* context); |
32 ~TCPSocketEventDispatcher() override; | 32 ~TCPSocketEventDispatcher() override; |
33 | 33 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 static void DispatchEvent(void* browser_context_id, | 83 static void DispatchEvent(void* browser_context_id, |
84 const std::string& extension_id, | 84 const std::string& extension_id, |
85 scoped_ptr<Event> event); | 85 scoped_ptr<Event> event); |
86 | 86 |
87 // Usually IO thread (except for unit testing). | 87 // Usually IO thread (except for unit testing). |
88 content::BrowserThread::ID thread_id_; | 88 content::BrowserThread::ID thread_id_; |
89 content::BrowserContext* const browser_context_; | 89 content::BrowserContext* const browser_context_; |
90 scoped_refptr<SocketData> sockets_; | 90 scoped_refptr<SocketData> sockets_; |
91 }; | 91 }; |
92 | 92 |
93 } // namespace core_api | 93 } // namespace api |
94 } // namespace extensions | 94 } // namespace extensions |
95 | 95 |
96 #endif // EXTENSIONS_BROWSER_API_SOCKETS_TCP_TCP_SOCKET_EVENT_DISPATCHER_H_ | 96 #endif // EXTENSIONS_BROWSER_API_SOCKETS_TCP_TCP_SOCKET_EVENT_DISPATCHER_H_ |
OLD | NEW |