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_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHE
R_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHE
R_H_ |
6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHE
R_H_ | 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHE
R_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/bluetooth_socket/bluetooth_api_socket.h" | 9 #include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" |
10 #include "extensions/browser/browser_context_keyed_api_factory.h" | 10 #include "extensions/browser/browser_context_keyed_api_factory.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 namespace extensions { | 26 namespace extensions { |
27 namespace core_api { | 27 namespace core_api { |
28 | 28 |
29 // Dispatch events related to "bluetooth" sockets from callback on native socket | 29 // Dispatch events related to "bluetooth" sockets from callback on native socket |
30 // instances. There is one instance per browser context. | 30 // instances. There is one instance per browser context. |
31 class BluetoothSocketEventDispatcher | 31 class BluetoothSocketEventDispatcher |
32 : public BrowserContextKeyedAPI, | 32 : public BrowserContextKeyedAPI, |
33 public base::SupportsWeakPtr<BluetoothSocketEventDispatcher> { | 33 public base::SupportsWeakPtr<BluetoothSocketEventDispatcher> { |
34 public: | 34 public: |
35 explicit BluetoothSocketEventDispatcher(content::BrowserContext* context); | 35 explicit BluetoothSocketEventDispatcher(content::BrowserContext* context); |
36 virtual ~BluetoothSocketEventDispatcher(); | 36 ~BluetoothSocketEventDispatcher() override; |
37 | 37 |
38 // Socket is active, start receiving data from it. | 38 // Socket is active, start receiving data from it. |
39 void OnSocketConnect(const std::string& extension_id, int socket_id); | 39 void OnSocketConnect(const std::string& extension_id, int socket_id); |
40 | 40 |
41 // Socket is active again, start accepting connections from it. | 41 // Socket is active again, start accepting connections from it. |
42 void OnSocketListen(const std::string& extension_id, int socket_id); | 42 void OnSocketListen(const std::string& extension_id, int socket_id); |
43 | 43 |
44 // Socket is active again, start receiving data from it. | 44 // Socket is active again, start receiving data from it. |
45 void OnSocketResume(const std::string& extension_id, int socket_id); | 45 void OnSocketResume(const std::string& extension_id, int socket_id); |
46 | 46 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // Usually FILE thread (except for unit testing). | 110 // Usually FILE thread (except for unit testing). |
111 content::BrowserThread::ID thread_id_; | 111 content::BrowserThread::ID thread_id_; |
112 content::BrowserContext* const browser_context_; | 112 content::BrowserContext* const browser_context_; |
113 scoped_refptr<SocketData> sockets_; | 113 scoped_refptr<SocketData> sockets_; |
114 }; | 114 }; |
115 | 115 |
116 } // namespace core_api | 116 } // namespace core_api |
117 } // namespace extensions | 117 } // namespace extensions |
118 | 118 |
119 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPAT
CHER_H_ | 119 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPAT
CHER_H_ |
OLD | NEW |