| 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..efba7defb569a71a043d8e306f58f2fdd3457bc7
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/policy/bluetooth_policy_handler.h
|
| @@ -0,0 +1,43 @@
|
| +// 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 "base/macros.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "chrome/browser/chromeos/settings/cros_settings.h"
|
| +#include "device/bluetooth/bluetooth_adapter.h"
|
| +
|
| +namespace chromeos {
|
| +// This class observes the device setting |DeviceAllowBluetooth|. Changes to
|
| +// this policy are communicated to SetBluetoothPolicy method by calling
|
| +// OnBluetoothPolicyChanged method with the new state of the policy.
|
| +class BluetoothPolicyHandler {
|
| + public:
|
| + explicit BluetoothPolicyHandler(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();
|
| +
|
| + // Helper function used in device::BluetoothAdapterFactory::GetAdapter
|
| + // callback, this is the function that actually calls |SetDisabled|.
|
| + void SetBluetoothPolicy(bool bt_disabled,
|
| + scoped_refptr<device::BluetoothAdapter> adapter);
|
| +
|
| + CrosSettings* cros_settings_;
|
| + scoped_ptr<CrosSettings::ObserverSubscription> bluetooth_policy_subscription_;
|
| + base::WeakPtrFactory<BluetoothPolicyHandler> weak_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BluetoothPolicyHandler);
|
| +};
|
| +
|
| +} // namespace chromeos
|
| +
|
| +#endif // CHROME_BROWSER_CHROMEOS_POLICY_BLUETOOTH_POLICY_HANDLER_H_
|
|
|