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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
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 #if defined(OS_CHROMEOS) |
| 98 // static |
| 99 void BluetoothAdapterFactory::OnDBusThreadManagerShutdown() { |
| 100 if (default_adapter.Get()) { |
| 101 default_adapter.Get()->OnDBusThreadManagerShutdown(); |
| 102 } |
| 103 } |
| 104 #endif |
| 105 |
97 // static | 106 // static |
98 void BluetoothAdapterFactory::SetAdapterForTesting( | 107 void BluetoothAdapterFactory::SetAdapterForTesting( |
99 scoped_refptr<BluetoothAdapter> adapter) { | 108 scoped_refptr<BluetoothAdapter> adapter) { |
100 default_adapter.Get() = adapter->GetWeakPtrForTesting(); | 109 default_adapter.Get() = adapter->GetWeakPtrForTesting(); |
101 } | 110 } |
102 | 111 |
103 // static | 112 // static |
104 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() { | 113 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() { |
105 return default_adapter.Get(); | 114 return default_adapter.Get(); |
106 } | 115 } |
107 | 116 |
108 } // namespace device | 117 } // namespace device |
OLD | NEW |