Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2817)

Unified Diff: ash/wm/lock_state_controller.h

Issue 776093004: Add device policy to disallow shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: modifications suggested by stevenjb Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/wm/lock_state_controller.h
diff --git a/ash/wm/lock_state_controller.h b/ash/wm/lock_state_controller.h
index c03981495dda6faf487393347d0176e8636ff27c..13974a4e06cf68bc9b936f8266316fe4d83e033a 100644
--- a/ash/wm/lock_state_controller.h
+++ b/ash/wm/lock_state_controller.h
@@ -40,6 +40,7 @@ class ASH_EXPORT LockStateControllerDelegate {
virtual ~LockStateControllerDelegate() {}
virtual void RequestLockScreen() = 0;
+ virtual void RequestRestart() = 0;
virtual void RequestShutdown() = 0;
private:
@@ -72,6 +73,10 @@ class ASH_EXPORT LockStateControllerDelegate {
class ASH_EXPORT LockStateController : public aura::WindowTreeHostObserver,
public ShellObserver {
public:
+ // ShutdownMode determines whether the device will power off or reboot when
+ // RequestShutdown is invoked.
+ enum ShutdownMode { POWER_OFF, RESTART };
+
// Amount of time that the power button needs to be held before we lock the
// screen.
static const int kLockTimeoutMs;
@@ -132,7 +137,7 @@ class ASH_EXPORT LockStateController : public aura::WindowTreeHostObserver,
controller_->pre_shutdown_timer_.Stop();
}
void trigger_real_shutdown_timeout() {
- controller_->OnRealShutdownTimeout();
+ controller_->OnRealPowerTimeout(POWER_OFF);
controller_->real_shutdown_timer_.Stop();
}
@@ -188,7 +193,7 @@ class ASH_EXPORT LockStateController : public aura::WindowTreeHostObserver,
void OnStartingLock();
// Displays the shutdown animation and requests shutdown when it's done.
- void RequestShutdown();
+ void RequestShutdown(ShutdownMode mode);
// Called when ScreenLocker is ready to close, but not yet destroyed.
// Can be used to display "hiding" animations on unlock.
@@ -237,10 +242,13 @@ class ASH_EXPORT LockStateController : public aura::WindowTreeHostObserver,
// Starts timer for final shutdown animation.
// If |with_animation_time| is true, it will also include time of "fade to
// white" shutdown animation.
- void StartRealShutdownTimer(bool with_animation_time);
+ // If |shutdown_mode| is set to RESTART, the device will reboot.
+ void StartRealShutdownTimer(bool with_animation_time,
+ ShutdownMode shutdown_mode);
- // Requests that the machine be shut down.
- void OnRealShutdownTimeout();
+ // Request that the machine be either restarted or shut down depending on
+ // |shutdown_mode|.
+ void OnRealPowerTimeout(ShutdownMode shutdown_mode);
// Starts shutdown animation that can be cancelled and starts pre-shutdown
// timer.

Powered by Google App Engine
This is Rietveld 408576698