| 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_HOST_VIEW_H_ | 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ |
| 6 #define UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 6 #define UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 // Size used for the default SquareInkDropRipple. | 65 // Size used for the default SquareInkDropRipple. |
| 66 static constexpr int kDefaultInkDropSize = 24; | 66 static constexpr int kDefaultInkDropSize = 24; |
| 67 | 67 |
| 68 // Returns a large ink drop size based on the |small_size| that works well | 68 // Returns a large ink drop size based on the |small_size| that works well |
| 69 // with the SquareInkDropRipple animation durations. | 69 // with the SquareInkDropRipple animation durations. |
| 70 static gfx::Size CalculateLargeInkDropSize(const gfx::Size& small_size); | 70 static gfx::Size CalculateLargeInkDropSize(const gfx::Size& small_size); |
| 71 | 71 |
| 72 // Returns the default InkDropRipple centered on |center_point|. | 72 // Returns the default InkDropRipple centered on |center_point|. |
| 73 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple( | 73 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple( |
| 74 const gfx::Point& center_point, | 74 const gfx::Point& center_point) const; |
| 75 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, | |
| 76 kDefaultInkDropSize)) const; | |
| 77 | 75 |
| 78 // Returns the default InkDropHighlight centered on |center_point|. | 76 // Returns the default InkDropHighlight centered on |center_point|. |
| 79 std::unique_ptr<InkDropHighlight> CreateDefaultInkDropHighlight( | 77 std::unique_ptr<InkDropHighlight> CreateDefaultInkDropHighlight( |
| 80 const gfx::PointF& center_point, | 78 const gfx::PointF& center_point) const; |
| 81 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, | |
| 82 kDefaultInkDropSize)) const; | |
| 83 | 79 |
| 84 // Returns the point of the |last_ripple_triggering_event_| if it was a | 80 // Returns the point of the |last_ripple_triggering_event_| if it was a |
| 85 // LocatedEvent, otherwise the center point of the local bounds is returned. | 81 // LocatedEvent, otherwise the center point of the local bounds is returned. |
| 86 gfx::Point GetInkDropCenterBasedOnLastEvent() const; | 82 gfx::Point GetInkDropCenterBasedOnLastEvent() const; |
| 87 | 83 |
| 88 // Animates |ink_drop_| to the desired |ink_drop_state|. Caches |event| as the | 84 // Animates |ink_drop_| to the desired |ink_drop_state|. Caches |event| as the |
| 89 // last_ripple_triggering_event(). | 85 // last_ripple_triggering_event(). |
| 90 // | 86 // |
| 91 // *** NOTE ***: |event| has been plumbed through on a best effort basis for | 87 // *** NOTE ***: |event| has been plumbed through on a best effort basis for |
| 92 // the purposes of centering ink drop ripples on located Events. Thus nullptr | 88 // the purposes of centering ink drop ripples on located Events. Thus nullptr |
| (...skipping 22 matching lines...) Expand all Loading... |
| 115 InkDrop* GetInkDrop(); | 111 InkDrop* GetInkDrop(); |
| 116 | 112 |
| 117 // Returns an InkDropImpl configured to work well with a | 113 // Returns an InkDropImpl configured to work well with a |
| 118 // flood-fill ink drop ripple. | 114 // flood-fill ink drop ripple. |
| 119 std::unique_ptr<InkDropImpl> CreateDefaultFloodFillInkDropImpl(); | 115 std::unique_ptr<InkDropImpl> CreateDefaultFloodFillInkDropImpl(); |
| 120 | 116 |
| 121 // Returns an InkDropImpl with default configuration. The base implementation | 117 // Returns an InkDropImpl with default configuration. The base implementation |
| 122 // of CreateInkDrop() delegates to this function. | 118 // of CreateInkDrop() delegates to this function. |
| 123 std::unique_ptr<InkDropImpl> CreateDefaultInkDropImpl(); | 119 std::unique_ptr<InkDropImpl> CreateDefaultInkDropImpl(); |
| 124 | 120 |
| 121 gfx::Size GetInkDropSize() const; |
| 122 |
| 125 InkDropMode ink_drop_mode() const { return ink_drop_mode_; } | 123 InkDropMode ink_drop_mode() const { return ink_drop_mode_; } |
| 126 | 124 |
| 127 private: | 125 private: |
| 128 class InkDropGestureHandler; | 126 class InkDropGestureHandler; |
| 129 friend class InkDropGestureHandler; | 127 friend class InkDropGestureHandler; |
| 130 friend class test::InkDropHostViewTestApi; | 128 friend class test::InkDropHostViewTestApi; |
| 131 | 129 |
| 132 // The last user Event to trigger an ink drop ripple animation. | 130 // The last user Event to trigger an ink drop ripple animation. |
| 133 std::unique_ptr<ui::LocatedEvent> last_ripple_triggering_event_; | 131 std::unique_ptr<ui::LocatedEvent> last_ripple_triggering_event_; |
| 134 | 132 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 150 | 148 |
| 151 bool destroying_; | 149 bool destroying_; |
| 152 | 150 |
| 153 std::unique_ptr<views::InkDropMask> ink_drop_mask_; | 151 std::unique_ptr<views::InkDropMask> ink_drop_mask_; |
| 154 | 152 |
| 155 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); | 153 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); |
| 156 }; | 154 }; |
| 157 } // namespace views | 155 } // namespace views |
| 158 | 156 |
| 159 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 157 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ |
| OLD | NEW |