| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_ | 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_ |
| 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_ | 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/gfx/geometry/point.h" | 9 #include "ui/gfx/geometry/point.h" |
| 10 #include "ui/views/animation/ink_drop_animation_observer.h" | 10 #include "ui/views/animation/ink_drop_animation_observer.h" |
| 11 #include "ui/views/animation/ink_drop_state.h" | 11 #include "ui/views/animation/ink_drop_state.h" |
| 12 #include "ui/views/views_export.h" | 12 #include "ui/views/views_export.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 class CallbackLayerAnimationObserver; | 15 class CallbackLayerAnimationObserver; |
| 16 class Layer; | 16 class Layer; |
| 17 class LayerAnimationObserver; | 17 class LayerAnimationObserver; |
| 18 } // namespace ui | 18 } // namespace ui |
| 19 | 19 |
| 20 namespace views { | 20 namespace views { |
| 21 | 21 |
| 22 namespace test { |
| 23 class InkDropAnimationTestApi; |
| 24 } // namespace test |
| 25 |
| 22 // Simple base class for animations that provide visual feedback for View state. | 26 // Simple base class for animations that provide visual feedback for View state. |
| 23 // Manages the attached InkDropAnimationObservers. | 27 // Manages the attached InkDropAnimationObservers. |
| 24 // | 28 // |
| 25 // TODO(bruthig): Document the ink drop ripple on chromium.org and add a link to | 29 // TODO(bruthig): Document the ink drop ripple on chromium.org and add a link to |
| 26 // the doc here. | 30 // the doc here. |
| 27 class VIEWS_EXPORT InkDropAnimation { | 31 class VIEWS_EXPORT InkDropAnimation { |
| 28 public: | 32 public: |
| 29 // TODO(bruthig): Remove UseFastAnimations() and kSlowAnimationDurationFactor. | 33 // TODO(bruthig): Remove UseFastAnimations() and kSlowAnimationDurationFactor. |
| 30 // See http://crbug.com/584681 | 34 // See http://crbug.com/584681 |
| 31 | 35 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 virtual void SnapToActivated(); | 78 virtual void SnapToActivated(); |
| 75 | 79 |
| 76 // The root Layer that can be added in to a Layer tree. | 80 // The root Layer that can be added in to a Layer tree. |
| 77 virtual ui::Layer* GetRootLayer() = 0; | 81 virtual ui::Layer* GetRootLayer() = 0; |
| 78 | 82 |
| 79 // Returns true when the ripple is visible. This is different from checking if | 83 // Returns true when the ripple is visible. This is different from checking if |
| 80 // the ink_drop_state() == HIDDEN because the ripple may be visible while it | 84 // the ink_drop_state() == HIDDEN because the ripple may be visible while it |
| 81 // animates to the target HIDDEN state. | 85 // animates to the target HIDDEN state. |
| 82 virtual bool IsVisible() const = 0; | 86 virtual bool IsVisible() const = 0; |
| 83 | 87 |
| 88 // Returns a test api to access internals of this. Default implmentations |
| 89 // should return nullptr and test specific subclasses can override to return |
| 90 // an instance. |
| 91 virtual test::InkDropAnimationTestApi* GetTestApi(); |
| 92 |
| 84 protected: | 93 protected: |
| 85 // Animates the ripple from the |old_ink_drop_state| to the | 94 // Animates the ripple from the |old_ink_drop_state| to the |
| 86 // |new_ink_drop_state|. |observer| is added to all LayerAnimationSequence's | 95 // |new_ink_drop_state|. |observer| is added to all LayerAnimationSequence's |
| 87 // used if not null. | 96 // used if not null. |
| 88 virtual void AnimateStateChange(InkDropState old_ink_drop_state, | 97 virtual void AnimateStateChange(InkDropState old_ink_drop_state, |
| 89 InkDropState new_ink_drop_state, | 98 InkDropState new_ink_drop_state, |
| 90 ui::LayerAnimationObserver* observer) = 0; | 99 ui::LayerAnimationObserver* observer) = 0; |
| 91 | 100 |
| 92 // Updates the transforms, opacity, and visibility to a HIDDEN state. | 101 // Updates the transforms, opacity, and visibility to a HIDDEN state. |
| 93 virtual void SetStateToHidden() = 0; | 102 virtual void SetStateToHidden() = 0; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 113 InkDropState target_ink_drop_state_; | 122 InkDropState target_ink_drop_state_; |
| 114 | 123 |
| 115 InkDropAnimationObserver* observer_; | 124 InkDropAnimationObserver* observer_; |
| 116 | 125 |
| 117 DISALLOW_COPY_AND_ASSIGN(InkDropAnimation); | 126 DISALLOW_COPY_AND_ASSIGN(InkDropAnimation); |
| 118 }; | 127 }; |
| 119 | 128 |
| 120 } // namespace views | 129 } // namespace views |
| 121 | 130 |
| 122 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_ | 131 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_H_ |
| OLD | NEW |