| 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" |
| 11 #include "ui/compositor/scoped_layer_animation_settings.h" | 11 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 12 #include "ui/views/animation/ink_drop_hover_observer.h" | 12 #include "ui/views/animation/ink_drop_hover_observer.h" |
| 13 #include "ui/views/animation/ink_drop_painted_layer_delegates.h" | 13 #include "ui/views/animation/ink_drop_painted_layer_delegates.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // The opacity of the hover when it is visible. | 19 // The opacity of the hover when it is visible. |
| 20 const float kHoverVisibleOpacity = 0.128f; | 20 const float kHoverVisibleOpacity = 0.128f; |
| 21 | 21 |
| 22 // The opacity of the hover when it is not visible. | 22 // The opacity of the hover when it is not visible. |
| 23 const float kHiddenOpacity = 0.0f; | 23 const float kHiddenOpacity = 0.0f; |
| 24 | 24 |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 std::string ToString(InkDropHover::AnimationType animation_type) { |
| 28 switch (animation_type) { |
| 29 case InkDropHover::FADE_IN: |
| 30 return std::string("FADE_IN"); |
| 31 case InkDropHover::FADE_OUT: |
| 32 return std::string("FADE_OUT"); |
| 33 } |
| 34 NOTREACHED() |
| 35 << "Should never be reached but is necessary for some compilers."; |
| 36 return std::string("UNKNOWN"); |
| 37 } |
| 38 |
| 27 InkDropHover::InkDropHover(const gfx::Size& size, | 39 InkDropHover::InkDropHover(const gfx::Size& size, |
| 28 int corner_radius, | 40 int corner_radius, |
| 29 const gfx::Point& center_point, | 41 const gfx::Point& center_point, |
| 30 SkColor color) | 42 SkColor color) |
| 31 : size_(size), | 43 : size_(size), |
| 32 explode_size_(size), | 44 explode_size_(size), |
| 33 center_point_(center_point), | 45 center_point_(center_point), |
| 34 last_animation_initiated_was_fade_in_(false), | 46 last_animation_initiated_was_fade_in_(false), |
| 35 layer_delegate_( | 47 layer_delegate_( |
| 36 new RoundedRectangleLayerDelegate(color, size, corner_radius)), | 48 new RoundedRectangleLayerDelegate(color, size, corner_radius)), |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 if (observer_) { | 149 if (observer_) { |
| 138 observer_->AnimationEnded(animation_type, | 150 observer_->AnimationEnded(animation_type, |
| 139 observer.aborted_count() | 151 observer.aborted_count() |
| 140 ? InkDropAnimationEndedReason::PRE_EMPTED | 152 ? InkDropAnimationEndedReason::PRE_EMPTED |
| 141 : InkDropAnimationEndedReason::SUCCESS); | 153 : InkDropAnimationEndedReason::SUCCESS); |
| 142 } | 154 } |
| 143 return true; | 155 return true; |
| 144 } | 156 } |
| 145 | 157 |
| 146 } // namespace views | 158 } // namespace views |
| OLD | NEW |