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

Unified Diff: device/bluetooth/bluetooth_adapter_bluez.cc

Issue 1784333002: Add Device Policy Handler for Bluetooth, and allow disabling the Bluetooth adapter on Chrome OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code fix Created 4 years, 8 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_bluez.cc
diff --git a/device/bluetooth/bluetooth_adapter_bluez.cc b/device/bluetooth/bluetooth_adapter_bluez.cc
index 4424b0229d667befdb432cfc2b17dc4dd88d3040..a310e1dd1b667fc05e58660b95ee2231148c983d 100644
--- a/device/bluetooth/bluetooth_adapter_bluez.cc
+++ b/device/bluetooth/bluetooth_adapter_bluez.cc
@@ -153,6 +153,7 @@ BluetoothAdapterBlueZ::BluetoothAdapterBlueZ(const InitCallback& init_callback)
: init_callback_(init_callback),
initialized_(false),
dbus_is_shutdown_(false),
+ is_disabled_(false),
ortuno 2016/04/13 21:12:21 You never set this to true on non-chromeos platfor
Ivan Šandrk 2016/04/14 18:08:48 Removed it for non-chromeos platforms.
num_discovery_sessions_(0),
discovery_request_pending_(false),
weak_ptr_factory_(this) {
@@ -254,7 +255,15 @@ bool BluetoothAdapterBlueZ::IsInitialized() const {
}
bool BluetoothAdapterBlueZ::IsPresent() const {
- return !dbus_is_shutdown_ && !object_path_.value().empty();
+ return !is_disabled_ && !dbus_is_shutdown_ && !object_path_.value().empty();
+}
+
+void BluetoothAdapterBlueZ::SetDisabled(bool disabled) {
+ if (disabled) {
+ SetPowered(false, base::Bind(&base::DoNothing),
ortuno 2016/04/13 21:12:21 Does powering off the adapter remove already disco
Ivan Šandrk 2016/04/14 18:08:48 https://code.google.com/p/chromium/codesearch#chro
scheib 2016/04/14 21:41:10 But you're not calling ::Shutdown which removes th
Ivan Šandrk 2016/04/15 17:32:06 Should I then copy some of the functionality that
+ base::Bind(&base::DoNothing));
+ }
+ is_disabled_ = disabled;
}
bool BluetoothAdapterBlueZ::IsPowered() const {

Powered by Google App Engine
This is Rietveld 408576698