| 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 #ifndef UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ | 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_IMPL_H_ |
| 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ | 6 #define UI_VIEWS_ANIMATION_INK_DROP_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 #include "ui/views/animation/ink_drop_animation_controller.h" | 13 #include "ui/views/animation/ink_drop.h" |
| 14 #include "ui/views/animation/ink_drop_hover_observer.h" | 14 #include "ui/views/animation/ink_drop_hover_observer.h" |
| 15 #include "ui/views/animation/ink_drop_ripple_observer.h" | 15 #include "ui/views/animation/ink_drop_ripple_observer.h" |
| 16 #include "ui/views/views_export.h" | 16 #include "ui/views/views_export.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class Timer; | 19 class Timer; |
| 20 } // namespace base | 20 } // namespace base |
| 21 | 21 |
| 22 namespace views { | 22 namespace views { |
| 23 namespace test { | 23 namespace test { |
| 24 class InkDropAnimationControllerImplTestApi; | 24 class InkDropImplTestApi; |
| 25 } // namespace test | 25 } // namespace test |
| 26 | 26 |
| 27 class InkDropRipple; | 27 class InkDropRipple; |
| 28 class InkDropHost; | 28 class InkDropHost; |
| 29 class InkDropHover; | 29 class InkDropHover; |
| 30 class InkDropAnimationControllerFactoryTest; | 30 class InkDropFactoryTest; |
| 31 | 31 |
| 32 // A functional implementation of an InkDropAnimationController. | 32 // A functional implementation of an InkDrop. |
| 33 class VIEWS_EXPORT InkDropAnimationControllerImpl | 33 class VIEWS_EXPORT InkDropImpl : public InkDrop, |
| 34 : public InkDropAnimationController, | 34 public InkDropRippleObserver, |
| 35 public InkDropRippleObserver, | 35 public InkDropHoverObserver { |
| 36 public InkDropHoverObserver { | |
| 37 public: | 36 public: |
| 38 // Constructs an ink drop controller that will attach the ink drop to the | 37 // Constructs an ink drop that will attach the ink drop to the given |
| 39 // given |ink_drop_host|. | 38 // |ink_drop_host|. |
| 40 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); | 39 explicit InkDropImpl(InkDropHost* ink_drop_host); |
| 41 ~InkDropAnimationControllerImpl() override; | 40 ~InkDropImpl() override; |
| 42 | 41 |
| 43 // InkDropAnimationController: | 42 // InkDrop: |
| 44 InkDropState GetTargetInkDropState() const override; | 43 InkDropState GetTargetInkDropState() const override; |
| 45 bool IsVisible() const override; | 44 bool IsVisible() const override; |
| 46 void AnimateToState(InkDropState ink_drop_state) override; | 45 void AnimateToState(InkDropState ink_drop_state) override; |
| 47 void SnapToActivated() override; | 46 void SnapToActivated() override; |
| 48 void SetHovered(bool is_hovered) override; | 47 void SetHovered(bool is_hovered) override; |
| 49 | 48 |
| 50 private: | 49 private: |
| 51 friend class test::InkDropAnimationControllerImplTestApi; | 50 friend class test::InkDropImplTestApi; |
| 52 | 51 |
| 53 // Destroys |ink_drop_ripple_| if it's targeted to the HIDDEN state. | 52 // Destroys |ink_drop_ripple_| if it's targeted to the HIDDEN state. |
| 54 void DestroyHiddenTargetedAnimations(); | 53 void DestroyHiddenTargetedAnimations(); |
| 55 | 54 |
| 56 // Creates a new InkDropRipple and sets it to |ink_drop_ripple_|. If | 55 // Creates a new InkDropRipple and sets it to |ink_drop_ripple_|. If |
| 57 // |ink_drop_ripple_| wasn't null then it will be destroyed using | 56 // |ink_drop_ripple_| wasn't null then it will be destroyed using |
| 58 // DestroyInkDropRipple(). | 57 // DestroyInkDropRipple(). |
| 59 void CreateInkDropRipple(); | 58 void CreateInkDropRipple(); |
| 60 | 59 |
| 61 // Destroys the current |ink_drop_ripple_|. | 60 // Destroys the current |ink_drop_ripple_|. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // SetHovered() function. | 126 // SetHovered() function. |
| 128 bool is_hovered_; | 127 bool is_hovered_; |
| 129 | 128 |
| 130 // The current InkDropRipple. Created on demand using CreateInkDropRipple(). | 129 // The current InkDropRipple. Created on demand using CreateInkDropRipple(). |
| 131 std::unique_ptr<InkDropRipple> ink_drop_ripple_; | 130 std::unique_ptr<InkDropRipple> ink_drop_ripple_; |
| 132 | 131 |
| 133 // The timer used to delay the hover fade in after an ink drop ripple | 132 // The timer used to delay the hover fade in after an ink drop ripple |
| 134 // animation. | 133 // animation. |
| 135 std::unique_ptr<base::Timer> hover_after_ripple_timer_; | 134 std::unique_ptr<base::Timer> hover_after_ripple_timer_; |
| 136 | 135 |
| 137 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); | 136 DISALLOW_COPY_AND_ASSIGN(InkDropImpl); |
| 138 }; | 137 }; |
| 139 | 138 |
| 140 } // namespace views | 139 } // namespace views |
| 141 | 140 |
| 142 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ | 141 #endif // UI_VIEWS_ANIMATION_INK_DROP_IMPL_H_ |
| OLD | NEW |