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 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "extensions/browser/api/api_resource_manager.h" | 11 #include "extensions/browser/api/api_resource_manager.h" |
12 #include "extensions/common/api/serial.h" | 12 #include "extensions/common/api/serial.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class BrowserContext; | 15 class BrowserContext; |
16 } | 16 } |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 | 19 |
20 struct Event; | 20 struct Event; |
21 class SerialConnection; | 21 class SerialConnection; |
22 | 22 |
23 namespace core_api { | 23 namespace api { |
24 | 24 |
25 // Per-browser-context dispatcher for events on serial connections. | 25 // Per-browser-context dispatcher for events on serial connections. |
26 class SerialEventDispatcher : public BrowserContextKeyedAPI { | 26 class SerialEventDispatcher : public BrowserContextKeyedAPI { |
27 public: | 27 public: |
28 explicit SerialEventDispatcher(content::BrowserContext* context); | 28 explicit SerialEventDispatcher(content::BrowserContext* context); |
29 ~SerialEventDispatcher() override; | 29 ~SerialEventDispatcher() override; |
30 | 30 |
31 // Start receiving data and firing events for a connection. | 31 // Start receiving data and firing events for a connection. |
32 void PollConnection(const std::string& extension_id, int connection_id); | 32 void PollConnection(const std::string& extension_id, int connection_id); |
33 | 33 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 static void DispatchEvent(void* browser_context_id, | 69 static void DispatchEvent(void* browser_context_id, |
70 const std::string& extension_id, | 70 const std::string& extension_id, |
71 scoped_ptr<extensions::Event> event); | 71 scoped_ptr<extensions::Event> event); |
72 | 72 |
73 content::BrowserThread::ID thread_id_; | 73 content::BrowserThread::ID thread_id_; |
74 content::BrowserContext* const context_; | 74 content::BrowserContext* const context_; |
75 scoped_refptr<ConnectionData> connections_; | 75 scoped_refptr<ConnectionData> connections_; |
76 }; | 76 }; |
77 | 77 |
78 } // namespace core_api | 78 } // namespace api |
79 | 79 |
80 } // namespace extensions | 80 } // namespace extensions |
81 | 81 |
82 #endif // EXTENSIONS_BROWSER_API_SERIAL_SERIAL_EVENT_DISPATCHER_H_ | 82 #endif // EXTENSIONS_BROWSER_API_SERIAL_SERIAL_EVENT_DISPATCHER_H_ |
OLD | NEW |