global_state_feature_manager.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2021 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. #ifndef ASH_SERVICES_MULTIDEVICE_SETUP_GLOBAL_STATE_FEATURE_MANAGER_H_
  5. #define ASH_SERVICES_MULTIDEVICE_SETUP_GLOBAL_STATE_FEATURE_MANAGER_H_
  6. namespace ash {
  7. namespace multidevice_setup {
  8. // Manages the state of a feature whose host enabled state is synced across
  9. // all connected devices. The global host enabled state will be used to
  10. // determine whether the feature is enabled on this client device.
  11. // Such features are different from normal features where the host enabled state
  12. // is solely set by the host device, and a local enabled state is used to
  13. // control whetether the feature is enabled on this client device.
  14. class GlobalStateFeatureManager {
  15. public:
  16. virtual ~GlobalStateFeatureManager() = default;
  17. GlobalStateFeatureManager(const GlobalStateFeatureManager&) = delete;
  18. GlobalStateFeatureManager& operator=(const GlobalStateFeatureManager&) =
  19. delete;
  20. // Attempts to enable/disable the managed feature on the backend for the host
  21. // device that is synced at the time SetIsFeatureEnabled is called.
  22. virtual void SetIsFeatureEnabled(bool enabled) = 0;
  23. // Returns whether the managed feature is enabled/disabled.
  24. virtual bool IsFeatureEnabled() = 0;
  25. protected:
  26. GlobalStateFeatureManager() = default;
  27. };
  28. } // namespace multidevice_setup
  29. } // namespace ash
  30. #endif // ASH_SERVICES_MULTIDEVICE_SETUP_GLOBAL_STATE_FEATURE_MANAGER_H_