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 "base/macros.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "chrome/browser/chromeos/settings/cros_settings.h" | |
12 #include "device/bluetooth/bluetooth_adapter.h" | |
13 | |
14 namespace chromeos { | |
15 // This class observes the device setting |DeviceAllowBluetooth|. Changes to | |
16 // this policy are communicated to SetBluetoothPolicy method by calling | |
Andrew T Wilson (Slow)
2016/04/13 13:55:10
This doesn't actually explain what the class does.
Ivan Šandrk
2016/04/13 17:19:04
Done.
| |
17 // OnBluetoothPolicyChanged method with the new state of the policy. | |
18 class BluetoothPolicyHandler { | |
19 public: | |
20 explicit BluetoothPolicyHandler(CrosSettings* cros_settings); | |
21 ~BluetoothPolicyHandler(); | |
22 | |
23 private: | |
24 // Once a trusted set of policies is established, this function calls | |
25 // |SetDisabled| with the trusted state of the |DeviceAllowBluetooth| policy | |
26 // through helper function |SetBluetoothPolicy|. | |
27 void OnBluetoothPolicyChanged(); | |
28 | |
29 // Helper function used in device::BluetoothAdapterFactory::GetAdapter | |
30 // callback, this is the function that actually calls |SetDisabled|. | |
31 void SetBluetoothPolicy(bool bt_disabled, | |
32 scoped_refptr<device::BluetoothAdapter> adapter); | |
33 | |
34 CrosSettings* cros_settings_; | |
35 scoped_ptr<CrosSettings::ObserverSubscription> bluetooth_policy_subscription_; | |
36 base::WeakPtrFactory<BluetoothPolicyHandler> weak_factory_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(BluetoothPolicyHandler); | |
39 }; | |
40 | |
41 } // namespace chromeos | |
42 | |
43 #endif // CHROME_BROWSER_CHROMEOS_POLICY_BLUETOOTH_POLICY_HANDLER_H_ | |
OLD | NEW |