OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "chrome/common/extensions/api/bluetooth.h" | 12 #include "chrome/common/extensions/api/bluetooth.h" |
13 #include "device/bluetooth/bluetooth_adapter.h" | 13 #include "device/bluetooth/bluetooth_adapter.h" |
14 #include "device/bluetooth/bluetooth_socket.h" | 14 #include "device/bluetooth/bluetooth_socket.h" |
15 | 15 |
16 class Profile; | 16 class Profile; |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 | 19 |
20 class ExtensionBluetoothEventRouter | 20 class ExtensionBluetoothEventRouter |
21 : public device::BluetoothAdapter::Observer { | 21 : public device::BluetoothAdapter::Observer { |
22 public: | 22 public: |
23 explicit ExtensionBluetoothEventRouter(Profile* profile); | 23 explicit ExtensionBluetoothEventRouter(Profile* profile); |
24 virtual ~ExtensionBluetoothEventRouter(); | 24 virtual ~ExtensionBluetoothEventRouter(); |
25 | 25 |
26 // adapter() will return NULL if the bluetooth adapter is not supported in the | 26 // GetAdapter will return NULL if the bluetooth adapter is not |
27 // current platform. | |
28 scoped_refptr<const device::BluetoothAdapter> adapter(); | |
29 | |
30 // GetMutableAdapter will return NULL if the bluetooth adapter is not | |
31 // supported in the current platform. | 27 // supported in the current platform. |
32 scoped_refptr<device::BluetoothAdapter> GetMutableAdapter(); | 28 scoped_refptr<device::BluetoothAdapter> GetAdapter(); |
33 | 29 |
34 // Called when a bluetooth event listener is added. | 30 // Called when a bluetooth event listener is added. |
35 void OnListenerAdded(); | 31 void OnListenerAdded(); |
36 | 32 |
37 // Called when a bluetooth event listener is removed. | 33 // Called when a bluetooth event listener is removed. |
38 void OnListenerRemoved(); | 34 void OnListenerRemoved(); |
39 | 35 |
40 // Register the BluetoothSocket |socket| for use by the extensions system. | 36 // Register the BluetoothSocket |socket| for use by the extensions system. |
41 // This class will hold onto the socket for its lifetime, or until | 37 // This class will hold onto the socket for its lifetime, or until |
42 // ReleaseSocket is called for the socket. Returns an id for the socket. | 38 // ReleaseSocket is called for the socket. Returns an id for the socket. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 typedef ScopedVector<extensions::api::bluetooth::Device> | 96 typedef ScopedVector<extensions::api::bluetooth::Device> |
101 DeviceList; | 97 DeviceList; |
102 DeviceList discovered_devices_; | 98 DeviceList discovered_devices_; |
103 | 99 |
104 DISALLOW_COPY_AND_ASSIGN(ExtensionBluetoothEventRouter); | 100 DISALLOW_COPY_AND_ASSIGN(ExtensionBluetoothEventRouter); |
105 }; | 101 }; |
106 | 102 |
107 } // namespace extensions | 103 } // namespace extensions |
108 | 104 |
109 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ | 105 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ |
OLD | NEW |