| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #endif // defined(OS_WIN) | 55 #endif // defined(OS_WIN) |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 // static | 59 // static |
| 60 bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() { | 60 bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() { |
| 61 // SetAdapterForTesting() may be used to provide a test or mock adapter | 61 // SetAdapterForTesting() may be used to provide a test or mock adapter |
| 62 // instance even on platforms that would otherwise not support it. | 62 // instance even on platforms that would otherwise not support it. |
| 63 if (default_adapter.Get()) | 63 if (default_adapter.Get()) |
| 64 return true; | 64 return true; |
| 65 #if defined(OS_CHROMEOS) || defined(OS_WIN) | 65 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN) |
| 66 return true; | 66 return true; |
| 67 #elif defined(OS_MACOSX) | 67 #elif defined(OS_MACOSX) |
| 68 return base::mac::IsOSLionOrLater(); | 68 return base::mac::IsOSLionOrLater(); |
| 69 #else | 69 #else |
| 70 return false; | 70 return false; |
| 71 #endif | 71 #endif |
| 72 } | 72 } |
| 73 | 73 |
| 74 // static | 74 // static |
| 75 void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) { | 75 void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 scoped_refptr<BluetoothAdapter> adapter) { | 111 scoped_refptr<BluetoothAdapter> adapter) { |
| 112 default_adapter.Get() = adapter->GetWeakPtrForTesting(); | 112 default_adapter.Get() = adapter->GetWeakPtrForTesting(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 // static | 115 // static |
| 116 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() { | 116 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() { |
| 117 return default_adapter.Get(); | 117 return default_adapter.Get(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace device | 120 } // namespace device |
| OLD | NEW |