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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" | 10 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 class ExtensionBluetoothEventRouter | 15 class ExtensionBluetoothEventRouter |
16 : public chromeos::BluetoothAdapter::Observer { | 16 : public chromeos::BluetoothAdapter::Observer { |
17 public: | 17 public: |
18 explicit ExtensionBluetoothEventRouter(Profile* profile); | 18 explicit ExtensionBluetoothEventRouter(Profile* profile); |
19 virtual ~ExtensionBluetoothEventRouter(); | 19 virtual ~ExtensionBluetoothEventRouter(); |
20 | 20 |
21 const chromeos::BluetoothAdapter* adapter() const { return adapter_.get(); } | 21 const chromeos::BluetoothAdapter* adapter() const { return adapter_.get(); } |
| 22 chromeos::BluetoothAdapter* GetMutableAdapter() { return adapter_.get(); } |
22 | 23 |
23 // Override from chromeos::BluetoothAdapter::Observer | 24 // Override from chromeos::BluetoothAdapter::Observer |
24 virtual void AdapterPresentChanged( | 25 virtual void AdapterPresentChanged( |
25 chromeos::BluetoothAdapter* adapter, bool present) OVERRIDE; | 26 chromeos::BluetoothAdapter* adapter, bool present) OVERRIDE; |
26 virtual void AdapterPoweredChanged( | 27 virtual void AdapterPoweredChanged( |
27 chromeos::BluetoothAdapter* adapter, bool has_power) OVERRIDE; | 28 chromeos::BluetoothAdapter* adapter, bool has_power) OVERRIDE; |
28 private: | 29 private: |
29 void DispatchEvent(const char* event_name, bool value); | 30 void DispatchEvent(const char* event_name, bool value); |
30 | 31 |
31 Profile* profile_; | 32 Profile* profile_; |
32 scoped_ptr<chromeos::BluetoothAdapter> adapter_; | 33 scoped_ptr<chromeos::BluetoothAdapter> adapter_; |
33 DISALLOW_COPY_AND_ASSIGN(ExtensionBluetoothEventRouter); | 34 DISALLOW_COPY_AND_ASSIGN(ExtensionBluetoothEventRouter); |
34 }; | 35 }; |
35 | 36 |
36 } // namespace chromeos | 37 } // namespace chromeos |
37 | 38 |
38 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_BLUETOOTH_EVENT_ROUTER_H_ | 39 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_BLUETOOTH_EVENT_ROUTER_H_ |
OLD | NEW |