OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 #ifndef DEVICE_BLUETOOTH_ADAPTER_FACTORY_H_ |
| 6 #define DEVICE_BLUETOOTH_ADAPTER_FACTORY_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "device/bluetooth/bluetooth_adapter.h" |
| 10 #include "device/bluetooth/public/interfaces/adapter.mojom.h" |
| 11 |
| 12 namespace bluetooth { |
| 13 |
| 14 // Implementation of Mojo AdapterFactory located in |
| 15 // device/bluetooth/public/interfaces/adapter.mojom. |
| 16 // It handles requests for Mojo Adapter instances |
| 17 // and strongly binds the Adapter instance to the system's |
| 18 // Bluetooth adapter. |
| 19 class AdapterFactory : public mojom::AdapterFactory { |
| 20 public: |
| 21 AdapterFactory(); |
| 22 ~AdapterFactory() override; |
| 23 |
| 24 // Creates an AdapterFactory with a strong Mojo binding to |request|. |
| 25 static void Create(mojom::AdapterFactoryRequest request); |
| 26 |
| 27 // mojom::AdapterFactory overrides: |
| 28 void GetAdapter(const GetAdapterCallback& callback) override; |
| 29 |
| 30 private: |
| 31 void OnGetAdapter(const GetAdapterCallback& callback, |
| 32 scoped_refptr<device::BluetoothAdapter> adapter); |
| 33 |
| 34 base::WeakPtrFactory<AdapterFactory> weak_ptr_factory_; |
| 35 |
| 36 DISALLOW_COPY_AND_ASSIGN(AdapterFactory); |
| 37 }; |
| 38 |
| 39 } // namespace bluetooth |
| 40 |
| 41 #endif // DEVICE_BLUETOOTH_ADAPTER_FACTORY_H_ |
OLD | NEW |