| 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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/gfx/geometry/rect.h" | 9 #include "ui/gfx/geometry/rect.h" |
| 10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
| 11 #include "ui/views/animation/ink_drop_animation_controller.h" | 11 #include "ui/views/animation/ink_drop_animation_controller.h" |
| 12 #include "ui/views/animation/ink_drop_animation_observer.h" |
| 12 #include "ui/views/views_export.h" | 13 #include "ui/views/views_export.h" |
| 13 | 14 |
| 14 namespace views { | 15 namespace views { |
| 15 class InkDropAnimation; | 16 class InkDropAnimation; |
| 16 class InkDropHost; | 17 class InkDropHost; |
| 17 | 18 |
| 18 // A functional implementation of an InkDropAnimationController. | 19 // A functional implementation of an InkDropAnimationController. |
| 19 class VIEWS_EXPORT InkDropAnimationControllerImpl | 20 class VIEWS_EXPORT InkDropAnimationControllerImpl |
| 20 : public InkDropAnimationController { | 21 : public InkDropAnimationController, |
| 22 public InkDropAnimationObserver { |
| 21 public: | 23 public: |
| 22 // Constructs an ink drop controller that will attach the ink drop to the | 24 // Constructs an ink drop controller that will attach the ink drop to the |
| 23 // given |ink_drop_host|. | 25 // given |ink_drop_host|. |
| 24 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); | 26 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); |
| 25 ~InkDropAnimationControllerImpl() override; | 27 ~InkDropAnimationControllerImpl() override; |
| 26 | 28 |
| 27 // InkDropAnimationController: | 29 // InkDropAnimationController: |
| 28 InkDropState GetInkDropState() const override; | 30 InkDropState GetInkDropState() const override; |
| 29 void AnimateToState(InkDropState state) override; | 31 void AnimateToState(InkDropState ink_drop_state) override; |
| 30 gfx::Size GetInkDropLargeSize() const override; | 32 gfx::Size GetInkDropLargeSize() const override; |
| 31 void SetInkDropSize(const gfx::Size& large_size, | 33 void SetInkDropSize(const gfx::Size& large_size, |
| 32 int large_corner_radius, | 34 int large_corner_radius, |
| 33 const gfx::Size& small_size, | 35 const gfx::Size& small_size, |
| 34 int small_corner_radius) override; | 36 int small_corner_radius) override; |
| 35 void SetInkDropCenter(const gfx::Point& center_point) override; | 37 void SetInkDropCenter(const gfx::Point& center_point) override; |
| 36 | 38 |
| 37 private: | 39 private: |
| 38 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If | 40 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If |
| 39 // |ink_drop_animation_| wasn't null then it will be removed from the | 41 // |ink_drop_animation_| wasn't null then it will be destroyed using |
| 40 // |ink_drop_host_|. | 42 // DestroyInkDropAnimation(). |
| 41 void CreateInkDropAnimation(); | 43 void CreateInkDropAnimation(); |
| 42 | 44 |
| 45 // Destroys the current |ink_drop_animation_|. |
| 46 void DestroyInkDropAnimation(); |
| 47 |
| 48 // views::InkDropAnimationObserver: |
| 49 void InkDropAnimationStarted(InkDropState ink_drop_state) override; |
| 50 void InkDropAnimationEnded(InkDropState ink_drop_state, |
| 51 InkDropAnimationEndedReason reason) override; |
| 52 |
| 43 // The host of the ink drop. | 53 // The host of the ink drop. |
| 44 InkDropHost* ink_drop_host_; | 54 InkDropHost* ink_drop_host_; |
| 45 | 55 |
| 46 // Cached size for the ink drop's large size animations. | 56 // Cached size for the ink drop's large size animations. |
| 47 gfx::Size ink_drop_large_size_; | 57 gfx::Size ink_drop_large_size_; |
| 48 | 58 |
| 49 // Cached corner radius for the ink drop's large size animations. | 59 // Cached corner radius for the ink drop's large size animations. |
| 50 int ink_drop_large_corner_radius_; | 60 int ink_drop_large_corner_radius_; |
| 51 | 61 |
| 52 // Cached size for the ink drop's small size animations. | 62 // Cached size for the ink drop's small size animations. |
| 53 gfx::Size ink_drop_small_size_; | 63 gfx::Size ink_drop_small_size_; |
| 54 | 64 |
| 55 // Cached corner radius for the ink drop's small size animations. | 65 // Cached corner radius for the ink drop's small size animations. |
| 56 int ink_drop_small_corner_radius_; | 66 int ink_drop_small_corner_radius_; |
| 57 | 67 |
| 58 // Cached center point for the ink drop. | 68 // Cached center point for the ink drop. |
| 59 gfx::Point ink_drop_center_; | 69 gfx::Point ink_drop_center_; |
| 60 | 70 |
| 61 // The current InkDropAnimation. Created on demand using | 71 // The current InkDropAnimation. Created on demand using |
| 62 // CreateInkDropAnimation(). | 72 // CreateInkDropAnimation(). |
| 63 scoped_ptr<InkDropAnimation> ink_drop_animation_; | 73 scoped_ptr<InkDropAnimation> ink_drop_animation_; |
| 64 | 74 |
| 65 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); | 75 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); |
| 66 }; | 76 }; |
| 67 | 77 |
| 68 } // namespace views | 78 } // namespace views |
| 69 | 79 |
| 70 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ | 80 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ |
| OLD | NEW |