| 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 EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ |
| 6 #define EXTENSIONS_BROWSER_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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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 ~BluetoothExtensionFunction() override; | 29 ~BluetoothExtensionFunction() override; |
| 30 | 30 |
| 31 // ExtensionFunction: | 31 // ExtensionFunction: |
| 32 bool RunAsync() override; | 32 bool RunAsync() override; |
| 33 | 33 |
| 34 // Use instead of extension_id() so that this can be run from WebUI. |
| 35 std::string GetExtensionId(); |
| 36 |
| 34 private: | 37 private: |
| 35 void RunOnAdapterReady(scoped_refptr<device::BluetoothAdapter> adapter); | 38 void RunOnAdapterReady(scoped_refptr<device::BluetoothAdapter> adapter); |
| 36 | 39 |
| 37 // Implemented by individual bluetooth extension functions, called | 40 // Implemented by individual bluetooth extension functions, called |
| 38 // automatically on the UI thread once |adapter| has been initialized. | 41 // automatically on the UI thread once |adapter| has been initialized. |
| 39 virtual bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) = 0; | 42 virtual bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) = 0; |
| 40 | 43 |
| 41 DISALLOW_COPY_AND_ASSIGN(BluetoothExtensionFunction); | 44 DISALLOW_COPY_AND_ASSIGN(BluetoothExtensionFunction); |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 } // namespace api | 47 } // namespace api |
| 45 } // namespace extensions | 48 } // namespace extensions |
| 46 | 49 |
| 47 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ | 50 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ |
| OLD | NEW |