| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 55 |
| 56 void set_ink_drop_visible_opacity(float visible_opacity) { |
| 57 ink_drop_visible_opacity_ = visible_opacity; |
| 58 } |
| 59 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; } |
| 60 |
| 56 protected: | 61 protected: |
| 57 static constexpr int kInkDropSmallCornerRadius = 2; | 62 static constexpr int kInkDropSmallCornerRadius = 2; |
| 58 static constexpr int kInkDropLargeCornerRadius = 4; | 63 static constexpr int kInkDropLargeCornerRadius = 4; |
| 59 | 64 |
| 60 // Size used for the default SquareInkDropRipple. | 65 // Size used for the default SquareInkDropRipple. |
| 61 static constexpr int kDefaultInkDropSize = 24; | 66 static constexpr int kDefaultInkDropSize = 24; |
| 62 | 67 |
| 63 // 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 |
| 64 // with the SquareInkDropRipple animation durations. | 69 // with the SquareInkDropRipple animation durations. |
| 65 static gfx::Size CalculateLargeInkDropSize(const gfx::Size& small_size); | 70 static gfx::Size CalculateLargeInkDropSize(const gfx::Size& small_size); |
| 66 | 71 |
| 67 void set_ink_drop_visible_opacity(float visible_opacity) { | |
| 68 ink_drop_visible_opacity_ = visible_opacity; | |
| 69 } | |
| 70 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; } | |
| 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, |
| 75 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, | 75 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, |
| 76 kDefaultInkDropSize)) const; | 76 kDefaultInkDropSize)) const; |
| 77 | 77 |
| 78 // Returns the default InkDropHighlight centered on |center_point|. | 78 // Returns the default InkDropHighlight centered on |center_point|. |
| 79 std::unique_ptr<InkDropHighlight> CreateDefaultInkDropHighlight( | 79 std::unique_ptr<InkDropHighlight> CreateDefaultInkDropHighlight( |
| 80 const gfx::PointF& center_point, | 80 const gfx::PointF& center_point, |
| 81 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, | 81 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 bool destroying_; | 151 bool destroying_; |
| 152 | 152 |
| 153 std::unique_ptr<views::InkDropMask> ink_drop_mask_; | 153 std::unique_ptr<views::InkDropMask> ink_drop_mask_; |
| 154 | 154 |
| 155 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); | 155 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); |
| 156 }; | 156 }; |
| 157 } // namespace views | 157 } // namespace views |
| 158 | 158 |
| 159 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 159 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ |
| OLD | NEW |