| 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_BLUETOOTH_ADAPTER_FACTORY_WRAPPER_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_WRAPPER_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_WRAPPER_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_WRAPPER_H_ |
| 7 | 7 |
| 8 #include <unordered_set> | 8 #include <unordered_set> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 BluetoothAdapter* GetAdapter(BluetoothAdapter::Observer* observer); | 49 BluetoothAdapter* GetAdapter(BluetoothAdapter::Observer* observer); |
| 50 | 50 |
| 51 // Sets a new BluetoothAdapter to be returned by GetAdapter. When setting | 51 // Sets a new BluetoothAdapter to be returned by GetAdapter. When setting |
| 52 // a new adapter all observers from the old adapter are removed and added | 52 // a new adapter all observers from the old adapter are removed and added |
| 53 // to |mock_adapter|. | 53 // to |mock_adapter|. |
| 54 void SetBluetoothAdapterForTesting( | 54 void SetBluetoothAdapterForTesting( |
| 55 scoped_refptr<BluetoothAdapter> mock_adapter); | 55 scoped_refptr<BluetoothAdapter> mock_adapter); |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 // friend LazyInstance to permit access to private constructor. | 58 // friend LazyInstance to permit access to private constructor. |
| 59 friend base::DefaultLazyInstanceTraits<BluetoothAdapterFactoryWrapper>; | 59 friend base::LazyInstanceTraitsBase<BluetoothAdapterFactoryWrapper>; |
| 60 | 60 |
| 61 BluetoothAdapterFactoryWrapper(); | 61 BluetoothAdapterFactoryWrapper(); |
| 62 | 62 |
| 63 void OnGetAdapter(const AcquireAdapterCallback& continuation, | 63 void OnGetAdapter(const AcquireAdapterCallback& continuation, |
| 64 scoped_refptr<BluetoothAdapter> adapter); | 64 scoped_refptr<BluetoothAdapter> adapter); |
| 65 | 65 |
| 66 bool HasAdapter(BluetoothAdapter::Observer* observer); | 66 bool HasAdapter(BluetoothAdapter::Observer* observer); |
| 67 void AddAdapterObserver(BluetoothAdapter::Observer* observer); | 67 void AddAdapterObserver(BluetoothAdapter::Observer* observer); |
| 68 void RemoveAdapterObserver(BluetoothAdapter::Observer* observer); | 68 void RemoveAdapterObserver(BluetoothAdapter::Observer* observer); |
| 69 | 69 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 87 // Note: This should remain the last member so it'll be destroyed and | 87 // Note: This should remain the last member so it'll be destroyed and |
| 88 // invalidate its weak pointers before any other members are destroyed. | 88 // invalidate its weak pointers before any other members are destroyed. |
| 89 base::WeakPtrFactory<BluetoothAdapterFactoryWrapper> weak_ptr_factory_; | 89 base::WeakPtrFactory<BluetoothAdapterFactoryWrapper> weak_ptr_factory_; |
| 90 | 90 |
| 91 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterFactoryWrapper); | 91 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterFactoryWrapper); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 } // namespace device | 94 } // namespace device |
| 95 | 95 |
| 96 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_WRAPPER_H_ | 96 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_WRAPPER_H_ |
| OLD | NEW |