| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // Returns a large ink drop size based on the |small_size| that works well | 77 // Returns a large ink drop size based on the |small_size| that works well |
| 78 // with the SquareInkDropRipple animation durations. | 78 // with the SquareInkDropRipple animation durations. |
| 79 static gfx::Size CalculateLargeInkDropSize(const gfx::Size& small_size); | 79 static gfx::Size CalculateLargeInkDropSize(const gfx::Size& small_size); |
| 80 | 80 |
| 81 // Returns the default InkDropRipple centered on |center_point|. | 81 // Returns the default InkDropRipple centered on |center_point|. |
| 82 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple( | 82 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple( |
| 83 const gfx::Point& center_point, | 83 const gfx::Point& center_point, |
| 84 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, | 84 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, |
| 85 kDefaultInkDropSize)) const; | 85 kDefaultInkDropSize)) const; |
| 86 | 86 |
| 87 // Returns a FloodFill InkDropRipple centered on the last event. |
| 88 std::unique_ptr<InkDropRipple> CreateFloodFillInkDropRipple() const; |
| 89 |
| 87 // Returns the default InkDropHighlight centered on |center_point|. | 90 // Returns the default InkDropHighlight centered on |center_point|. |
| 88 std::unique_ptr<InkDropHighlight> CreateDefaultInkDropHighlight( | 91 std::unique_ptr<InkDropHighlight> CreateDefaultInkDropHighlight( |
| 89 const gfx::PointF& center_point, | 92 const gfx::PointF& center_point, |
| 90 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, | 93 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, |
| 91 kDefaultInkDropSize)) const; | 94 kDefaultInkDropSize)) const; |
| 92 | 95 |
| 93 // Returns the point of the |last_ripple_triggering_event_| if it was a | 96 // Returns the point of the |last_ripple_triggering_event_| if it was a |
| 94 // LocatedEvent, otherwise the center point of the local bounds is returned. | 97 // LocatedEvent, otherwise the center point of the local bounds is returned. |
| 95 gfx::Point GetInkDropCenterBasedOnLastEvent() const; | 98 gfx::Point GetInkDropCenterBasedOnLastEvent() const; |
| 96 | 99 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 121 // |ink_drop_| so as to avoid virtual method calls during construction since | 124 // |ink_drop_| so as to avoid virtual method calls during construction since |
| 122 // subclasses should be able to call SetInkDropMode() during construction. | 125 // subclasses should be able to call SetInkDropMode() during construction. |
| 123 InkDrop* GetInkDrop(); | 126 InkDrop* GetInkDrop(); |
| 124 | 127 |
| 125 // Initializes and sets a mask on |ink_drop_layer|. No-op if | 128 // Initializes and sets a mask on |ink_drop_layer|. No-op if |
| 126 // CreateInkDropMask() returns null. | 129 // CreateInkDropMask() returns null. |
| 127 void InstallInkDropMask(ui::Layer* ink_drop_layer); | 130 void InstallInkDropMask(ui::Layer* ink_drop_layer); |
| 128 | 131 |
| 129 void ResetInkDropMask(); | 132 void ResetInkDropMask(); |
| 130 | 133 |
| 134 // Returns an InkDropImpl with default configuration. The base implementation |
| 135 // of CreateInkDrop() delegates to this function. |
| 136 std::unique_ptr<InkDropImpl> CreateDefaultInkDropImpl(); |
| 137 |
| 131 // Returns an InkDropImpl configured to work well with a | 138 // Returns an InkDropImpl configured to work well with a |
| 132 // flood-fill ink drop ripple. | 139 // flood-fill ink drop ripple. |
| 133 std::unique_ptr<InkDropImpl> CreateDefaultFloodFillInkDropImpl(); | 140 std::unique_ptr<InkDropImpl> CreateDefaultFloodFillInkDropImpl(); |
| 134 | 141 |
| 135 // Returns an InkDropImpl with default configuration. The base implementation | 142 // Returns the color to use for ink drops. Ripples once derived their color |
| 136 // of CreateInkDrop() delegates to this function. | 143 // from the text color via GetInkDropBaseColor(). Latest specs just say |
| 137 std::unique_ptr<InkDropImpl> CreateDefaultInkDropImpl(); | 144 // ripples should be black. This method chooses which to use. |
| 145 // TODO(tapted): Make GetInkDropBaseColor() private so that it can only be |
| 146 // overridden, and not invoked externally. |
| 147 SkColor GetInkDropBaseColorImpl() const; |
| 138 | 148 |
| 139 private: | 149 private: |
| 140 class InkDropGestureHandler; | 150 class InkDropGestureHandler; |
| 141 friend class InkDropGestureHandler; | 151 friend class InkDropGestureHandler; |
| 142 friend class test::InkDropHostViewTestApi; | 152 friend class test::InkDropHostViewTestApi; |
| 143 | 153 |
| 144 // The last user Event to trigger an ink drop ripple animation. | 154 // The last user Event to trigger an ink drop ripple animation. |
| 145 std::unique_ptr<ui::LocatedEvent> last_ripple_triggering_event_; | 155 std::unique_ptr<ui::LocatedEvent> last_ripple_triggering_event_; |
| 146 | 156 |
| 147 // Defines what type of |ink_drop_| to create. | 157 // Defines what type of |ink_drop_| to create. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 162 | 172 |
| 163 bool destroying_; | 173 bool destroying_; |
| 164 | 174 |
| 165 std::unique_ptr<views::InkDropMask> ink_drop_mask_; | 175 std::unique_ptr<views::InkDropMask> ink_drop_mask_; |
| 166 | 176 |
| 167 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); | 177 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); |
| 168 }; | 178 }; |
| 169 } // namespace views | 179 } // namespace views |
| 170 | 180 |
| 171 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 181 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ |
| OLD | NEW |