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_CHROMEOS_EXTENSIONS_BLUETOOTH_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_BLUETOOTH_EVENT_ROUTER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_BLUETOOTH_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_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" |
(...skipping 25 matching lines...) Expand all Loading... |
36 scoped_refptr<BluetoothSocket> GetSocket(int id); | 36 scoped_refptr<BluetoothSocket> GetSocket(int id); |
37 | 37 |
38 // Sets whether or not DeviceAdded events will be dispatched to extensions. | 38 // Sets whether or not DeviceAdded events will be dispatched to extensions. |
39 void SetSendDiscoveryEvents(bool should_send); | 39 void SetSendDiscoveryEvents(bool should_send); |
40 | 40 |
41 // Override from chromeos::BluetoothAdapter::Observer | 41 // Override from chromeos::BluetoothAdapter::Observer |
42 virtual void AdapterPresentChanged(chromeos::BluetoothAdapter* adapter, | 42 virtual void AdapterPresentChanged(chromeos::BluetoothAdapter* adapter, |
43 bool present) OVERRIDE; | 43 bool present) OVERRIDE; |
44 virtual void AdapterPoweredChanged(chromeos::BluetoothAdapter* adapter, | 44 virtual void AdapterPoweredChanged(chromeos::BluetoothAdapter* adapter, |
45 bool has_power) OVERRIDE; | 45 bool has_power) OVERRIDE; |
| 46 virtual void AdapterDiscoveringChanged(chromeos::BluetoothAdapter* adapter, |
| 47 bool discovering) OVERRIDE; |
46 virtual void DeviceAdded(chromeos::BluetoothAdapter* adapter, | 48 virtual void DeviceAdded(chromeos::BluetoothAdapter* adapter, |
47 chromeos::BluetoothDevice* device) OVERRIDE; | 49 chromeos::BluetoothDevice* device) OVERRIDE; |
48 | 50 |
49 // Exposed for testing. | 51 // Exposed for testing. |
50 void SetAdapterForTest(chromeos::BluetoothAdapter* adapter) { | 52 void SetAdapterForTest(chromeos::BluetoothAdapter* adapter) { |
51 adapter_ = adapter; | 53 adapter_ = adapter; |
52 } | 54 } |
53 private: | 55 private: |
54 void DispatchBooleanValueEvent(const char* event_name, bool value); | 56 void DispatchBooleanValueEvent(const char* event_name, bool value); |
55 | 57 |
56 bool send_discovery_events_; | 58 bool send_discovery_events_; |
57 | 59 |
58 Profile* profile_; | 60 Profile* profile_; |
59 scoped_refptr<chromeos::BluetoothAdapter> adapter_; | 61 scoped_refptr<chromeos::BluetoothAdapter> adapter_; |
60 | 62 |
61 // The next id to use for referring to a BluetoothSocket. We avoid using | 63 // The next id to use for referring to a BluetoothSocket. We avoid using |
62 // the fd of the socket because we don't want to leak that information to | 64 // the fd of the socket because we don't want to leak that information to |
63 // the extension javascript. | 65 // the extension javascript. |
64 int next_socket_id_; | 66 int next_socket_id_; |
65 | 67 |
66 typedef std::map<int, scoped_refptr<BluetoothSocket> > SocketMap; | 68 typedef std::map<int, scoped_refptr<BluetoothSocket> > SocketMap; |
67 SocketMap socket_map_; | 69 SocketMap socket_map_; |
68 | 70 |
69 DISALLOW_COPY_AND_ASSIGN(ExtensionBluetoothEventRouter); | 71 DISALLOW_COPY_AND_ASSIGN(ExtensionBluetoothEventRouter); |
70 }; | 72 }; |
71 | 73 |
72 } // namespace chromeos | 74 } // namespace chromeos |
73 | 75 |
74 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_BLUETOOTH_EVENT_ROUTER_H_ | 76 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_BLUETOOTH_EVENT_ROUTER_H_ |
OLD | NEW |