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

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

Issue 9348089: Make power button controller restore to original transformation on the layer. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update 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
« no previous file with comments | « no previous file | ash/wm/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 (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
9 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
10 #include "base/basictypes.h" 12 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
12 #include "base/time.h" 14 #include "base/time.h"
13 #include "base/timer.h" 15 #include "base/timer.h"
14 #include "ui/aura/root_window_observer.h" 16 #include "ui/aura/root_window_observer.h"
17 #include "ui/aura/window.h"
15 18
16 namespace gfx { 19 namespace gfx {
17 class Size; 20 class Size;
18 } 21 }
19 22
20 namespace ui { 23 namespace ui {
21 class Layer; 24 class Layer;
25 class Transform;
22 } 26 }
23 27
24 namespace ash { 28 namespace ash {
25 29
26 // Performs system-related functions on behalf of PowerButtonController. 30 // Performs system-related functions on behalf of PowerButtonController.
27 class ASH_EXPORT PowerButtonControllerDelegate { 31 class ASH_EXPORT PowerButtonControllerDelegate {
28 public: 32 public:
29 PowerButtonControllerDelegate() {} 33 PowerButtonControllerDelegate() {}
30 virtual ~PowerButtonControllerDelegate() {} 34 virtual ~PowerButtonControllerDelegate() {}
31 35
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Called when Chrome gets a request to display the lock screen. 149 // Called when Chrome gets a request to display the lock screen.
146 void OnStartingLock(); 150 void OnStartingLock();
147 151
148 // Called when the power or lock buttons are pressed or released. 152 // Called when the power or lock buttons are pressed or released.
149 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp); 153 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp);
150 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp); 154 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp);
151 155
152 // aura::RootWindowObserver overrides: 156 // aura::RootWindowObserver overrides:
153 virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE; 157 virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE;
154 158
159 // Fills |containers| with the containers described by |group|.
160 void GetContainers(ContainerGroup group,
161 aura::Window::Windows* containers);
162
155 private: 163 private:
156 // Requests that the screen be locked and starts |lock_fail_timer_|. 164 // Requests that the screen be locked and starts |lock_fail_timer_|.
157 void OnLockTimeout(); 165 void OnLockTimeout();
158 166
159 // Aborts the pre-lock animation. 167 // Aborts the pre-lock animation.
160 void OnLockFailTimeout(); 168 void OnLockFailTimeout();
161 169
162 // Displays the pre-shutdown animation and starts |shutdown_timer_|. 170 // Displays the pre-shutdown animation and starts |shutdown_timer_|.
163 void OnLockToShutdownTimeout(); 171 void OnLockToShutdownTimeout();
164 172
165 // Displays the shutdown animation and starts |real_shutdown_timer_|. 173 // Displays the shutdown animation and starts |real_shutdown_timer_|.
166 void OnShutdownTimeout(); 174 void OnShutdownTimeout();
167 175
168 // Requests that the machine be shut down. 176 // Requests that the machine be shut down.
169 void OnRealShutdownTimeout(); 177 void OnRealShutdownTimeout();
170 178
171 // Puts us into the pre-lock or pre-shutdown state. 179 // Puts us into the pre-lock or pre-shutdown state.
172 void StartLockTimer(); 180 void StartLockTimer();
173 void StartShutdownTimer(); 181 void StartShutdownTimer();
174 182
175 // Shows or hides |background_layer_|. The show method creates and 183 // Shows or hides |background_layer_|. The show method creates and
176 // initializes the layer if it doesn't already exist. 184 // initializes the layer if it doesn't already exist.
177 void ShowBackgroundLayer(); 185 void ShowBackgroundLayer();
178 void HideBackgroundLayer(); 186 void HideBackgroundLayer();
179 187
188 // Apply animation |type| to all containers described by |group|.
189 void StartAnimation(ContainerGroup group, AnimationType type);
190
191 // Retrieve original transform for |window| stored before animation started.
192 ui::Transform RetrieveOriginalTransform(aura::Window* window);
193
180 scoped_ptr<PowerButtonControllerDelegate> delegate_; 194 scoped_ptr<PowerButtonControllerDelegate> delegate_;
181 195
182 // True if a non-guest user is currently logged in. 196 // True if a non-guest user is currently logged in.
183 bool logged_in_as_non_guest_; 197 bool logged_in_as_non_guest_;
184 198
185 // True if the screen is currently locked. 199 // True if the screen is currently locked.
186 bool locked_; 200 bool locked_;
187 201
188 // Are the power or lock buttons currently held? 202 // Are the power or lock buttons currently held?
189 bool power_button_down_; 203 bool power_button_down_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // Started when we display the shutdown animation. When it fires, we actually 242 // Started when we display the shutdown animation. When it fires, we actually
229 // request shutdown. Gives the animation time to complete before Chrome, X, 243 // request shutdown. Gives the animation time to complete before Chrome, X,
230 // etc. are shut down. 244 // etc. are shut down.
231 base::OneShotTimer<PowerButtonController> real_shutdown_timer_; 245 base::OneShotTimer<PowerButtonController> real_shutdown_timer_;
232 246
233 // Started when we abort the pre-lock state. When it fires, we hide 247 // Started when we abort the pre-lock state. When it fires, we hide
234 // |background_layer_|, as the desktop background is now covering the whole 248 // |background_layer_|, as the desktop background is now covering the whole
235 // screen. 249 // screen.
236 base::OneShotTimer<PowerButtonController> hide_background_layer_timer_; 250 base::OneShotTimer<PowerButtonController> hide_background_layer_timer_;
237 251
252 // Map from containers to their original layer transforms before animation.
253 typedef std::map<aura::Window*, ui::Transform> WindowTransformsMap;
254 WindowTransformsMap container_transforms_;
255
238 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); 256 DISALLOW_COPY_AND_ASSIGN(PowerButtonController);
239 }; 257 };
240 258
241 } // namespace ash 259 } // namespace ash
242 260
243 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_ 261 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | ash/wm/power_button_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698