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

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

Issue 11453012: Fix black background when locking with fullscreen window: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove stuff for testing and disable some tests" Created 8 years 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
« no previous file with comments | « ash/wm/session_state_animator.h ('k') | ash/wm/session_state_controller_impl2.h » ('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 #include "ash/wm/session_state_animator.h" 5 #include "ash/wm/session_state_animator.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/wm/window_animations.h" 9 #include "ash/wm/window_animations.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 animator->set_preemption_strategy( 113 animator->set_preemption_strategy(
114 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 114 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
115 ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence( 115 ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence(
116 ui::LayerAnimationElement::CreateOpacityElement( 116 ui::LayerAnimationElement::CreateOpacityElement(
117 target_opacity, duration)); 117 target_opacity, duration));
118 animator->StartAnimation(sequence); 118 animator->StartAnimation(sequence);
119 if (observer) 119 if (observer)
120 sequence->AddObserver(observer); 120 sequence->AddObserver(observer);
121 } 121 }
122 122
123 // Fades |window| in to full opacity over |duration|. 123 // Fades |window| to |opacity| over |duration|.
124 void FadeInWindow(aura::Window* window, 124 void StartOpacityAnimationForWindow(aura::Window* window,
125 base::TimeDelta duration, 125 float opacity,
126 ui::LayerAnimationObserver* observer) { 126 base::TimeDelta duration,
127 ui::LayerAnimationObserver* observer) {
127 ui::LayerAnimator* animator = window->layer()->GetAnimator(); 128 ui::LayerAnimator* animator = window->layer()->GetAnimator();
128 animator->set_preemption_strategy( 129 animator->set_preemption_strategy(
129 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 130 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
130 ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence( 131 ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence(
131 ui::LayerAnimationElement::CreateOpacityElement(1.0, duration)); 132 ui::LayerAnimationElement::CreateOpacityElement(opacity, duration));
132 animator->StartAnimation(sequence); 133 animator->StartAnimation(sequence);
133 if (observer) 134 if (observer)
134 sequence->AddObserver(observer); 135 sequence->AddObserver(observer);
135 } 136 }
136 137
137 // Makes |window| fully transparent instantaneously. 138 // Makes |window| fully transparent instantaneously.
138 void HideWindowImmediately(aura::Window* window, 139 void HideWindowImmediately(aura::Window* window,
139 ui::LayerAnimationObserver* observer) { 140 ui::LayerAnimationObserver* observer) {
140 window->layer()->SetOpacity(0.0); 141 window->layer()->SetOpacity(0.0);
141 if (observer) 142 if (observer)
142 observer->OnLayerAnimationEnded(NULL); 143 observer->OnLayerAnimationEnded(NULL);
143 } 144 }
144 145
145 // Restores |window| to its original position and scale and full opacity 146 // Restores |window| to its original position and scale and full opacity
146 // instantaneously. 147 // instantaneously.
147 void RestoreWindow(aura::Window* window, ui::LayerAnimationObserver* observer) { 148 void RestoreWindow(aura::Window* window, ui::LayerAnimationObserver* observer) {
148 window->layer()->SetTransform(gfx::Transform()); 149 window->layer()->SetTransform(gfx::Transform());
149 window->layer()->SetOpacity(1.0); 150 window->layer()->SetOpacity(1.0);
150 if (observer) 151 if (observer)
151 observer->OnLayerAnimationEnded(NULL); 152 observer->OnLayerAnimationEnded(NULL);
152 } 153 }
153 154
154 void HideWindow(aura::Window* window, 155 void HideWindow(aura::Window* window,
155 base::TimeDelta duration, 156 base::TimeDelta duration,
156 bool above, 157 bool above,
157 ui::LayerAnimationObserver* observer) { 158 ui::LayerAnimationObserver* observer) {
158 ui::Layer* layer = window->layer(); 159 ui::Layer* layer = window->layer();
159 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); 160 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
160 161
162 settings.SetPreemptionStrategy(
163 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
161 settings.SetTransitionDuration(duration); 164 settings.SetTransitionDuration(duration);
162 165
163 settings.SetTweenType(ui::Tween::EASE_OUT); 166 settings.SetTweenType(ui::Tween::EASE_OUT);
164 SetTransformForScaleAnimation(layer, 167 SetTransformForScaleAnimation(layer,
165 above ? LAYER_SCALE_ANIMATION_ABOVE : LAYER_SCALE_ANIMATION_BELOW); 168 above ? LAYER_SCALE_ANIMATION_ABOVE : LAYER_SCALE_ANIMATION_BELOW);
166 169
167 settings.SetTweenType(ui::Tween::EASE_IN_OUT); 170 settings.SetTweenType(ui::Tween::EASE_IN_OUT);
168 layer->SetOpacity(0.0f); 171 layer->SetOpacity(0.0f);
169 172
170 // After the animation completes snap the transform back to the identity, 173 // After the animation completes snap the transform back to the identity,
(...skipping 10 matching lines...) Expand all
181 // it does not call NotifyEnded(). 184 // it does not call NotifyEnded().
182 if (observer) { 185 if (observer) {
183 ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence( 186 ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence(
184 ui::LayerAnimationElement::CreateOpacityElement( 187 ui::LayerAnimationElement::CreateOpacityElement(
185 0.0, base::TimeDelta())); 188 0.0, base::TimeDelta()));
186 sequence->AddObserver(observer); 189 sequence->AddObserver(observer);
187 layer->GetAnimator()->ScheduleAnimation(sequence); 190 layer->GetAnimator()->ScheduleAnimation(sequence);
188 } 191 }
189 } 192 }
190 193
191 void ShowWindow(aura::Window* window, 194 // Animates |window| to identity transform and full opacity over |duration|.
192 base::TimeDelta duration, 195 void TransformWindowToBaseState(aura::Window* window,
193 bool above, 196 base::TimeDelta duration,
194 ui::LayerAnimationObserver* observer) { 197 ui::LayerAnimationObserver* observer) {
195 ui::Layer* layer = window->layer(); 198 ui::Layer* layer = window->layer();
196 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); 199 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
197 200
198 // Set initial state of animation
199 settings.SetTransitionDuration(base::TimeDelta());
200 SetTransformForScaleAnimation(layer,
201 above ? LAYER_SCALE_ANIMATION_ABOVE : LAYER_SCALE_ANIMATION_BELOW);
202
203 // Animate to target values. 201 // Animate to target values.
202 settings.SetPreemptionStrategy(
203 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
204 settings.SetTransitionDuration(duration); 204 settings.SetTransitionDuration(duration);
205 205
206 settings.SetTweenType(ui::Tween::EASE_OUT); 206 settings.SetTweenType(ui::Tween::EASE_OUT);
207 layer->SetTransform(gfx::Transform()); 207 layer->SetTransform(gfx::Transform());
208 208
209 settings.SetTweenType(ui::Tween::EASE_IN_OUT); 209 settings.SetTweenType(ui::Tween::EASE_IN_OUT);
210 layer->SetOpacity(1.0f); 210 layer->SetOpacity(1.0f);
211 211
212 // A bit of a dirty trick: we need to catch the end of the animation we don't 212 // A bit of a dirty trick: we need to catch the end of the animation we don't
213 // control. So we use two facts we know: which animator will be used and the 213 // control. So we use two facts we know: which animator will be used and the
214 // target opacity to add "Do nothing" animation sequence. 214 // target opacity to add "Do nothing" animation sequence.
215 // Unfortunately, we can not just use empty LayerAnimationSequence, because 215 // Unfortunately, we can not just use empty LayerAnimationSequence, because
216 // it does not call NotifyEnded(). 216 // it does not call NotifyEnded().
217 if (observer) { 217 if (observer) {
218 ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence( 218 ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence(
219 ui::LayerAnimationElement::CreateOpacityElement( 219 ui::LayerAnimationElement::CreateOpacityElement(
220 1.0, base::TimeDelta())); 220 1.0, base::TimeDelta()));
221 sequence->AddObserver(observer); 221 sequence->AddObserver(observer);
222 layer->GetAnimator()->ScheduleAnimation(sequence); 222 layer->GetAnimator()->ScheduleAnimation(sequence);
223 } 223 }
224 } 224 }
225 225
226 void ShowWindow(aura::Window* window,
227 base::TimeDelta duration,
228 bool above,
229 ui::LayerAnimationObserver* observer) {
230 ui::Layer* layer = window->layer();
231 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
232
233 // Set initial state of animation
234 settings.SetPreemptionStrategy(
235 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
236 settings.SetTransitionDuration(base::TimeDelta());
237 SetTransformForScaleAnimation(layer,
238 above ? LAYER_SCALE_ANIMATION_ABOVE : LAYER_SCALE_ANIMATION_BELOW);
239
240 TransformWindowToBaseState(window, duration, observer);
241 }
242
226 // Starts grayscale/brightness animation for |window| over |duration|. Target 243 // Starts grayscale/brightness animation for |window| over |duration|. Target
227 // value for both grayscale and brightness are specified by |target|. 244 // value for both grayscale and brightness are specified by |target|.
228 void StartGrayscaleBrightnessAnimationForWindow( 245 void StartGrayscaleBrightnessAnimationForWindow(
229 aura::Window* window, 246 aura::Window* window,
230 float target, 247 float target,
231 base::TimeDelta duration, 248 base::TimeDelta duration,
232 ui::LayerAnimationObserver* observer) { 249 ui::LayerAnimationObserver* observer) {
233 ui::LayerAnimator* animator = window->layer()->GetAnimator(); 250 ui::LayerAnimator* animator = window->layer()->GetAnimator();
234 251
235 std::vector<ui::LayerAnimationSequence*> animations = 252 scoped_ptr<ui::LayerAnimationSequence> brightness_sequence(
236 CreateBrightnessGrayscaleAnimationSequence(target, duration); 253 new ui::LayerAnimationSequence());
254 scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence(
255 new ui::LayerAnimationSequence());
256
257 scoped_ptr<ui::LayerAnimationElement> brightness_element(
258 ui::LayerAnimationElement::CreateBrightnessElement(
259 target, duration));
260 brightness_element->set_tween_type(ui::Tween::EASE_IN);
261 brightness_sequence->AddElement(brightness_element.release());
262
263 scoped_ptr<ui::LayerAnimationElement> grayscale_element(
264 ui::LayerAnimationElement::CreateGrayscaleElement(
265 target, duration));
266 grayscale_element->set_tween_type(ui::Tween::EASE_IN);
267 grayscale_sequence->AddElement(grayscale_element.release());
268
269 std::vector<ui::LayerAnimationSequence*> animations;
270 animations.push_back(brightness_sequence.release());
271 animations.push_back(grayscale_sequence.release());
237 272
238 if (observer) 273 if (observer)
239 animations[0]->AddObserver(observer); 274 animations[0]->AddObserver(observer);
240 275
241 animator->set_preemption_strategy( 276 animator->set_preemption_strategy(
242 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 277 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
243 278
244 animator->StartTogether(animations); 279 animator->StartTogether(animations);
245 } 280 }
246 281
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 break; 327 break;
293 case SessionStateAnimator::ANIMATION_FULL_CLOSE: 328 case SessionStateAnimator::ANIMATION_FULL_CLOSE:
294 if (layer->GetTargetTransform() != GetFastCloseTransform() || 329 if (layer->GetTargetTransform() != GetFastCloseTransform() ||
295 layer->GetTargetOpacity() > 0.0001) 330 layer->GetTargetOpacity() > 0.0001)
296 return false; 331 return false;
297 break; 332 break;
298 case SessionStateAnimator::ANIMATION_FADE_IN: 333 case SessionStateAnimator::ANIMATION_FADE_IN:
299 if (layer->GetTargetOpacity() < 0.9999) 334 if (layer->GetTargetOpacity() < 0.9999)
300 return false; 335 return false;
301 break; 336 break;
337 case SessionStateAnimator::ANIMATION_FADE_OUT:
338 if (layer->GetTargetOpacity() > 0.0001)
339 return false;
340 break;
302 case SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY: 341 case SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY:
303 if (layer->GetTargetOpacity() > 0.0001) 342 if (layer->GetTargetOpacity() > 0.0001)
304 return false; 343 return false;
305 break; 344 break;
306 case SessionStateAnimator::ANIMATION_RESTORE: 345 case SessionStateAnimator::ANIMATION_RESTORE:
307 if (layer->opacity() < 0.9999 || layer->transform() != gfx::Transform()) 346 if (layer->opacity() < 0.9999 || layer->transform() != gfx::Transform())
308 return false; 347 return false;
309 break; 348 break;
310 case SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS: 349 case SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS:
311 if ((layer->GetTargetBrightness() < 0.9999) || 350 if ((layer->GetTargetBrightness() < 0.9999) ||
312 (layer->GetTargetGrayscale() < 0.9999)) 351 (layer->GetTargetGrayscale() < 0.9999))
313 return false; 352 return false;
314 break; 353 break;
315 case SessionStateAnimator::ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: 354 case SessionStateAnimator::ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS:
316 if ((layer->GetTargetBrightness() > 0.0001) || 355 if ((layer->GetTargetBrightness() > 0.0001) ||
317 (layer->GetTargetGrayscale() > 0.0001)) 356 (layer->GetTargetGrayscale() > 0.0001))
318 return false; 357 return false;
319 break; 358 break;
320 case SessionStateAnimator::ANIMATION_DROP: 359 case SessionStateAnimator::ANIMATION_DROP:
360 case SessionStateAnimator::ANIMATION_UNDO_LIFT:
321 //ToDo(antim) : check other effects 361 //ToDo(antim) : check other effects
322 if (layer->GetTargetOpacity() < 0.9999) 362 if (layer->GetTargetOpacity() < 0.9999)
323 return false; 363 return false;
324 break; 364 break;
325 //ToDo(antim) : check other effects 365 //ToDo(antim) : check other effects
326 case SessionStateAnimator::ANIMATION_LIFT: 366 case SessionStateAnimator::ANIMATION_LIFT:
327 if (layer->GetTargetOpacity() > 0.0001) 367 if (layer->GetTargetOpacity() > 0.0001)
328 return false; 368 return false;
329 break; 369 break;
330 case SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN: 370 case SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN:
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 SessionStateAnimator::~SessionStateAnimator() { 424 SessionStateAnimator::~SessionStateAnimator() {
385 } 425 }
386 426
387 base::TimeDelta SessionStateAnimator::GetDuration(AnimationSpeed speed) { 427 base::TimeDelta SessionStateAnimator::GetDuration(AnimationSpeed speed) {
388 switch (speed) { 428 switch (speed) {
389 case ANIMATION_SPEED_IMMEDIATE: 429 case ANIMATION_SPEED_IMMEDIATE:
390 return base::TimeDelta(); 430 return base::TimeDelta();
391 case ANIMATION_SPEED_UNDOABLE: 431 case ANIMATION_SPEED_UNDOABLE:
392 return base::TimeDelta::FromMilliseconds(400); 432 return base::TimeDelta::FromMilliseconds(400);
393 case ANIMATION_SPEED_REVERT: 433 case ANIMATION_SPEED_REVERT:
394 return base::TimeDelta::FromMilliseconds(100); 434 return base::TimeDelta::FromMilliseconds(150);
395 case ANIMATION_SPEED_FAST: 435 case ANIMATION_SPEED_FAST:
396 return base::TimeDelta::FromMilliseconds(150); 436 return base::TimeDelta::FromMilliseconds(150);
397 case ANIMATION_SPEED_SHOW_LOCK_SCREEN: 437 case ANIMATION_SPEED_SHOW_LOCK_SCREEN:
398 return base::TimeDelta::FromMilliseconds(200); 438 return base::TimeDelta::FromMilliseconds(200);
399 case ANIMATION_SPEED_MOVE_WINDOWS: 439 case ANIMATION_SPEED_MOVE_WINDOWS:
400 return base::TimeDelta::FromMilliseconds(400); 440 return base::TimeDelta::FromMilliseconds(350);
401 case ANIMATION_SPEED_UNDO_MOVE_WINDOWS: 441 case ANIMATION_SPEED_UNDO_MOVE_WINDOWS:
402 return base::TimeDelta::FromMilliseconds(600); 442 return base::TimeDelta::FromMilliseconds(500);
403 case ANIMATION_SPEED_SHUTDOWN: 443 case ANIMATION_SPEED_SHUTDOWN:
404 return base::TimeDelta::FromMilliseconds(1000); 444 return base::TimeDelta::FromMilliseconds(1000);
405 case ANIMATION_SPEED_REVERT_SHUTDOWN: 445 case ANIMATION_SPEED_REVERT_SHUTDOWN:
406 return base::TimeDelta::FromMilliseconds(1500); 446 return base::TimeDelta::FromMilliseconds(1500);
407 } 447 }
408 // Satisfy compilers that do not understand that we will return from switch 448 // Satisfy compilers that do not understand that we will return from switch
409 // above anyway. 449 // above anyway.
410 DCHECK(false) << "Unhandled animation speed " << speed; 450 DCHECK(false) << "Unhandled animation speed " << speed;
411 return base::TimeDelta(); 451 return base::TimeDelta();
412 } 452 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 if (container_mask & LOCK_SCREEN_CONTAINERS) { 491 if (container_mask & LOCK_SCREEN_CONTAINERS) {
452 containers->push_back(Shell::GetContainer( 492 containers->push_back(Shell::GetContainer(
453 root_window, 493 root_window,
454 internal::kShellWindowId_LockScreenContainersContainer)); 494 internal::kShellWindowId_LockScreenContainersContainer));
455 } 495 }
456 if (container_mask & LOCK_SCREEN_RELATED_CONTAINERS) { 496 if (container_mask & LOCK_SCREEN_RELATED_CONTAINERS) {
457 containers->push_back(Shell::GetContainer( 497 containers->push_back(Shell::GetContainer(
458 root_window, 498 root_window,
459 internal::kShellWindowId_LockScreenRelatedContainersContainer)); 499 internal::kShellWindowId_LockScreenRelatedContainersContainer));
460 } 500 }
461 if (container_mask & LOCK_SCREEN_SYSTEM_FOREGROUND) {
462 containers->push_back(Shell::GetContainer(
463 root_window,
464 internal::kShellWindowId_PowerButtonAnimationContainer));
465 }
466 } 501 }
467 502
468 void SessionStateAnimator::StartAnimation(int container_mask, 503 void SessionStateAnimator::StartAnimation(int container_mask,
469 AnimationType type, 504 AnimationType type,
470 AnimationSpeed speed) { 505 AnimationSpeed speed) {
471 aura::Window::Windows containers; 506 aura::Window::Windows containers;
472 GetContainers(container_mask, &containers); 507 GetContainers(container_mask, &containers);
473 for (aura::Window::Windows::const_iterator it = containers.begin(); 508 for (aura::Window::Windows::const_iterator it = containers.begin();
474 it != containers.end(); ++it) { 509 it != containers.end(); ++it) {
475 RunAnimationForWindow(*it, type, speed, NULL); 510 RunAnimationForWindow(*it, type, speed, NULL);
476 } 511 }
477 } 512 }
478 513
479 // Apply animation |type| to all containers described by |container_mask|.
480 void SessionStateAnimator::StartAnimationWithCallback( 514 void SessionStateAnimator::StartAnimationWithCallback(
481 int container_mask, 515 int container_mask,
482 AnimationType type, 516 AnimationType type,
483 AnimationSpeed speed, 517 AnimationSpeed speed,
484 base::Callback<void(void)>& callback) { 518 base::Callback<void(void)>& callback) {
485 aura::Window::Windows containers; 519 aura::Window::Windows containers;
486 GetContainers(container_mask, &containers); 520 GetContainers(container_mask, &containers);
487 for (aura::Window::Windows::const_iterator it = containers.begin(); 521 for (aura::Window::Windows::const_iterator it = containers.begin();
488 it != containers.end(); ++it) { 522 it != containers.end(); ++it) {
489 ui::LayerAnimationObserver* observer = 523 ui::LayerAnimationObserver* observer =
490 new CallbackAnimationObserver(callback); 524 new CallbackAnimationObserver(callback);
491 RunAnimationForWindow(*it, type, speed, observer); 525 RunAnimationForWindow(*it, type, speed, observer);
492 } 526 }
493 } 527 }
494 528
529 void SessionStateAnimator::StartAnimationWithObserver(
530 int container_mask,
531 AnimationType type,
532 AnimationSpeed speed,
533 ui::LayerAnimationObserver* observer) {
534 aura::Window::Windows containers;
535 GetContainers(container_mask, &containers);
536 for (aura::Window::Windows::const_iterator it = containers.begin();
537 it != containers.end(); ++it) {
538 RunAnimationForWindow(*it, type, speed, observer);
539 }
540 }
541
495 void SessionStateAnimator::StartGlobalAnimation(AnimationType type, 542 void SessionStateAnimator::StartGlobalAnimation(AnimationType type,
496 AnimationSpeed speed) { 543 AnimationSpeed speed) {
497 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); 544 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow();
498 RunAnimationForWindow(root_window, type, speed, NULL); 545 RunAnimationForWindow(root_window, type, speed, NULL);
499 } 546 }
500 547
501 void SessionStateAnimator::RunAnimationForWindow( 548 void SessionStateAnimator::RunAnimationForWindow(
502 aura::Window* window, 549 aura::Window* window,
503 AnimationType type, 550 AnimationType type,
504 AnimationSpeed speed, 551 AnimationSpeed speed,
505 ui::LayerAnimationObserver* observer) { 552 ui::LayerAnimationObserver* observer) {
506 base::TimeDelta duration = GetDuration(speed); 553 base::TimeDelta duration = GetDuration(speed);
507 554
508 switch (type) { 555 switch (type) {
509 case ANIMATION_PARTIAL_CLOSE: 556 case ANIMATION_PARTIAL_CLOSE:
510 StartSlowCloseAnimationForWindow(window, duration, observer); 557 StartSlowCloseAnimationForWindow(window, duration, observer);
511 break; 558 break;
512 case ANIMATION_UNDO_PARTIAL_CLOSE: 559 case ANIMATION_UNDO_PARTIAL_CLOSE:
513 StartUndoSlowCloseAnimationForWindow(window, duration, observer); 560 StartUndoSlowCloseAnimationForWindow(window, duration, observer);
514 break; 561 break;
515 case ANIMATION_FULL_CLOSE: 562 case ANIMATION_FULL_CLOSE:
516 StartFastCloseAnimationForWindow(window, duration, observer); 563 StartFastCloseAnimationForWindow(window, duration, observer);
517 break; 564 break;
518 case ANIMATION_FADE_IN: 565 case ANIMATION_FADE_IN:
519 FadeInWindow(window, duration, observer); 566 StartOpacityAnimationForWindow(window, 1.0, duration, observer);
567 break;
568 case ANIMATION_FADE_OUT:
569 StartOpacityAnimationForWindow(window, 0.0, duration, observer);
520 break; 570 break;
521 case ANIMATION_HIDE_IMMEDIATELY: 571 case ANIMATION_HIDE_IMMEDIATELY:
522 DCHECK_EQ(speed, ANIMATION_SPEED_IMMEDIATE); 572 DCHECK_EQ(speed, ANIMATION_SPEED_IMMEDIATE);
523 HideWindowImmediately(window, observer); 573 HideWindowImmediately(window, observer);
524 break; 574 break;
525 case ANIMATION_RESTORE: 575 case ANIMATION_RESTORE:
526 DCHECK_EQ(speed, ANIMATION_SPEED_IMMEDIATE); 576 DCHECK_EQ(speed, ANIMATION_SPEED_IMMEDIATE);
527 RestoreWindow(window, observer); 577 RestoreWindow(window, observer);
528 break; 578 break;
529 case ANIMATION_LIFT: 579 case ANIMATION_LIFT:
530 HideWindow(window, duration, true, observer); 580 HideWindow(window, duration, true, observer);
531 break; 581 break;
532 case ANIMATION_DROP: 582 case ANIMATION_DROP:
533 ShowWindow(window, duration, true, observer); 583 ShowWindow(window, duration, true, observer);
534 break; 584 break;
585 case ANIMATION_UNDO_LIFT:
586 TransformWindowToBaseState(window, duration, observer);
587 break;
535 case ANIMATION_RAISE_TO_SCREEN: 588 case ANIMATION_RAISE_TO_SCREEN:
536 ShowWindow(window, duration, false, observer); 589 ShowWindow(window, duration, false, observer);
537 break; 590 break;
538 case ANIMATION_LOWER_BELOW_SCREEN: 591 case ANIMATION_LOWER_BELOW_SCREEN:
539 HideWindow(window, duration, false, observer); 592 HideWindow(window, duration, false, observer);
540 break; 593 break;
541 case ANIMATION_PARTIAL_FADE_IN: 594 case ANIMATION_PARTIAL_FADE_IN:
542 StartPartialFadeAnimation( 595 StartPartialFadeAnimation(
543 window, kPartialFadeRatio, duration, observer); 596 window, kPartialFadeRatio, duration, observer);
544 break; 597 break;
(...skipping 26 matching lines...) Expand all
571 foreground_->SetColor(SK_ColorWHITE); 624 foreground_->SetColor(SK_ColorWHITE);
572 foreground_->GetWidget()->Show(); 625 foreground_->GetWidget()->Show();
573 } 626 }
574 627
575 void SessionStateAnimator::DropForeground() { 628 void SessionStateAnimator::DropForeground() {
576 foreground_.reset(); 629 foreground_.reset();
577 } 630 }
578 631
579 } // namespace internal 632 } // namespace internal
580 } // namespace ash 633 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/session_state_animator.h ('k') | ash/wm/session_state_controller_impl2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698