| 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 #include "device/bluetooth/bluetooth_adapter_factory.h" | 5 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 DCHECK(default_adapter.Get()->IsInitialized()); | 89 DCHECK(default_adapter.Get()->IsInitialized()); |
| 90 #endif // defined(OS_WIN) | 90 #endif // defined(OS_WIN) |
| 91 | 91 |
| 92 if (default_adapter.Get()->IsInitialized()) | 92 if (default_adapter.Get()->IsInitialized()) |
| 93 callback.Run(scoped_refptr<BluetoothAdapter>(default_adapter.Get().get())); | 93 callback.Run(scoped_refptr<BluetoothAdapter>(default_adapter.Get().get())); |
| 94 | 94 |
| 95 } | 95 } |
| 96 | 96 |
| 97 // static | 97 // static |
| 98 void BluetoothAdapterFactory::Shutdown() { |
| 99 if (default_adapter.Get()) { |
| 100 default_adapter.Get()->Shutdown(); |
| 101 } |
| 102 } |
| 103 |
| 104 // static |
| 98 void BluetoothAdapterFactory::SetAdapterForTesting( | 105 void BluetoothAdapterFactory::SetAdapterForTesting( |
| 99 scoped_refptr<BluetoothAdapter> adapter) { | 106 scoped_refptr<BluetoothAdapter> adapter) { |
| 100 default_adapter.Get() = adapter->GetWeakPtrForTesting(); | 107 default_adapter.Get() = adapter->GetWeakPtrForTesting(); |
| 101 } | 108 } |
| 102 | 109 |
| 103 // static | 110 // static |
| 104 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() { | 111 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() { |
| 105 return default_adapter.Get(); | 112 return default_adapter.Get(); |
| 106 } | 113 } |
| 107 | 114 |
| 108 } // namespace device | 115 } // namespace device |
| OLD | NEW |