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

Unified Diff: chrome/browser/chromeos/policy/bluetooth_policy_handler.h

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: Bartfab's nits 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: chrome/browser/chromeos/policy/bluetooth_policy_handler.h
diff --git a/chrome/browser/chromeos/policy/bluetooth_policy_handler.h b/chrome/browser/chromeos/policy/bluetooth_policy_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..0d1200a70f5c40ed6eb86651ffab6e533b842bb7
--- /dev/null
+++ b/chrome/browser/chromeos/policy/bluetooth_policy_handler.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_POLICY_BLUETOOTH_POLICY_HANDLER_H_
+#define CHROME_BROWSER_CHROMEOS_POLICY_BLUETOOTH_POLICY_HANDLER_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/chromeos/settings/cros_settings.h"
+
+namespace policy {
+
+// This class observes the device setting |DeviceAllowBluetooth|, and calls
+// BluetoothAdapter::SetDisabled() appropriately based on the value of that
+// setting.
+class BluetoothPolicyHandler {
+ public:
+ explicit BluetoothPolicyHandler(chromeos::CrosSettings* cros_settings);
+ ~BluetoothPolicyHandler();
+
+ private:
+ // Once a trusted set of policies is established, this function calls
+ // |SetDisabled| with the trusted state of the |DeviceAllowBluetooth| policy
+ // through helper function |SetBluetoothPolicy|.
+ void OnBluetoothPolicyChanged();
+
+ chromeos::CrosSettings* cros_settings_;
+ std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
+ bluetooth_policy_subscription_;
+ base::WeakPtrFactory<BluetoothPolicyHandler> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(BluetoothPolicyHandler);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_CHROMEOS_POLICY_BLUETOOTH_POLICY_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698