| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/views/animation/ink_drop_hover.h" | 5 #include "ui/views/animation/ink_drop_hover.h" |
| 6 | 6 |
| 7 #include "third_party/skia/include/core/SkColor.h" | 7 #include "third_party/skia/include/core/SkColor.h" |
| 8 #include "ui/compositor/callback_layer_animation_observer.h" | 8 #include "ui/compositor/callback_layer_animation_observer.h" |
| 9 #include "ui/compositor/layer.h" | 9 #include "ui/compositor/layer.h" |
| 10 #include "ui/compositor/layer_animation_sequence.h" | 10 #include "ui/compositor/layer_animation_sequence.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 void InkDropHover::FadeIn(const base::TimeDelta& duration) { | 52 void InkDropHover::FadeIn(const base::TimeDelta& duration) { |
| 53 layer_->SetOpacity(kHiddenOpacity); | 53 layer_->SetOpacity(kHiddenOpacity); |
| 54 layer_->SetVisible(true); | 54 layer_->SetVisible(true); |
| 55 AnimateFade(FADE_IN, duration, size_, size_); | 55 AnimateFade(FADE_IN, duration, size_, size_); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void InkDropHover::FadeOut(const base::TimeDelta& duration, bool explode) { | 58 void InkDropHover::FadeOut(const base::TimeDelta& duration, bool explode) { |
| 59 AnimateFade(FADE_OUT, duration, size_, explode ? explode_size_ : size_); | 59 AnimateFade(FADE_OUT, duration, size_, explode ? explode_size_ : size_); |
| 60 } | 60 } |
| 61 | 61 |
| 62 test::InkDropHoverTestApi* InkDropHover::GetTestApi() { |
| 63 return nullptr; |
| 64 } |
| 65 |
| 62 void InkDropHover::AnimateFade(HoverAnimationType animation_type, | 66 void InkDropHover::AnimateFade(HoverAnimationType animation_type, |
| 63 const base::TimeDelta& duration, | 67 const base::TimeDelta& duration, |
| 64 const gfx::Size& initial_size, | 68 const gfx::Size& initial_size, |
| 65 const gfx::Size& target_size) { | 69 const gfx::Size& target_size) { |
| 66 last_animation_initiated_was_fade_in_ = animation_type == FADE_IN; | 70 last_animation_initiated_was_fade_in_ = animation_type == FADE_IN; |
| 67 | 71 |
| 68 layer_->SetTransform(CalculateTransform(initial_size)); | 72 layer_->SetTransform(CalculateTransform(initial_size)); |
| 69 | 73 |
| 70 // The |animation_observer| will be destroyed when the | 74 // The |animation_observer| will be destroyed when the |
| 71 // AnimationStartedCallback() returns true. | 75 // AnimationStartedCallback() returns true. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 HoverAnimationType animation_type, | 119 HoverAnimationType animation_type, |
| 116 const ui::CallbackLayerAnimationObserver& observer) { | 120 const ui::CallbackLayerAnimationObserver& observer) { |
| 117 // AnimationEndedCallback() may be invoked when this is being destroyed and | 121 // AnimationEndedCallback() may be invoked when this is being destroyed and |
| 118 // |layer_| may be null. | 122 // |layer_| may be null. |
| 119 if (animation_type == FADE_OUT && layer_) | 123 if (animation_type == FADE_OUT && layer_) |
| 120 layer_->SetVisible(false); | 124 layer_->SetVisible(false); |
| 121 return true; | 125 return true; |
| 122 } | 126 } |
| 123 | 127 |
| 124 } // namespace views | 128 } // namespace views |
| OLD | NEW |