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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; | 45 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; |
46 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override; | 46 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override; |
47 | 47 |
48 // Toggle to enable/disable an InkDrop on this View. Descendants can override | 48 // Toggle to enable/disable an InkDrop on this View. Descendants can override |
49 // CreateInkDropHighlight() and CreateInkDropRipple() to change the look/feel | 49 // CreateInkDropHighlight() and CreateInkDropRipple() to change the look/feel |
50 // of the InkDrop. | 50 // of the InkDrop. |
51 // | 51 // |
52 // TODO(bruthig): Add an easier mechanism than overriding functions to allow | 52 // TODO(bruthig): Add an easier mechanism than overriding functions to allow |
53 // subclasses/clients to specify the flavor of ink drop. | 53 // subclasses/clients to specify the flavor of ink drop. |
54 void SetInkDropMode(InkDropMode ink_drop_mode); | 54 void SetInkDropMode(InkDropMode ink_drop_mode); |
| 55 InkDropMode ink_drop_mode() const { return ink_drop_mode_; } |
55 | 56 |
56 void set_ink_drop_visible_opacity(float visible_opacity) { | 57 void set_ink_drop_visible_opacity(float visible_opacity) { |
57 ink_drop_visible_opacity_ = visible_opacity; | 58 ink_drop_visible_opacity_ = visible_opacity; |
58 } | 59 } |
59 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; } | 60 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; } |
60 | 61 |
61 // Animates |ink_drop_| to the desired |ink_drop_state|. Caches |event| as the | 62 // Animates |ink_drop_| to the desired |ink_drop_state|. Caches |event| as the |
62 // last_ripple_triggering_event(). | 63 // last_ripple_triggering_event(). |
63 // | 64 // |
64 // *** NOTE ***: |event| has been plumbed through on a best effort basis for | 65 // *** NOTE ***: |event| has been plumbed through on a best effort basis for |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 108 |
108 // Subclasses can override to return a mask for the ink drop. By default, | 109 // Subclasses can override to return a mask for the ink drop. By default, |
109 // returns nullptr (i.e no mask). | 110 // returns nullptr (i.e no mask). |
110 virtual std::unique_ptr<views::InkDropMask> CreateInkDropMask() const; | 111 virtual std::unique_ptr<views::InkDropMask> CreateInkDropMask() const; |
111 | 112 |
112 // Provides access to |ink_drop_|. Implements lazy initialization of | 113 // Provides access to |ink_drop_|. Implements lazy initialization of |
113 // |ink_drop_| so as to avoid virtual method calls during construction since | 114 // |ink_drop_| so as to avoid virtual method calls during construction since |
114 // subclasses should be able to call SetInkDropMode() during construction. | 115 // subclasses should be able to call SetInkDropMode() during construction. |
115 InkDrop* GetInkDrop(); | 116 InkDrop* GetInkDrop(); |
116 | 117 |
| 118 // Initializes and sets a mask on |ink_drop_layer|. No-op if |
| 119 // CreateInkDropMask() returns null. |
| 120 void InstallInkDropMask(ui::Layer* ink_drop_layer); |
| 121 |
| 122 void ResetInkDropMask(); |
| 123 |
117 // Returns an InkDropImpl configured to work well with a | 124 // Returns an InkDropImpl configured to work well with a |
118 // flood-fill ink drop ripple. | 125 // flood-fill ink drop ripple. |
119 std::unique_ptr<InkDropImpl> CreateDefaultFloodFillInkDropImpl(); | 126 std::unique_ptr<InkDropImpl> CreateDefaultFloodFillInkDropImpl(); |
120 | 127 |
121 // Returns an InkDropImpl with default configuration. The base implementation | 128 // Returns an InkDropImpl with default configuration. The base implementation |
122 // of CreateInkDrop() delegates to this function. | 129 // of CreateInkDrop() delegates to this function. |
123 std::unique_ptr<InkDropImpl> CreateDefaultInkDropImpl(); | 130 std::unique_ptr<InkDropImpl> CreateDefaultInkDropImpl(); |
124 | 131 |
125 private: | 132 private: |
126 class InkDropGestureHandler; | 133 class InkDropGestureHandler; |
(...skipping 21 matching lines...) Expand all Loading... |
148 | 155 |
149 bool destroying_; | 156 bool destroying_; |
150 | 157 |
151 std::unique_ptr<views::InkDropMask> ink_drop_mask_; | 158 std::unique_ptr<views::InkDropMask> ink_drop_mask_; |
152 | 159 |
153 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); | 160 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); |
154 }; | 161 }; |
155 } // namespace views | 162 } // namespace views |
156 | 163 |
157 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 164 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ |
OLD | NEW |