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