OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_WM_LOCK_STATE_CONTROLLER_H_ | 5 #ifndef ASH_WM_LOCK_STATE_CONTROLLER_H_ |
6 #define ASH_WM_LOCK_STATE_CONTROLLER_H_ | 6 #define ASH_WM_LOCK_STATE_CONTROLLER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
9 #include "ash/shell_observer.h" | 11 #include "ash/shell_observer.h" |
10 #include "ash/wm/lock_state_observer.h" | 12 #include "ash/wm/lock_state_observer.h" |
11 #include "ash/wm/session_state_animator.h" | 13 #include "ash/wm/session_state_animator.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 #include "base/timer/elapsed_timer.h" | 18 #include "base/timer/elapsed_timer.h" |
18 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
19 #include "ui/aura/window_tree_host_observer.h" | 20 #include "ui/aura/window_tree_host_observer.h" |
20 | 21 |
21 namespace gfx { | 22 namespace gfx { |
22 class Rect; | 23 class Rect; |
23 class Size; | 24 class Size; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 146 |
146 private: | 147 private: |
147 LockStateController* controller_; // not owned | 148 LockStateController* controller_; // not owned |
148 | 149 |
149 DISALLOW_COPY_AND_ASSIGN(TestApi); | 150 DISALLOW_COPY_AND_ASSIGN(TestApi); |
150 }; | 151 }; |
151 | 152 |
152 LockStateController(); | 153 LockStateController(); |
153 ~LockStateController() override; | 154 ~LockStateController() override; |
154 | 155 |
155 void SetDelegate(scoped_ptr<LockStateControllerDelegate> delegate); | 156 void SetDelegate(std::unique_ptr<LockStateControllerDelegate> delegate); |
156 | 157 |
157 void AddObserver(LockStateObserver* observer); | 158 void AddObserver(LockStateObserver* observer); |
158 void RemoveObserver(LockStateObserver* observer); | 159 void RemoveObserver(LockStateObserver* observer); |
159 bool HasObserver(const LockStateObserver* observer) const; | 160 bool HasObserver(const LockStateObserver* observer) const; |
160 | 161 |
161 // Starts locking (with slow animation) that can be cancelled. | 162 // Starts locking (with slow animation) that can be cancelled. |
162 // After locking and |kLockToShutdownTimeoutMs| StartShutdownAnimation() | 163 // After locking and |kLockToShutdownTimeoutMs| StartShutdownAnimation() |
163 // will be called unless CancelShutdownAnimation() is called, if | 164 // will be called unless CancelShutdownAnimation() is called, if |
164 // |shutdown_after_lock| is true. | 165 // |shutdown_after_lock| is true. |
165 void StartLockAnimation(bool shutdown_after_lock); | 166 void StartLockAnimation(bool shutdown_after_lock); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 // Fades in background layer with |speed| if it was hidden in unlocked state. | 280 // Fades in background layer with |speed| if it was hidden in unlocked state. |
280 void AnimateBackgroundAppearanceIfNecessary( | 281 void AnimateBackgroundAppearanceIfNecessary( |
281 ash::SessionStateAnimator::AnimationSpeed speed, | 282 ash::SessionStateAnimator::AnimationSpeed speed, |
282 SessionStateAnimator::AnimationSequence* animation_sequence); | 283 SessionStateAnimator::AnimationSequence* animation_sequence); |
283 | 284 |
284 // Fades out background layer with |speed| if it was hidden in unlocked state. | 285 // Fades out background layer with |speed| if it was hidden in unlocked state. |
285 void AnimateBackgroundHidingIfNecessary( | 286 void AnimateBackgroundHidingIfNecessary( |
286 ash::SessionStateAnimator::AnimationSpeed speed, | 287 ash::SessionStateAnimator::AnimationSpeed speed, |
287 SessionStateAnimator::AnimationSequence* animation_sequence); | 288 SessionStateAnimator::AnimationSequence* animation_sequence); |
288 | 289 |
289 scoped_ptr<SessionStateAnimator> animator_; | 290 std::unique_ptr<SessionStateAnimator> animator_; |
290 | 291 |
291 scoped_ptr<LockStateControllerDelegate> delegate_; | 292 std::unique_ptr<LockStateControllerDelegate> delegate_; |
292 | 293 |
293 base::ObserverList<LockStateObserver> observers_; | 294 base::ObserverList<LockStateObserver> observers_; |
294 | 295 |
295 // The current login status, or original login status from before we locked. | 296 // The current login status, or original login status from before we locked. |
296 user::LoginStatus login_status_; | 297 user::LoginStatus login_status_; |
297 | 298 |
298 // Current lock status. | 299 // Current lock status. |
299 bool system_is_locked_; | 300 bool system_is_locked_; |
300 | 301 |
301 // Are we in the process of shutting the machine down? | 302 // Are we in the process of shutting the machine down? |
302 bool shutting_down_; | 303 bool shutting_down_; |
303 | 304 |
304 // Indicates whether controller should proceed to (cancellable) shutdown after | 305 // Indicates whether controller should proceed to (cancellable) shutdown after |
305 // locking. | 306 // locking. |
306 bool shutdown_after_lock_; | 307 bool shutdown_after_lock_; |
307 | 308 |
308 // Indicates that controller displays lock animation. | 309 // Indicates that controller displays lock animation. |
309 bool animating_lock_; | 310 bool animating_lock_; |
310 | 311 |
311 // Indicates that lock animation can be undone. | 312 // Indicates that lock animation can be undone. |
312 bool can_cancel_lock_animation_; | 313 bool can_cancel_lock_animation_; |
313 | 314 |
314 scoped_ptr<UnlockedStateProperties> unlocked_properties_; | 315 std::unique_ptr<UnlockedStateProperties> unlocked_properties_; |
315 | 316 |
316 // How long has it been since the request to lock the screen? | 317 // How long has it been since the request to lock the screen? |
317 scoped_ptr<base::ElapsedTimer> lock_duration_timer_; | 318 std::unique_ptr<base::ElapsedTimer> lock_duration_timer_; |
318 | 319 |
319 // Started when we request that the screen be locked. When it fires, we | 320 // Started when we request that the screen be locked. When it fires, we |
320 // assume that our request got dropped. | 321 // assume that our request got dropped. |
321 base::OneShotTimer lock_fail_timer_; | 322 base::OneShotTimer lock_fail_timer_; |
322 // TODO(jdufault): Remove after resolving crbug.com/452599. | 323 // TODO(jdufault): Remove after resolving crbug.com/452599. |
323 bool lock_fail_timer_is_stopped_; | 324 bool lock_fail_timer_is_stopped_; |
324 | 325 |
325 // Started when the screen is locked while the power button is held. Adds a | 326 // Started when the screen is locked while the power button is held. Adds a |
326 // delay between the appearance of the lock screen and the beginning of the | 327 // delay between the appearance of the lock screen and the beginning of the |
327 // pre-shutdown animation. | 328 // pre-shutdown animation. |
(...skipping 11 matching lines...) Expand all Loading... |
339 base::Closure lock_screen_displayed_callback_; | 340 base::Closure lock_screen_displayed_callback_; |
340 | 341 |
341 base::WeakPtrFactory<LockStateController> weak_ptr_factory_; | 342 base::WeakPtrFactory<LockStateController> weak_ptr_factory_; |
342 | 343 |
343 DISALLOW_COPY_AND_ASSIGN(LockStateController); | 344 DISALLOW_COPY_AND_ASSIGN(LockStateController); |
344 }; | 345 }; |
345 | 346 |
346 } // namespace ash | 347 } // namespace ash |
347 | 348 |
348 #endif // ASH_WM_LOCK_STATE_CONTROLLER_H_ | 349 #endif // ASH_WM_LOCK_STATE_CONTROLLER_H_ |
OLD | NEW |