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

Unified Diff: ash/system/chromeos/power/tablet_power_button_controller.h

Issue 2620383003: ash: Add one second grace period For LockScreenIfRequired (Closed)
Patch Set: reset |lock_screen_timer_| in SetDisplayForcedOff and add test coverage Created 3 years, 11 months 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/system/chromeos/power/tablet_power_button_controller.h
diff --git a/ash/system/chromeos/power/tablet_power_button_controller.h b/ash/system/chromeos/power/tablet_power_button_controller.h
index b99148efaab18721db5814830f3ef9200d35a7c5..8e3348d325c9acf99842fdc6dd6f31753658fbdf 100644
--- a/ash/system/chromeos/power/tablet_power_button_controller.h
+++ b/ash/system/chromeos/power/tablet_power_button_controller.h
@@ -42,6 +42,12 @@ class ASH_EXPORT TabletPowerButtonController
// Emulates |shutdown_timer_| timeout.
void TriggerShutdownTimeout();
+ // Returns true when |lock_screen_timer_| is running.
+ bool LockScreenTimerIsRunning() const;
+
+ // Emulates |lock_screen_timer_| timeout.
+ void TriggerLockScreenTimeout();
+
private:
TabletPowerButtonController* controller_; // Not owned.
@@ -101,6 +107,12 @@ class ASH_EXPORT TabletPowerButtonController
// and locking is possible.
void LockScreenIfRequired();
+ // Starts |lock_screen_timer_| when lock screen is required.
+ void StartLockScreenTimer();
+
+ // Called by |lock_screen_timer_| to start locking screen.
+ void OnLockScreenTimeout();
+
// True if the brightness level is currently set to off.
bool brightness_level_is_zero_ = false;
@@ -124,6 +136,11 @@ class ASH_EXPORT TabletPowerButtonController
// released. Runs OnShutdownTimeout() to start shutdown.
base::OneShotTimer shutdown_timer_;
+ // Started when |shutdown_timer_| is still running when tablet power button is
+ // released and it should set display off, and stopped when it timeouts.
Daniel Erat 2017/01/11 23:09:06 nit: s/timeouts/times out/
Qiang(Joe) Xu 2017/01/12 00:04:45 Done.
+ // Run OnLockScreenTimeout() to start locking screen.
Daniel Erat 2017/01/11 23:09:06 nit: s/Run/Runs/
Qiang(Joe) Xu 2017/01/12 00:04:45 Done.
+ base::OneShotTimer lock_screen_timer_;
+
LockStateController* controller_; // Not owned.
base::WeakPtrFactory<TabletPowerButtonController> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698