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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/extensions/chrome_extension_function.h"
14 class BluetoothAdapter;
18 namespace extensions {
22 // Base class for bluetooth extension functions. This class initializes
23 // bluetooth adapter and calls DoWork() implemented by individual bluetooth
24 // extension functions.
25 class BluetoothExtensionFunction : public ChromeAsyncExtensionFunction {
27 BluetoothExtensionFunction();
30 virtual ~BluetoothExtensionFunction();
33 virtual bool RunImpl() OVERRIDE;
36 void RunOnAdapterReady(scoped_refptr<device::BluetoothAdapter> adapter);
38 // Implemented by individual bluetooth extension functions, called
39 // automatically once |adapter| has been initialized.
40 virtual bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) = 0;
42 DISALLOW_COPY_AND_ASSIGN(BluetoothExtensionFunction);
47 } // namespace extensions
49 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_