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_SERIAL_SERIAL_EVENT_DISPATCHER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SERIAL_SERIAL_EVENT_DISPATCHER_H_ |
6 #define EXTENSIONS_BROWSER_API_SERIAL_SERIAL_EVENT_DISPATCHER_H_ | 6 #define EXTENSIONS_BROWSER_API_SERIAL_SERIAL_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/common/api/serial.h" | 11 #include "extensions/common/api/serial.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 | 18 |
19 struct Event; | 19 struct Event; |
20 class SerialConnection; | 20 class SerialConnection; |
21 | 21 |
22 namespace core_api { | 22 namespace core_api { |
23 | 23 |
24 // Per-browser-context dispatcher for events on serial connections. | 24 // Per-browser-context dispatcher for events on serial connections. |
25 class SerialEventDispatcher : public BrowserContextKeyedAPI { | 25 class SerialEventDispatcher : public BrowserContextKeyedAPI { |
26 public: | 26 public: |
27 explicit SerialEventDispatcher(content::BrowserContext* context); | 27 explicit SerialEventDispatcher(content::BrowserContext* context); |
28 virtual ~SerialEventDispatcher(); | 28 ~SerialEventDispatcher() override; |
29 | 29 |
30 // Start receiving data and firing events for a connection. | 30 // Start receiving data and firing events for a connection. |
31 void PollConnection(const std::string& extension_id, int connection_id); | 31 void PollConnection(const std::string& extension_id, int connection_id); |
32 | 32 |
33 static SerialEventDispatcher* Get(content::BrowserContext* context); | 33 static SerialEventDispatcher* Get(content::BrowserContext* context); |
34 | 34 |
35 // BrowserContextKeyedAPI implementation. | 35 // BrowserContextKeyedAPI implementation. |
36 static BrowserContextKeyedAPIFactory<SerialEventDispatcher>* | 36 static BrowserContextKeyedAPIFactory<SerialEventDispatcher>* |
37 GetFactoryInstance(); | 37 GetFactoryInstance(); |
38 | 38 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 content::BrowserThread::ID thread_id_; | 72 content::BrowserThread::ID thread_id_; |
73 content::BrowserContext* const context_; | 73 content::BrowserContext* const context_; |
74 scoped_refptr<ConnectionData> connections_; | 74 scoped_refptr<ConnectionData> connections_; |
75 }; | 75 }; |
76 | 76 |
77 } // namespace core_api | 77 } // namespace core_api |
78 | 78 |
79 } // namespace extensions | 79 } // namespace extensions |
80 | 80 |
81 #endif // EXTENSIONS_BROWSER_API_SERIAL_SERIAL_EVENT_DISPATCHER_H_ | 81 #endif // EXTENSIONS_BROWSER_API_SERIAL_SERIAL_EVENT_DISPATCHER_H_ |
OLD | NEW |