Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(877)

Unified Diff: device/bluetooth/bluetooth_adapter_mac.mm

Issue 1228863002: Runtime checks so that CoreBluetooth only used on >= 10.10 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@timeinfo
Patch Set: not compiling Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_adapter_mac.mm
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
index e9586ad42068d7a2bb0fb495fe32b6ce0738aaf3..88a332f85b518d95303f3d2401390ac22a0327d7 100644
--- a/device/bluetooth/bluetooth_adapter_mac.mm
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
@@ -13,6 +13,7 @@
#include "base/compiler_specific.h"
#include "base/containers/hash_tables.h"
#include "base/location.h"
+#include "base/mac/mac_util.h"
#include "base/mac/sdk_forward_declarations.h"
#include "base/memory/scoped_ptr.h"
#include "base/profiler/scoped_tracker.h"
@@ -58,9 +59,10 @@ BluetoothAdapterMac::BluetoothAdapterMac()
num_discovery_sessions_(0),
classic_discovery_manager_(
BluetoothDiscoveryManagerMac::CreateClassic(this)),
- low_energy_discovery_manager_(
- BluetoothLowEnergyDiscoveryManagerMac::Create(this)),
weak_ptr_factory_(this) {
+ if (base::mac::IsOSYosemiteOrLater())
+ low_energy_discovery_manager_.reset(
+ BluetoothLowEnergyDiscoveryManagerMac::Create(this));
DCHECK(classic_discovery_manager_.get());
}
@@ -112,8 +114,11 @@ void BluetoothAdapterMac::SetDiscoverable(
}
bool BluetoothAdapterMac::IsDiscovering() const {
- return (classic_discovery_manager_->IsDiscovering() ||
- low_energy_discovery_manager_->IsDiscovering());
+ bool is_discovering = classic_discovery_manager_->IsDiscovering();
+ if (base::mac::IsOSYosemiteOrLater())
+ is_discovering =
+ is_discovering || low_energy_discovery_manager_->IsDiscovering();
scheib 2015/07/09 19:51:23 In many of these checks, perhaps just do a pointer
krstnmnlsn 2015/07/10 17:17:46 Ended up using IsLowEnergyAvailable() as a sort of
+ return is_discovering;
}
void BluetoothAdapterMac::CreateRfcommService(
@@ -246,7 +251,8 @@ void BluetoothAdapterMac::RemoveDiscoverySession(
}
}
if (transport & BluetoothDiscoveryFilter::Transport::TRANSPORT_LE) {
- low_energy_discovery_manager_->StopDiscovery();
+ if (base::mac::IsOSYosemiteOrLater())
+ low_energy_discovery_manager_->StopDiscovery();
}
DVLOG(1) << "Discovery stopped";
@@ -283,7 +289,9 @@ bool BluetoothAdapterMac::StartDiscovery(
if (transport & BluetoothDiscoveryFilter::Transport::TRANSPORT_LE) {
// Begin a low energy discovery session or update it if one is already
// running.
- low_energy_discovery_manager_->StartDiscovery(BluetoothDevice::UUIDList());
+ if (base::mac::IsOSYosemiteOrLater())
+ low_energy_discovery_manager_->StartDiscovery(
+ BluetoothDevice::UUIDList());
}
return true;
}
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter_mac_unittest.mm » ('j') | device/bluetooth/bluetooth_low_energy_device_mac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698