| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // Animate the icon to its target location and scale when opening or | 60 // Animate the icon to its target location and scale when opening or |
| 61 // closing a folder. | 61 // closing a folder. |
| 62 ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator()); | 62 ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator()); |
| 63 settings.AddObserver(this); | 63 settings.AddObserver(this); |
| 64 settings.SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); | 64 settings.SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); |
| 65 settings.SetTransitionDuration( | 65 settings.SetTransitionDuration( |
| 66 base::TimeDelta::FromMilliseconds(kFolderTransitionInDurationMs)); | 66 base::TimeDelta::FromMilliseconds(kFolderTransitionInDurationMs)); |
| 67 layer()->SetTransform(open_folder_ ? gfx::Transform() : transform); | 67 layer()->SetTransform(open_folder_ ? gfx::Transform() : transform); |
| 68 } | 68 } |
| 69 | 69 |
| 70 gfx::Size TopIconAnimationView::GetPreferredSize() { | 70 gfx::Size TopIconAnimationView::GetPreferredSize() const { |
| 71 return icon_size_; | 71 return icon_size_; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void TopIconAnimationView::Layout() { | 74 void TopIconAnimationView::Layout() { |
| 75 icon_->SetBoundsRect(GetContentsBounds()); | 75 icon_->SetBoundsRect(GetContentsBounds()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void TopIconAnimationView::OnImplicitAnimationsCompleted() { | 78 void TopIconAnimationView::OnImplicitAnimationsCompleted() { |
| 79 SetVisible(false); | 79 SetVisible(false); |
| 80 FOR_EACH_OBSERVER(TopIconAnimationObserver, | 80 FOR_EACH_OBSERVER(TopIconAnimationObserver, |
| 81 observers_, | 81 observers_, |
| 82 OnTopIconAnimationsComplete()); | 82 OnTopIconAnimationsComplete()); |
| 83 delete this; | 83 delete this; |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool TopIconAnimationView::RequiresNotificationWhenAnimatorDestroyed() const { | 86 bool TopIconAnimationView::RequiresNotificationWhenAnimatorDestroyed() const { |
| 87 return true; | 87 return true; |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace app_list | 90 } // namespace app_list |
| OLD | NEW |