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

Side by Side Diff: ash/wm/session_lock_state_controller.h

Issue 15974008: Rename SessionStateController -> LockStateController (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SESSION_STATE_CONTROLLER_H_ 5 #ifndef ASH_WM_SESSION_LOCK_STATE_CONTROLLER_H_
6 #define ASH_WM_SESSION_STATE_CONTROLLER_H_ 6 #define ASH_WM_SESSION_LOCK_STATE_CONTROLLER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/shell_observer.h" 9 #include "ash/shell_observer.h"
10 #include "ash/wm/session_lock_state_observer.h"
10 #include "ash/wm/session_state_animator.h" 11 #include "ash/wm/session_state_animator.h"
11 #include "ash/wm/session_state_observer.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "base/timer.h" 16 #include "base/timer.h"
17 #include "ui/aura/root_window_observer.h" 17 #include "ui/aura/root_window_observer.h"
18 18
19 namespace gfx { 19 namespace gfx {
20 class Rect; 20 class Rect;
21 class Size; 21 class Size;
22 } 22 }
23 23
24 namespace ui { 24 namespace ui {
25 class Layer; 25 class Layer;
26 } 26 }
27 27
28 namespace ash { 28 namespace ash {
29 29
30 namespace test { 30 namespace test {
31 class PowerButtonControllerTest; 31 class PowerButtonControllerTest;
32 class SessionStateControllerImpl2Test; 32 class SessionLockStateControllerImpl2Test;
33 } 33 }
34 34
35 // Performs system-related functions on behalf of SessionStateController. 35 // Performs system-related functions on behalf of SessionLockStateController.
36 class ASH_EXPORT SessionStateControllerDelegate { 36 class ASH_EXPORT SessionLockStateControllerDelegate {
37 public: 37 public:
38 SessionStateControllerDelegate() {} 38 SessionLockStateControllerDelegate() {}
39 virtual ~SessionStateControllerDelegate() {} 39 virtual ~SessionLockStateControllerDelegate() {}
40 40
41 virtual void RequestLockScreen() = 0; 41 virtual void RequestLockScreen() = 0;
42 virtual void RequestShutdown() = 0; 42 virtual void RequestShutdown() = 0;
43 43
44 private: 44 private:
45 DISALLOW_COPY_AND_ASSIGN(SessionStateControllerDelegate); 45 DISALLOW_COPY_AND_ASSIGN(SessionLockStateControllerDelegate);
46 }; 46 };
47 47
48 // Displays onscreen animations and locks or suspends the system in response to 48 // Displays onscreen animations and locks or suspends the system in response to
49 // the power button being pressed or released. 49 // the power button being pressed or released.
50 class ASH_EXPORT SessionStateController : public aura::RootWindowObserver, 50 class ASH_EXPORT SessionLockStateController : public aura::RootWindowObserver,
51 public ShellObserver { 51 public ShellObserver {
52 public: 52 public:
53 // Amount of time that the power button needs to be held before we lock the 53 // Amount of time that the power button needs to be held before we lock the
54 // screen. 54 // screen.
55 static const int kLockTimeoutMs; 55 static const int kLockTimeoutMs;
56 56
57 // Amount of time that the power button needs to be held before we shut down. 57 // Amount of time that the power button needs to be held before we shut down.
58 static const int kShutdownTimeoutMs; 58 static const int kShutdownTimeoutMs;
59 59
60 // Amount of time to wait for our lock requests to be honored before giving 60 // Amount of time to wait for our lock requests to be honored before giving
61 // up. 61 // up.
62 static const int kLockFailTimeoutMs; 62 static const int kLockFailTimeoutMs;
63 63
64 // When the button has been held continuously from the unlocked state, amount 64 // When the button has been held continuously from the unlocked state, amount
65 // of time that we wait after the screen locker window is shown before 65 // of time that we wait after the screen locker window is shown before
66 // starting the pre-shutdown animation. 66 // starting the pre-shutdown animation.
67 static const int kLockToShutdownTimeoutMs; 67 static const int kLockToShutdownTimeoutMs;
68 68
69 // Additional time (beyond kFastCloseAnimMs) to wait after starting the 69 // Additional time (beyond kFastCloseAnimMs) to wait after starting the
70 // fast-close shutdown animation before actually requesting shutdown, to give 70 // fast-close shutdown animation before actually requesting shutdown, to give
71 // the animation time to finish. 71 // the animation time to finish.
72 static const int kShutdownRequestDelayMs; 72 static const int kShutdownRequestDelayMs;
73 73
74 SessionStateController(); 74 SessionLockStateController();
75 virtual ~SessionStateController(); 75 virtual ~SessionLockStateController();
76 76
77 void SetDelegate(SessionStateControllerDelegate* delegate); 77 void SetDelegate(SessionLockStateControllerDelegate* delegate);
78 78
79 // Starts locking (with slow animation) that can be cancelled. 79 // Starts locking (with slow animation) that can be cancelled.
80 // After locking and |kLockToShutdownTimeoutMs| StartShutdownAnimation() 80 // After locking and |kLockToShutdownTimeoutMs| StartShutdownAnimation()
81 // will be called unless CancelShutdownAnimation() is called, if 81 // will be called unless CancelShutdownAnimation() is called, if
82 // |shutdown_after_lock| is true. 82 // |shutdown_after_lock| is true.
83 virtual void StartLockAnimation(bool shutdown_after_lock) = 0; 83 virtual void StartLockAnimation(bool shutdown_after_lock) = 0;
84 84
85 // Starts shutting down (with slow animation) that can be cancelled. 85 // Starts shutting down (with slow animation) that can be cancelled.
86 virtual void StartShutdownAnimation() = 0; 86 virtual void StartShutdownAnimation() = 0;
87 87
(...skipping 28 matching lines...) Expand all
116 116
117 // Called when ScreenLocker is ready to close, but not yet destroyed. 117 // Called when ScreenLocker is ready to close, but not yet destroyed.
118 // Can be used to display "hiding" animations on unlock. 118 // Can be used to display "hiding" animations on unlock.
119 // |callback| will be called when all animations are done. 119 // |callback| will be called when all animations are done.
120 virtual void OnLockScreenHide(base::Closure& callback) = 0; 120 virtual void OnLockScreenHide(base::Closure& callback) = 0;
121 121
122 // Sets up the callback that should be called once lock animation is finished. 122 // Sets up the callback that should be called once lock animation is finished.
123 // Callback is guaranteed to be called once and then discarded. 123 // Callback is guaranteed to be called once and then discarded.
124 virtual void SetLockScreenDisplayedCallback(base::Closure& callback) = 0; 124 virtual void SetLockScreenDisplayedCallback(base::Closure& callback) = 0;
125 125
126 virtual void AddObserver(SessionStateObserver* observer); 126 virtual void AddObserver(SessionLockStateObserver* observer);
127 virtual void RemoveObserver(SessionStateObserver* observer); 127 virtual void RemoveObserver(SessionLockStateObserver* observer);
128 virtual bool HasObserver(SessionStateObserver* observer); 128 virtual bool HasObserver(SessionLockStateObserver* observer);
129 129
130 protected: 130 protected:
131 friend class test::PowerButtonControllerTest; 131 friend class test::PowerButtonControllerTest;
132 friend class test::SessionStateControllerImpl2Test; 132 friend class test::SessionLockStateControllerImpl2Test;
133 133
134 scoped_ptr<internal::SessionStateAnimator> animator_; 134 scoped_ptr<internal::SessionStateAnimator> animator_;
135 135
136 scoped_ptr<SessionStateControllerDelegate> delegate_; 136 scoped_ptr<SessionLockStateControllerDelegate> delegate_;
137 137
138 ObserverList<SessionStateObserver> observers_; 138 ObserverList<SessionLockStateObserver> observers_;
139 139
140 private: 140 private:
141 DISALLOW_COPY_AND_ASSIGN(SessionStateController); 141 DISALLOW_COPY_AND_ASSIGN(SessionLockStateController);
142 }; 142 };
143 143
144 } // namespace ash 144 } // namespace ash
145 145
146 #endif // ASH_WM_SESSION_STATE_CONTROLLER_H_ 146 #endif // ASH_WM_SESSION_LOCK_STATE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698