shutdown_controller.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2019 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_PUBLIC_CPP_SHUTDOWN_CONTROLLER_H_
  5. #define ASH_PUBLIC_CPP_SHUTDOWN_CONTROLLER_H_
  6. #include "ash/public/cpp/ash_public_export.h"
  7. #include "ash/public/cpp/scoped_singleton_resetter_for_test.h"
  8. namespace ash {
  9. enum class ShutdownReason;
  10. // Interface implemented by ash and used by chrome to provide shutdown policy
  11. // information. Exists because device policy is owned by chrome, not ash.
  12. class ASH_PUBLIC_EXPORT ShutdownController {
  13. public:
  14. using ScopedResetterForTest =
  15. ScopedSingletonResetterForTest<ShutdownController>;
  16. // Gets the singleton ShutdownController instance.
  17. static ShutdownController* Get();
  18. // Sets a boolean pref that indicates whether the device automatically reboots
  19. // when the user initiates a shutdown via an UI element. Used in enterprise
  20. // environments for devices that should not be shut down.
  21. virtual void SetRebootOnShutdown(bool reboot_on_shutdown) = 0;
  22. // Shuts down or reboots based on the current DeviceRebootOnShutdown policy.
  23. // Does not trigger the shutdown fade-out animation. For animated shutdown
  24. // use LockStateController::RequestShutdown().
  25. virtual void ShutDownOrReboot(ShutdownReason reason) = 0;
  26. protected:
  27. ShutdownController();
  28. virtual ~ShutdownController();
  29. };
  30. } // namespace ash
  31. #endif // ASH_PUBLIC_CPP_SHUTDOWN_CONTROLLER_H_