| 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/views_export.h" | 12 #include "ui/views/views_export.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 class InkDropAnimation; | 15 class InkDropAnimation; |
| 16 class InkDropHost; | 16 class InkDropHost; |
| 17 | 17 |
| 18 // Controls an ink drop animation which is hosted by an InkDropHost. | 18 // Controls an ink drop animation which is hosted by an InkDropHost. |
| 19 // TODO(bruthig): Document me better. |
| 19 class VIEWS_EXPORT InkDropAnimationControllerImpl | 20 class VIEWS_EXPORT InkDropAnimationControllerImpl |
| 20 : public InkDropAnimationController { | 21 : public InkDropAnimationController { |
| 21 public: | 22 public: |
| 22 // Constructs an ink drop controller that will attach the ink drop to the | 23 // Constructs an ink drop controller that will attach the ink drop to the |
| 23 // given |ink_drop_host|. | 24 // given |ink_drop_host|. |
| 24 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); | 25 explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host); |
| 25 ~InkDropAnimationControllerImpl() override; | 26 ~InkDropAnimationControllerImpl() override; |
| 26 | 27 |
| 27 // InkDropAnimationController: | 28 // InkDropAnimationController: |
| 29 InkDropState GetInkDropState() const override; |
| 28 void AnimateToState(InkDropState state) override; | 30 void AnimateToState(InkDropState state) override; |
| 29 void SetInkDropSize(const gfx::Size& size) override; | 31 gfx::Size GetInkDropLargeSize() const override; |
| 30 gfx::Rect GetInkDropBounds() const override; | 32 void SetInkDropSize(const gfx::Size& large_size, |
| 31 void SetInkDropBounds(const gfx::Rect& bounds) override; | 33 int large_corner_radius, |
| 34 const gfx::Size& small_size, |
| 35 int small_corner_radius) override; |
| 36 gfx::Point GetInkDropOrigin() const override; |
| 37 void SetInkDropOrigin(const gfx::Point& origin) override; |
| 32 | 38 |
| 33 private: | 39 private: |
| 40 // Creates a new InkDropAnimation and sets it to |ink_drop_animation_|. If |
| 41 // |ink_drop_animation_| wasn't null then it will be removed from the |
| 42 // |ink_drop_host_|. |
| 43 void CreateInkDropAnimation(); |
| 44 |
| 34 // The host of the ink drop. | 45 // The host of the ink drop. |
| 35 InkDropHost* ink_drop_host_; | 46 InkDropHost* ink_drop_host_; |
| 36 | 47 |
| 37 // TODO(bruthig): It will be expensive to maintain InkDropAnimation instances | 48 // Cached size for the ink drop's large size animations. |
| 38 // when they are not actually being used. Consider creating InkDropAnimations | 49 gfx::Size ink_drop_large_size_; |
| 39 // on an as-needed basis and if construction is also expensive then consider | 50 |
| 40 // creating an InkDropAnimationPool. See www.crbug.com/522175. | 51 // Cached corner radius for the ink drop's large size animations. |
| 52 int ink_drop_large_corner_radius_; |
| 53 |
| 54 // Cached size for the ink drop's small size animations. |
| 55 gfx::Size ink_drop_small_size_; |
| 56 |
| 57 // Cached corner radius for the ink drop's small size animations. |
| 58 int ink_drop_small_corner_radius_; |
| 59 |
| 60 // Cached origin for the ink drop. |
| 61 gfx::Point ink_drop_origin_; |
| 62 |
| 63 // The current InkDropAnimation. Created on demand using |
| 64 // CreateInkDropAnimation(). |
| 41 scoped_ptr<InkDropAnimation> ink_drop_animation_; | 65 scoped_ptr<InkDropAnimation> ink_drop_animation_; |
| 42 | 66 |
| 43 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); | 67 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl); |
| 44 }; | 68 }; |
| 45 | 69 |
| 46 } // namespace views | 70 } // namespace views |
| 47 | 71 |
| 48 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ | 72 #endif // UI_VIEWS_ANIMATION_INK_DROP_ANIMATION_CONTROLLER_IMPL_H_ |
| OLD | NEW |