| OLD | NEW |
| 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/window_animations.h" | 5 #include "ash/wm/window_animations.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ash/ash_switches.h" | |
| 13 #include "ash/launcher/launcher.h" | 12 #include "ash/launcher/launcher.h" |
| 14 #include "ash/screen_ash.h" | 13 #include "ash/screen_ash.h" |
| 15 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 16 #include "ash/wm/window_util.h" | 15 #include "ash/wm/window_util.h" |
| 17 #include "ash/wm/workspace_controller.h" | 16 #include "ash/wm/workspace_controller.h" |
| 18 #include "ash/wm/workspace/workspace_animations.h" | 17 #include "ash/wm/workspace/workspace_animations.h" |
| 19 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 20 #include "base/compiler_specific.h" | 19 #include "base/compiler_specific.h" |
| 21 #include "base/logging.h" | 20 #include "base/logging.h" |
| 22 #include "base/message_loop.h" | 21 #include "base/message_loop.h" |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 return AnimateShowWindow(window); | 469 return AnimateShowWindow(window); |
| 471 // Don't start hiding the window again if it's already being hidden. | 470 // Don't start hiding the window again if it's already being hidden. |
| 472 return window->layer()->GetTargetOpacity() != 0.0f && | 471 return window->layer()->GetTargetOpacity() != 0.0f && |
| 473 AnimateHideWindow(window); | 472 AnimateHideWindow(window); |
| 474 } | 473 } |
| 475 | 474 |
| 476 std::vector<ui::LayerAnimationSequence*> | 475 std::vector<ui::LayerAnimationSequence*> |
| 477 CreateBrightnessGrayscaleAnimationSequence(float target_value, | 476 CreateBrightnessGrayscaleAnimationSequence(float target_value, |
| 478 base::TimeDelta duration) { | 477 base::TimeDelta duration) { |
| 479 ui::Tween::Type animation_type = ui::Tween::EASE_OUT; | 478 ui::Tween::Type animation_type = ui::Tween::EASE_OUT; |
| 480 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 481 ash::switches::kAshBootAnimationFunction2)) { | |
| 482 animation_type = ui::Tween::EASE_OUT_2; | |
| 483 } else if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 484 ash::switches::kAshBootAnimationFunction3)) { | |
| 485 animation_type = ui::Tween::EASE_OUT_3; | |
| 486 } | |
| 487 scoped_ptr<ui::LayerAnimationSequence> brightness_sequence( | 479 scoped_ptr<ui::LayerAnimationSequence> brightness_sequence( |
| 488 new ui::LayerAnimationSequence()); | 480 new ui::LayerAnimationSequence()); |
| 489 scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence( | 481 scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence( |
| 490 new ui::LayerAnimationSequence()); | 482 new ui::LayerAnimationSequence()); |
| 491 | 483 |
| 492 scoped_ptr<ui::LayerAnimationElement> brightness_element( | 484 scoped_ptr<ui::LayerAnimationElement> brightness_element( |
| 493 ui::LayerAnimationElement::CreateBrightnessElement( | 485 ui::LayerAnimationElement::CreateBrightnessElement( |
| 494 target_value, duration)); | 486 target_value, duration)); |
| 495 brightness_element->set_tween_type(animation_type); | 487 brightness_element->set_tween_type(animation_type); |
| 496 brightness_sequence->AddElement(brightness_element.release()); | 488 brightness_sequence->AddElement(brightness_element.release()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 515 type == LAYER_SCALE_ANIMATION_ABOVE ? kLayerScaleAboveSize : | 507 type == LAYER_SCALE_ANIMATION_ABOVE ? kLayerScaleAboveSize : |
| 516 kLayerScaleBelowSize; | 508 kLayerScaleBelowSize; |
| 517 gfx::Transform transform; | 509 gfx::Transform transform; |
| 518 transform.Translate(-layer->bounds().width() * (scale - 1.0f) / 2, | 510 transform.Translate(-layer->bounds().width() * (scale - 1.0f) / 2, |
| 519 -layer->bounds().height() * (scale - 1.0f) / 2); | 511 -layer->bounds().height() * (scale - 1.0f) / 2); |
| 520 transform.Scale(scale, scale); | 512 transform.Scale(scale, scale); |
| 521 layer->SetTransform(transform); | 513 layer->SetTransform(transform); |
| 522 } | 514 } |
| 523 | 515 |
| 524 } // namespace ash | 516 } // namespace ash |
| OLD | NEW |