Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 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 ASH_COMMON_SHUTDOWN_CONTROLLER_H_ | |
| 6 #define ASH_COMMON_SHUTDOWN_CONTROLLER_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 #include "ash/public/interfaces/shutdown.mojom.h" | |
| 10 #include "base/macros.h" | |
| 11 #include "mojo/public/cpp/bindings/binding_set.h" | |
| 12 | |
| 13 namespace ash { | |
| 14 | |
| 15 // Handles actual device shutdown by making requests to powerd over D-Bus. | |
| 16 // Caches the DeviceRebootOnShutdown device policy sent from Chrome over mojo. | |
| 17 class ASH_EXPORT ShutdownController : public mojom::ShutdownController { | |
| 18 public: | |
| 19 ShutdownController(); | |
| 20 ~ShutdownController() override; | |
| 21 | |
| 22 bool reboot_on_shutdown() const { return reboot_on_shutdown_; } | |
| 23 | |
| 24 // Shuts down or reboots based on the current DeviceRebootOnShutdown policy. | |
| 25 // Does not trigger the shutdown fade-out animation. For animated shutdown | |
| 26 // use WmShell::RequestShutdown(). Virtual for testing. | |
| 27 virtual void ShutdownOrReboot(); | |
|
Daniel Erat
2016/11/14 15:42:41
nit: ShutDownOrReboot ("shut down" is verb, "shutd
James Cook
2016/11/14 17:21:39
Done.
| |
| 28 | |
| 29 // Binds the mojom::ShutdownController interface request to this object. | |
| 30 void BindRequest(mojom::ShutdownControllerRequest request); | |
| 31 | |
| 32 private: | |
| 33 // mojom::ShutdownController: | |
| 34 void SetRebootOnShutdown(bool reboot_on_shutdown) override; | |
| 35 | |
| 36 // Cached copy of the DeviceRebootOnShutdown policy from chrome. | |
| 37 bool reboot_on_shutdown_ = false; | |
| 38 | |
| 39 // Bindings for the ShutdownController interface. | |
| 40 mojo::BindingSet<mojom::ShutdownController> bindings_; | |
| 41 | |
| 42 DISALLOW_COPY_AND_ASSIGN(ShutdownController); | |
| 43 }; | |
| 44 | |
| 45 } // namespace ash | |
| 46 | |
| 47 #endif // ASH_COMMON_SHUTDOWN_CONTROLLER_H_ | |
| OLD | NEW |