| 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_EXTENSION_FUNCTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ | 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "extensions/browser/extension_function.h" | 10 #include "extensions/browser/extension_function.h" |
| 11 | 11 |
| 12 namespace device { | 12 namespace device { |
| 13 | 13 |
| 14 class BluetoothAdapter; | 14 class BluetoothAdapter; |
| 15 | 15 |
| 16 } // namespace device | 16 } // namespace device |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 namespace api { | 19 namespace core_api { |
| 20 | 20 |
| 21 // Base class for bluetooth extension functions. This class initializes | 21 // Base class for bluetooth extension functions. This class initializes |
| 22 // bluetooth adapter and calls (on the UI thread) DoWork() implemented by | 22 // bluetooth adapter and calls (on the UI thread) DoWork() implemented by |
| 23 // individual bluetooth extension functions. | 23 // individual bluetooth extension functions. |
| 24 class BluetoothExtensionFunction : public AsyncExtensionFunction { | 24 class BluetoothExtensionFunction : public AsyncExtensionFunction { |
| 25 public: | 25 public: |
| 26 BluetoothExtensionFunction(); | 26 BluetoothExtensionFunction(); |
| 27 | 27 |
| 28 protected: | 28 protected: |
| 29 virtual ~BluetoothExtensionFunction(); | 29 virtual ~BluetoothExtensionFunction(); |
| 30 | 30 |
| 31 // ExtensionFunction: | 31 // ExtensionFunction: |
| 32 virtual bool RunAsync() OVERRIDE; | 32 virtual bool RunAsync() OVERRIDE; |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 void RunOnAdapterReady(scoped_refptr<device::BluetoothAdapter> adapter); | 35 void RunOnAdapterReady(scoped_refptr<device::BluetoothAdapter> adapter); |
| 36 | 36 |
| 37 // Implemented by individual bluetooth extension functions, called | 37 // Implemented by individual bluetooth extension functions, called |
| 38 // automatically on the UI thread once |adapter| has been initialized. | 38 // automatically on the UI thread once |adapter| has been initialized. |
| 39 virtual bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) = 0; | 39 virtual bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) = 0; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(BluetoothExtensionFunction); | 41 DISALLOW_COPY_AND_ASSIGN(BluetoothExtensionFunction); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 } // namespace api | 44 } // namespace core_api |
| 45 } // namespace extensions | 45 } // namespace extensions |
| 46 | 46 |
| 47 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_
H_ | 47 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ |
| OLD | NEW |