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

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: Made SetDisabled pure virtual 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..2a8232cdd4d1e7881d4196312177d42199306f3c 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),
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),
Andrew T Wilson (Slow) 2016/04/13 13:55:11 I am slightly nervous that any operations that are
Ivan Šandrk 2016/04/14 18:08:47 https://code.google.com/p/chromium/codesearch#chro
scheib 2016/04/15 17:46:53 At shutdown we believe things won't crash -- handl
Ivan Šandrk 2016/04/15 17:52:28 Okay thanks for your input. I'll ask my supervisor
+ base::Bind(&base::DoNothing));
Andrew T Wilson (Slow) 2016/04/13 13:55:11 This line is indented wrong.
Ivan Šandrk 2016/04/13 17:19:04 Done.
+ }
+ is_disabled_ = disabled;
}
bool BluetoothAdapterBlueZ::IsPowered() const {
« device/bluetooth/bluetooth_adapter_bluez.h ('K') | « device/bluetooth/bluetooth_adapter_bluez.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698