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

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

Issue 10909008: Improve existing lock transition - remove black splash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: +comment Created 8 years, 3 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 #include "ash/wm/power_button_controller.h" 5 #include "ash/wm/power_button_controller.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_delegate.h" 9 #include "ash/shell_delegate.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void RestoreWindow(aura::Window* window) { 157 void RestoreWindow(aura::Window* window) {
158 window->layer()->SetTransform(ui::Transform()); 158 window->layer()->SetTransform(ui::Transform());
159 window->layer()->SetOpacity(1.0); 159 window->layer()->SetOpacity(1.0);
160 } 160 }
161 161
162 // Fills |containers| with the containers described by |group|. 162 // Fills |containers| with the containers described by |group|.
163 void GetContainers(PowerButtonController::ContainerGroup group, 163 void GetContainers(PowerButtonController::ContainerGroup group,
164 aura::Window::Windows* containers) { 164 aura::Window::Windows* containers) {
165 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); 165 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow();
166 166
167 aura::Window* wallpaper_container = Shell::GetContainer(
168 root_window,
169 internal::kShellWindowId_DesktopBackgroundContainer);
170 aura::Window* lock_wallpaper_container = Shell::GetContainer(
171 root_window,
172 internal::kShellWindowId_LockScreenBackgroundContainer);
173
167 aura::Window* non_lock_screen_containers = Shell::GetContainer( 174 aura::Window* non_lock_screen_containers = Shell::GetContainer(
168 root_window, 175 root_window,
169 internal::kShellWindowId_NonLockScreenContainersContainer); 176 internal::kShellWindowId_NonLockScreenContainersContainer);
170 aura::Window* lock_screen_containers = Shell::GetContainer( 177 aura::Window* lock_screen_containers = Shell::GetContainer(
171 root_window, 178 root_window,
172 internal::kShellWindowId_LockScreenContainersContainer); 179 internal::kShellWindowId_LockScreenContainersContainer);
173 aura::Window* lock_screen_related_containers = Shell::GetContainer( 180 aura::Window* lock_screen_related_containers = Shell::GetContainer(
174 root_window, 181 root_window,
175 internal::kShellWindowId_LockScreenRelatedContainersContainer); 182 internal::kShellWindowId_LockScreenRelatedContainersContainer);
176 183
177 containers->clear(); 184 containers->clear();
178 switch (group) { 185 switch (group) {
179 case PowerButtonController::ALL_CONTAINERS: 186 case PowerButtonController::ALL_CONTAINERS:
187 containers->push_back(wallpaper_container);
180 containers->push_back(non_lock_screen_containers); 188 containers->push_back(non_lock_screen_containers);
189 containers->push_back(lock_wallpaper_container);
181 containers->push_back(lock_screen_containers); 190 containers->push_back(lock_screen_containers);
182 containers->push_back(lock_screen_related_containers); 191 containers->push_back(lock_screen_related_containers);
183 break; 192 break;
184 case PowerButtonController::SCREEN_LOCKER_CONTAINERS: 193 case PowerButtonController::SCREEN_LOCKER_CONTAINERS_EXCEPT_WALLPAPER:
185 containers->push_back(lock_screen_containers); 194 containers->push_back(lock_screen_containers);
186 break; 195 break;
187 case PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS: 196 case PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS:
197 containers->push_back(lock_wallpaper_container);
188 containers->push_back(lock_screen_containers); 198 containers->push_back(lock_screen_containers);
189 containers->push_back(lock_screen_related_containers); 199 containers->push_back(lock_screen_related_containers);
190 break; 200 break;
191 case PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS: 201 case PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS:
202 // Doesn't include wallpaper_container as it is now excluded from
203 // these animations (i.e. restore).
204 // New lock/shutdown transition may change that.
192 containers->push_back(non_lock_screen_containers); 205 containers->push_back(non_lock_screen_containers);
193 break; 206 break;
194 default: 207 default:
195 NOTREACHED() << "Unhandled container group " << group; 208 NOTREACHED() << "Unhandled container group " << group;
196 } 209 }
197 } 210 }
198 211
199 // Apply animation |type| to all containers described by |group|. 212 // Apply animation |type| to all containers described by |group|.
200 void StartAnimation(PowerButtonController::ContainerGroup group, 213 void StartAnimation(PowerButtonController::ContainerGroup group,
201 PowerButtonController::AnimationType type) { 214 PowerButtonController::AnimationType type) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 339
327 if (!locked && login_status_ == user::LOGGED_IN_LOCKED) { 340 if (!locked && login_status_ == user::LOGGED_IN_LOCKED) {
328 login_status_ = unlocked_login_status_; 341 login_status_ = unlocked_login_status_;
329 unlocked_login_status_ = user::LOGGED_IN_NONE; 342 unlocked_login_status_ = user::LOGGED_IN_NONE;
330 } else { 343 } else {
331 unlocked_login_status_ = login_status_; 344 unlocked_login_status_ = login_status_;
332 login_status_ = user::LOGGED_IN_LOCKED; 345 login_status_ = user::LOGGED_IN_LOCKED;
333 } 346 }
334 347
335 if (locked) { 348 if (locked) {
336 StartAnimation(SCREEN_LOCKER_CONTAINERS, ANIMATION_FADE_IN); 349 StartAnimation(SCREEN_LOCKER_CONTAINERS_EXCEPT_WALLPAPER,
350 ANIMATION_FADE_IN);
337 lock_timer_.Stop(); 351 lock_timer_.Stop();
338 lock_fail_timer_.Stop(); 352 lock_fail_timer_.Stop();
339 353
340 if (!has_legacy_power_button_ && power_button_down_) { 354 if (!has_legacy_power_button_ && power_button_down_) {
341 lock_to_shutdown_timer_.Stop(); 355 lock_to_shutdown_timer_.Stop();
342 lock_to_shutdown_timer_.Start( 356 lock_to_shutdown_timer_.Start(
343 FROM_HERE, 357 FROM_HERE,
344 base::TimeDelta::FromMilliseconds(kLockToShutdownTimeoutMs), 358 base::TimeDelta::FromMilliseconds(kLockToShutdownTimeoutMs),
345 this, &PowerButtonController::OnLockToShutdownTimeout); 359 this, &PowerButtonController::OnLockToShutdownTimeout);
346 } 360 }
(...skipping 14 matching lines...) Expand all
361 375
362 // Ensure that the background layer is visible -- if the screen was locked via 376 // Ensure that the background layer is visible -- if the screen was locked via
363 // the wrench menu, we won't have already shown the background as part of the 377 // the wrench menu, we won't have already shown the background as part of the
364 // slow-close animation. 378 // slow-close animation.
365 ShowBackgroundLayer(); 379 ShowBackgroundLayer();
366 380
367 StartAnimation(ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 381 StartAnimation(ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS,
368 ANIMATION_FAST_CLOSE); 382 ANIMATION_FAST_CLOSE);
369 383
370 // Hide the screen locker containers so we can make them fade in later. 384 // Hide the screen locker containers so we can make them fade in later.
371 StartAnimation(SCREEN_LOCKER_CONTAINERS, ANIMATION_HIDE); 385 StartAnimation(SCREEN_LOCKER_CONTAINERS_EXCEPT_WALLPAPER,
386 ANIMATION_HIDE);
372 } 387 }
373 388
374 void PowerButtonController::OnPowerButtonEvent( 389 void PowerButtonController::OnPowerButtonEvent(
375 bool down, const base::TimeTicks& timestamp) { 390 bool down, const base::TimeTicks& timestamp) {
376 power_button_down_ = down; 391 power_button_down_ = down;
377 392
378 if (shutting_down_) 393 if (shutting_down_)
379 return; 394 return;
380 395
381 // Avoid starting the lock/shutdown sequence if the power button is pressed 396 // Avoid starting the lock/shutdown sequence if the power button is pressed
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 root_layer->StackAtBottom(background_layer_.get()); 595 root_layer->StackAtBottom(background_layer_.get());
581 } 596 }
582 background_layer_->SetVisible(true); 597 background_layer_->SetVisible(true);
583 } 598 }
584 599
585 void PowerButtonController::HideBackgroundLayer() { 600 void PowerButtonController::HideBackgroundLayer() {
586 background_layer_.reset(); 601 background_layer_.reset();
587 } 602 }
588 603
589 } // namespace ash 604 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698