Chromium Code Reviews| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 | 53 |
| 54 } // namespace | 54 } // namespace |
| 55 | 55 |
| 56 // static | 56 // static |
| 57 bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() { | 57 bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() { |
| 58 // SetAdapterForTesting() may be used to provide a test or mock adapter | 58 // SetAdapterForTesting() may be used to provide a test or mock adapter |
| 59 // instance even on platforms that would otherwise not support it. | 59 // instance even on platforms that would otherwise not support it. |
| 60 if (default_adapter.Get()) | 60 if (default_adapter.Get()) |
| 61 return true; | 61 return true; |
| 62 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN) || \ | 62 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN) || \ |
| 63 defined(OS_LINUX) | 63 defined(OS_LINUX) || defined(OS_MACOSX) |
| 64 return true; | 64 return true; |
| 65 #elif defined(OS_MACOSX) | |
| 66 return base::mac::IsOSLionOrLater(); | |
|
ortuno
2016/04/25 20:32:32
You can also delete the "base/mac/mac_util.h" incl
Nico
2016/04/25 20:34:39
Done.
| |
| 67 #else | 65 #else |
| 68 return false; | 66 return false; |
| 69 #endif | 67 #endif |
| 70 } | 68 } |
| 71 | 69 |
| 72 // static | 70 // static |
| 73 void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) { | 71 void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) { |
| 74 DCHECK(IsBluetoothAdapterAvailable()); | 72 DCHECK(IsBluetoothAdapterAvailable()); |
| 75 | 73 |
| 76 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) | 74 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 scoped_refptr<BluetoothAdapter> adapter) { | 106 scoped_refptr<BluetoothAdapter> adapter) { |
| 109 default_adapter.Get() = adapter->GetWeakPtrForTesting(); | 107 default_adapter.Get() = adapter->GetWeakPtrForTesting(); |
| 110 } | 108 } |
| 111 | 109 |
| 112 // static | 110 // static |
| 113 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() { | 111 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() { |
| 114 return default_adapter.Get(); | 112 return default_adapter.Get(); |
| 115 } | 113 } |
| 116 | 114 |
| 117 } // namespace device | 115 } // namespace device |
| OLD | NEW |