OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_BLUETOOTH_POLICY_HANDLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_BLUETOOTH_POLICY_HANDLER_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 13 |
| 14 namespace policy { |
| 15 |
| 16 // This class observes the device setting |DeviceAllowBluetooth|, and calls |
| 17 // BluetoothAdapter::SetDisabled() appropriately based on the value of that |
| 18 // setting. |
| 19 class BluetoothPolicyHandler { |
| 20 public: |
| 21 explicit BluetoothPolicyHandler(chromeos::CrosSettings* cros_settings); |
| 22 ~BluetoothPolicyHandler(); |
| 23 |
| 24 private: |
| 25 // Once a trusted set of policies is established, this function calls |
| 26 // |SetDisabled| with the trusted state of the |DeviceAllowBluetooth| policy |
| 27 // through helper function |SetBluetoothPolicy|. |
| 28 void OnBluetoothPolicyChanged(); |
| 29 |
| 30 chromeos::CrosSettings* cros_settings_; |
| 31 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 32 bluetooth_policy_subscription_; |
| 33 base::WeakPtrFactory<BluetoothPolicyHandler> weak_factory_; |
| 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(BluetoothPolicyHandler); |
| 36 }; |
| 37 |
| 38 } // namespace policy |
| 39 |
| 40 #endif // CHROME_BROWSER_CHROMEOS_POLICY_BLUETOOTH_POLICY_HANDLER_H_ |
OLD | NEW |