| 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_ANIMATION_CONTROLLER_IMPL_H_ |
| 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ | 6 #define UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_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_animation_controller.h" |
| 14 #include "ui/views/animation/ink_drop_animation_observer.h" | 14 #include "ui/views/animation/ink_drop_animation_observer.h" |
| 15 #include "ui/views/views_export.h" | 15 #include "ui/views/views_export.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class Timer; | 18 class Timer; |
| 19 } // namespace base | 19 } // namespace base |
| 20 | 20 |
| 21 namespace views { | 21 namespace views { |
| 22 namespace test { |
| 23 class InkDropAnimationControllerImplTestApi; |
| 24 } // namespace test |
| 25 |
| 22 class InkDropAnimation; | 26 class InkDropAnimation; |
| 23 class InkDropHost; | 27 class InkDropHost; |
| 24 class InkDropHover; | 28 class InkDropHover; |
| 25 class InkDropAnimationControllerFactoryTest; | 29 class InkDropAnimationControllerFactoryTest; |
| 26 | 30 |
| 27 // A functional implementation of an InkDropAnimationController. | 31 // A functional implementation of an InkDropAnimationController. |
| 28 class VIEWS_EXPORT InkDropAnimationControllerImpl | 32 class VIEWS_EXPORT InkDropAnimationControllerImpl |
| 29 : public InkDropAnimationController, | 33 : public InkDropAnimationController, |
| 30 public InkDropAnimationObserver { | 34 public InkDropAnimationObserver { |
| 31 public: | 35 public: |
| 32 // Constructs an ink drop controller that will attach the ink drop to the | 36 // Constructs an ink drop controller that will attach the ink drop to the |
| 33 // given |ink_drop_host|. | 37 // given |ink_drop_host|. |
| 34 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); | 38 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); |
| 35 ~InkDropAnimationControllerImpl() override; | 39 ~InkDropAnimationControllerImpl() override; |
| 36 | 40 |
| 37 // InkDropAnimationController: | 41 // InkDropAnimationController: |
| 38 InkDropState GetTargetInkDropState() const override; | 42 InkDropState GetTargetInkDropState() const override; |
| 39 bool IsVisible() const override; | 43 bool IsVisible() const override; |
| 40 void AnimateToState(InkDropState ink_drop_state) override; | 44 void AnimateToState(InkDropState ink_drop_state) override; |
| 41 void SnapToActivated() override; | 45 void SnapToActivated() override; |
| 42 void SetHovered(bool is_hovered) override; | 46 void SetHovered(bool is_hovered) override; |
| 43 | 47 |
| 44 private: | 48 private: |
| 45 friend class InkDropAnimationControllerFactoryTest; | 49 friend class test::InkDropAnimationControllerImplTestApi; |
| 46 friend class InkDropAnimationControllerImplTest; | |
| 47 | 50 |
| 48 // Destroys |ink_drop_animation_| if it's targeted to the HIDDEN state. | 51 // Destroys |ink_drop_animation_| if it's targeted to the HIDDEN state. |
| 49 void DestroyHiddenTargetedAnimations(); | 52 void DestroyHiddenTargetedAnimations(); |
| 50 | 53 |
| 51 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If | 54 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If |
| 52 // |ink_drop_animation_| wasn't null then it will be destroyed using | 55 // |ink_drop_animation_| wasn't null then it will be destroyed using |
| 53 // DestroyInkDropAnimation(). | 56 // DestroyInkDropAnimation(). |
| 54 void CreateInkDropAnimation(); | 57 void CreateInkDropAnimation(); |
| 55 | 58 |
| 56 // Destroys the current |ink_drop_animation_|. | 59 // Destroys the current |ink_drop_animation_|. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 115 |
| 113 // The timer used to delay the hover fade in after an ink drop animation. | 116 // The timer used to delay the hover fade in after an ink drop animation. |
| 114 std::unique_ptr<base::Timer> hover_after_animation_timer_; | 117 std::unique_ptr<base::Timer> hover_after_animation_timer_; |
| 115 | 118 |
| 116 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); | 119 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); |
| 117 }; | 120 }; |
| 118 | 121 |
| 119 } // namespace views | 122 } // namespace views |
| 120 | 123 |
| 121 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ | 124 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ |
| OLD | NEW |