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 <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_udp/sockets_udp_api.h" | 11 #include "extensions/browser/api/sockets_udp/sockets_udp_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 ResumableUDPSocket; | 19 class ResumableUDPSocket; |
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.udp" sockets from callback on native | 25 // Dispatch events related to "sockets.udp" 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 UDPSocketEventDispatcher | 27 class UDPSocketEventDispatcher |
28 : public BrowserContextKeyedAPI, | 28 : public BrowserContextKeyedAPI, |
29 public base::SupportsWeakPtr<UDPSocketEventDispatcher> { | 29 public base::SupportsWeakPtr<UDPSocketEventDispatcher> { |
30 public: | 30 public: |
31 explicit UDPSocketEventDispatcher(content::BrowserContext* context); | 31 explicit UDPSocketEventDispatcher(content::BrowserContext* context); |
32 ~UDPSocketEventDispatcher() override; | 32 ~UDPSocketEventDispatcher() override; |
33 | 33 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 static void DispatchEvent(void* browser_context_id, | 82 static void DispatchEvent(void* browser_context_id, |
83 const std::string& extension_id, | 83 const std::string& extension_id, |
84 scoped_ptr<Event> event); | 84 scoped_ptr<Event> event); |
85 | 85 |
86 // Usually IO thread (except for unit testing). | 86 // Usually IO thread (except for unit testing). |
87 content::BrowserThread::ID thread_id_; | 87 content::BrowserThread::ID thread_id_; |
88 content::BrowserContext* const browser_context_; | 88 content::BrowserContext* const browser_context_; |
89 scoped_refptr<SocketData> sockets_; | 89 scoped_refptr<SocketData> sockets_; |
90 }; | 90 }; |
91 | 91 |
92 } // namespace core_api | 92 } // namespace api |
93 } // namespace extensions | 93 } // namespace extensions |
94 | 94 |
95 #endif // EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ | 95 #endif // EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ |
OLD | NEW |