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

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

Issue 9428056: ash: Create new containers for PowerButtonController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update PowerButtonController Created 8 years, 10 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_POWER_BUTTON_CONTROLLER_H_ 5 #ifndef ASH_WM_POWER_BUTTON_CONTROLLER_H_
6 #define ASH_WM_POWER_BUTTON_CONTROLLER_H_ 6 #define ASH_WM_POWER_BUTTON_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map>
10
11 #include "ash/ash_export.h" 9 #include "ash/ash_export.h"
12 #include "base/basictypes.h" 10 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
14 #include "base/time.h" 12 #include "base/time.h"
15 #include "base/timer.h" 13 #include "base/timer.h"
16 #include "ui/aura/root_window_observer.h" 14 #include "ui/aura/root_window_observer.h"
17 #include "ui/aura/window.h"
18 15
19 namespace gfx { 16 namespace gfx {
20 class Size; 17 class Size;
21 } 18 }
22 19
23 namespace ui { 20 namespace ui {
24 class Layer; 21 class Layer;
25 class Transform;
26 } 22 }
27 23
28 namespace ash { 24 namespace ash {
29 25
30 // Performs system-related functions on behalf of PowerButtonController. 26 // Performs system-related functions on behalf of PowerButtonController.
31 class ASH_EXPORT PowerButtonControllerDelegate { 27 class ASH_EXPORT PowerButtonControllerDelegate {
32 public: 28 public:
33 PowerButtonControllerDelegate() {} 29 PowerButtonControllerDelegate() {}
34 virtual ~PowerButtonControllerDelegate() {} 30 virtual ~PowerButtonControllerDelegate() {}
35 31
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // Called when Chrome gets a request to display the lock screen. 148 // Called when Chrome gets a request to display the lock screen.
153 void OnStartingLock(); 149 void OnStartingLock();
154 150
155 // Called when the power or lock buttons are pressed or released. 151 // Called when the power or lock buttons are pressed or released.
156 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp); 152 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp);
157 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp); 153 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp);
158 154
159 // Displays the shutdown animation and requests shutdown when it's done. 155 // Displays the shutdown animation and requests shutdown when it's done.
160 void RequestShutdown(); 156 void RequestShutdown();
161 157
162 // Fills |containers| with the containers described by |group|.
163 void GetContainers(ContainerGroup group,
164 aura::Window::Windows* containers);
165
166 // aura::RootWindowObserver overrides: 158 // aura::RootWindowObserver overrides:
167 virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE; 159 virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE;
168 160
169 private: 161 private:
170 bool logged_in_as_non_guest() const { return logged_in_ && !is_guest_; } 162 bool logged_in_as_non_guest() const { return logged_in_ && !is_guest_; }
171 163
172 // Requests that the screen be locked and starts |lock_fail_timer_|. 164 // Requests that the screen be locked and starts |lock_fail_timer_|.
173 void OnLockTimeout(); 165 void OnLockTimeout();
174 166
175 // Aborts the pre-lock animation. 167 // Aborts the pre-lock animation.
(...skipping 13 matching lines...) Expand all
189 void StartShutdownTimer(); 181 void StartShutdownTimer();
190 182
191 // Displays the shutdown animation and starts |real_shutdown_timer_|. 183 // Displays the shutdown animation and starts |real_shutdown_timer_|.
192 void StartShutdownAnimationAndRequestShutdown(); 184 void StartShutdownAnimationAndRequestShutdown();
193 185
194 // Shows or hides |background_layer_|. The show method creates and 186 // Shows or hides |background_layer_|. The show method creates and
195 // initializes the layer if it doesn't already exist. 187 // initializes the layer if it doesn't already exist.
196 void ShowBackgroundLayer(); 188 void ShowBackgroundLayer();
197 void HideBackgroundLayer(); 189 void HideBackgroundLayer();
198 190
199 // Apply animation |type| to all containers described by |group|.
200 void StartAnimation(ContainerGroup group, AnimationType type);
201
202 // Retrieve original transform for |window| stored before animation started.
203 ui::Transform RetrieveOriginalTransform(aura::Window* window);
204
205 scoped_ptr<PowerButtonControllerDelegate> delegate_; 191 scoped_ptr<PowerButtonControllerDelegate> delegate_;
206 192
207 // True if the user is currently logged in. 193 // True if the user is currently logged in.
208 bool logged_in_; 194 bool logged_in_;
209 195
210 // True if a guest user is currently logged in. Unused if |logged_in_| is 196 // True if a guest user is currently logged in. Unused if |logged_in_| is
211 // false. 197 // false.
212 bool is_guest_; 198 bool is_guest_;
213 199
214 // True if the screen is currently locked. 200 // True if the screen is currently locked.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // Started when we display the shutdown animation. When it fires, we actually 243 // Started when we display the shutdown animation. When it fires, we actually
258 // request shutdown. Gives the animation time to complete before Chrome, X, 244 // request shutdown. Gives the animation time to complete before Chrome, X,
259 // etc. are shut down. 245 // etc. are shut down.
260 base::OneShotTimer<PowerButtonController> real_shutdown_timer_; 246 base::OneShotTimer<PowerButtonController> real_shutdown_timer_;
261 247
262 // Started when we abort the pre-lock state. When it fires, we hide 248 // Started when we abort the pre-lock state. When it fires, we hide
263 // |background_layer_|, as the desktop background is now covering the whole 249 // |background_layer_|, as the desktop background is now covering the whole
264 // screen. 250 // screen.
265 base::OneShotTimer<PowerButtonController> hide_background_layer_timer_; 251 base::OneShotTimer<PowerButtonController> hide_background_layer_timer_;
266 252
267 // Map from containers to their original layer transforms before animation.
268 typedef std::map<aura::Window*, ui::Transform> WindowTransformsMap;
269 WindowTransformsMap container_transforms_;
270
271 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); 253 DISALLOW_COPY_AND_ASSIGN(PowerButtonController);
272 }; 254 };
273 255
274 } // namespace ash 256 } // namespace ash
275 257
276 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_ 258 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698