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

Side by Side Diff: ash/system/chromeos/power/tablet_power_button_controller.h

Issue 2640333002: Revert "ash: Add one second grace period For LockScreenIfRequired" (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/system/chromeos/power/tablet_power_button_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_SYSTEM_CHROMEOS_POWER_TABLET_POWER_BUTTON_CONTROLLER_H_ 5 #ifndef ASH_SYSTEM_CHROMEOS_POWER_TABLET_POWER_BUTTON_CONTROLLER_H_
6 #define ASH_SYSTEM_CHROMEOS_POWER_TABLET_POWER_BUTTON_CONTROLLER_H_ 6 #define ASH_SYSTEM_CHROMEOS_POWER_TABLET_POWER_BUTTON_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
(...skipping 24 matching lines...) Expand all
35 public: 35 public:
36 explicit TestApi(TabletPowerButtonController* controller); 36 explicit TestApi(TabletPowerButtonController* controller);
37 ~TestApi(); 37 ~TestApi();
38 38
39 // Returns true when |shutdown_timer_| is running. 39 // Returns true when |shutdown_timer_| is running.
40 bool ShutdownTimerIsRunning() const; 40 bool ShutdownTimerIsRunning() const;
41 41
42 // Emulates |shutdown_timer_| timeout. 42 // Emulates |shutdown_timer_| timeout.
43 void TriggerShutdownTimeout(); 43 void TriggerShutdownTimeout();
44 44
45 // Returns true when |lock_screen_timer_| is running.
46 bool LockScreenTimerIsRunning() const;
47
48 // Emulates |lock_screen_timer_| timeout.
49 void TriggerLockScreenTimeout();
50
51 private: 45 private:
52 TabletPowerButtonController* controller_; // Not owned. 46 TabletPowerButtonController* controller_; // Not owned.
53 47
54 DISALLOW_COPY_AND_ASSIGN(TestApi); 48 DISALLOW_COPY_AND_ASSIGN(TestApi);
55 }; 49 };
56 50
57 explicit TabletPowerButtonController(LockStateController* controller); 51 explicit TabletPowerButtonController(LockStateController* controller);
58 ~TabletPowerButtonController() override; 52 ~TabletPowerButtonController() override;
59 53
60 // Returns true if power button events should be handled by this class instead 54 // Returns true if power button events should be handled by this class instead
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // tablet mode. 94 // tablet mode.
101 void StartShutdownTimer(); 95 void StartShutdownTimer();
102 96
103 // Called by |shutdown_timer_| to start the pre-shutdown animation. 97 // Called by |shutdown_timer_| to start the pre-shutdown animation.
104 void OnShutdownTimeout(); 98 void OnShutdownTimeout();
105 99
106 // Locks the screen if the "require password to wake from sleep" pref is set 100 // Locks the screen if the "require password to wake from sleep" pref is set
107 // and locking is possible. 101 // and locking is possible.
108 void LockScreenIfRequired(); 102 void LockScreenIfRequired();
109 103
110 // Called by |lock_screen_timer_| to start locking screen.
111 void OnLockScreenTimeout();
112
113 // True if the brightness level is currently set to off. 104 // True if the brightness level is currently set to off.
114 bool brightness_level_is_zero_ = false; 105 bool brightness_level_is_zero_ = false;
115 106
116 // Current forced-off state of backlights. 107 // Current forced-off state of backlights.
117 bool backlights_forced_off_ = false; 108 bool backlights_forced_off_ = false;
118 109
119 // True if the screen was off when the power button was pressed. 110 // True if the screen was off when the power button was pressed.
120 bool screen_off_when_power_button_down_ = false; 111 bool screen_off_when_power_button_down_ = false;
121 112
122 // Time source for performed action times. 113 // Time source for performed action times.
123 std::unique_ptr<base::TickClock> tick_clock_; 114 std::unique_ptr<base::TickClock> tick_clock_;
124 115
125 // Saves the most recent timestamp that powerd is resuming from suspend, 116 // Saves the most recent timestamp that powerd is resuming from suspend,
126 // updated in SuspendDone(). 117 // updated in SuspendDone().
127 base::TimeTicks last_resume_time_; 118 base::TimeTicks last_resume_time_;
128 119
129 // True if power button released should force off display. 120 // True if power button released should force off display.
130 bool force_off_on_button_up_; 121 bool force_off_on_button_up_;
131 122
132 // Started when the tablet power button is pressed and stopped when it's 123 // Started when the tablet power button is pressed and stopped when it's
133 // released. Runs OnShutdownTimeout() to start shutdown. 124 // released. Runs OnShutdownTimeout() to start shutdown.
134 base::OneShotTimer shutdown_timer_; 125 base::OneShotTimer shutdown_timer_;
135 126
136 // Used to provide a grace period between forcing the display off and locking
137 // the screen. Runs OnLockScreenTimeout().
138 base::OneShotTimer lock_screen_timer_;
139
140 LockStateController* controller_; // Not owned. 127 LockStateController* controller_; // Not owned.
141 128
142 base::WeakPtrFactory<TabletPowerButtonController> weak_ptr_factory_; 129 base::WeakPtrFactory<TabletPowerButtonController> weak_ptr_factory_;
143 130
144 DISALLOW_COPY_AND_ASSIGN(TabletPowerButtonController); 131 DISALLOW_COPY_AND_ASSIGN(TabletPowerButtonController);
145 }; 132 };
146 133
147 } // namespace ash 134 } // namespace ash
148 135
149 #endif // ASH_SYSTEM_CHROMEOS_POWER_TABLET_POWER_BUTTON_CONTROLLER_H_ 136 #endif // ASH_SYSTEM_CHROMEOS_POWER_TABLET_POWER_BUTTON_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | ash/system/chromeos/power/tablet_power_button_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698