| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/app_list/views/top_icon_animation_view.h" | 5 #include "ui/app_list/views/top_icon_animation_view.h" |
| 6 | 6 |
| 7 #include "ui/app_list/app_list_constants.h" | 7 #include "ui/app_list/app_list_constants.h" |
| 8 #include "ui/compositor/scoped_layer_animation_settings.h" | 8 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 9 #include "ui/gfx/image/image_skia_operations.h" | 9 #include "ui/gfx/image/image_skia_operations.h" |
| 10 #include "ui/views/controls/image_view.h" | 10 #include "ui/views/controls/image_view.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 if (open_folder_) { | 52 if (open_folder_) { |
| 53 // Transform to a scaled down icon inside the original folder icon. | 53 // Transform to a scaled down icon inside the original folder icon. |
| 54 layer()->SetTransform(transform); | 54 layer()->SetTransform(transform); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Animate the icon to its target location and scale when opening or | 57 // Animate the icon to its target location and scale when opening or |
| 58 // closing a folder. | 58 // closing a folder. |
| 59 ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator()); | 59 ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator()); |
| 60 settings.AddObserver(this); | 60 settings.AddObserver(this); |
| 61 settings.SetTweenType(gfx::Tween::EASE_IN_OUT_2); |
| 61 settings.SetTransitionDuration( | 62 settings.SetTransitionDuration( |
| 62 base::TimeDelta::FromMilliseconds(kFolderTransitionInDurationMs)); | 63 base::TimeDelta::FromMilliseconds(kFolderTransitionInDurationMs)); |
| 63 layer()->SetTransform(open_folder_ ? gfx::Transform() : transform); | 64 layer()->SetTransform(open_folder_ ? gfx::Transform() : transform); |
| 64 } | 65 } |
| 65 | 66 |
| 66 gfx::Size TopIconAnimationView::GetPreferredSize() { | 67 gfx::Size TopIconAnimationView::GetPreferredSize() { |
| 67 return icon_size_; | 68 return icon_size_; |
| 68 } | 69 } |
| 69 | 70 |
| 70 void TopIconAnimationView::Layout() { | 71 void TopIconAnimationView::Layout() { |
| 71 icon_->SetBoundsRect(GetContentsBounds()); | 72 icon_->SetBoundsRect(GetContentsBounds()); |
| 72 } | 73 } |
| 73 | 74 |
| 74 void TopIconAnimationView::OnImplicitAnimationsCompleted() { | 75 void TopIconAnimationView::OnImplicitAnimationsCompleted() { |
| 75 SetVisible(false); | 76 SetVisible(false); |
| 76 FOR_EACH_OBSERVER(TopIconAnimationObserver, | 77 FOR_EACH_OBSERVER(TopIconAnimationObserver, |
| 77 observers_, | 78 observers_, |
| 78 OnTopIconAnimationsComplete()); | 79 OnTopIconAnimationsComplete()); |
| 79 delete this; | 80 delete this; |
| 80 } | 81 } |
| 81 | 82 |
| 82 } // namespace app_list | 83 } // namespace app_list |
| OLD | NEW |