Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 | 31 |
| 32 // Overridden from InkDropHost: | 32 // Overridden from InkDropHost: |
| 33 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 33 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 34 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 34 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 35 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; | 35 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; |
| 36 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override; | 36 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override; |
| 37 | 37 |
| 38 void set_ink_drop_size(const gfx::Size& size) { ink_drop_size_ = size; } | 38 void set_ink_drop_size(const gfx::Size& size) { ink_drop_size_ = size; } |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 // Used in SetHasInkDrop() to specify whether the ink drop effect is enabled | |
| 42 // or not for the view. In case of having an ink drop, it also specifies | |
| 43 // whether the default gesture event handler for the ink drop should be | |
| 44 // installed or the subclass will handle gesture events itself. | |
| 45 enum InkDropType { | |
| 46 NO_INK_DROP, | |
| 47 INK_DROP_WITHOUT_GESTURE_HANDLING, | |
| 48 INK_DROP_WITH_GESTURE_HANDLING, | |
| 49 }; | |
| 50 | |
| 41 static const int kInkDropSmallCornerRadius; | 51 static const int kInkDropSmallCornerRadius; |
| 42 | 52 |
| 43 void set_ink_drop_visible_opacity(float visible_opacity) { | 53 void set_ink_drop_visible_opacity(float visible_opacity) { |
| 44 ink_drop_visible_opacity_ = visible_opacity; | 54 ink_drop_visible_opacity_ = visible_opacity; |
| 45 } | 55 } |
| 46 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; } | 56 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; } |
| 47 | 57 |
| 48 // Returns the default InkDropRipple centered on |center_point|. | 58 // Returns the default InkDropRipple centered on |center_point|. |
| 49 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple( | 59 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple( |
| 50 const gfx::Point& center_point) const; | 60 const gfx::Point& center_point) const; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 77 virtual SkColor GetInkDropBaseColor() const; | 87 virtual SkColor GetInkDropBaseColor() const; |
| 78 | 88 |
| 79 // Should return true if the ink drop is also used to depict focus. | 89 // Should return true if the ink drop is also used to depict focus. |
| 80 virtual bool ShouldShowInkDropForFocus() const; | 90 virtual bool ShouldShowInkDropForFocus() const; |
| 81 | 91 |
| 82 InkDrop* ink_drop() { return ink_drop_.get(); } | 92 InkDrop* ink_drop() { return ink_drop_.get(); } |
| 83 | 93 |
| 84 // Toggle to enable/disable an InkDrop on this View. Descendants can override | 94 // Toggle to enable/disable an InkDrop on this View. Descendants can override |
| 85 // CreateInkDropHighlight() and CreateInkDropRipple() to change the look/feel | 95 // CreateInkDropHighlight() and CreateInkDropRipple() to change the look/feel |
| 86 // of the InkDrop. | 96 // of the InkDrop. |
| 87 void SetHasInkDrop(bool has_an_ink_drop); | 97 void SetHasInkDrop(InkDropType ink_drop_type); |
|
sky
2016/06/29 22:58:34
SetHasInkDrop makes sense when the type is boolean
mohsen
2016/06/30 00:03:45
Yeah, I had thought of SetInkDropType(), but that
| |
| 88 | 98 |
| 89 private: | 99 private: |
| 90 class InkDropGestureHandler; | 100 class InkDropGestureHandler; |
| 91 friend class InkDropGestureHandler; | 101 friend class InkDropGestureHandler; |
| 92 friend class test::InkDropHostViewTestApi; | 102 friend class test::InkDropHostViewTestApi; |
| 93 | 103 |
| 94 // The last user Event to trigger an ink drop ripple animation. | 104 // The last user Event to trigger an ink drop ripple animation. |
| 95 std::unique_ptr<ui::LocatedEvent> last_ripple_triggering_event_; | 105 std::unique_ptr<ui::LocatedEvent> last_ripple_triggering_event_; |
| 96 | 106 |
| 97 std::unique_ptr<InkDrop> ink_drop_; | 107 std::unique_ptr<InkDrop> ink_drop_; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 108 // drop layer. | 118 // drop layer. |
| 109 bool old_paint_to_layer_; | 119 bool old_paint_to_layer_; |
| 110 | 120 |
| 111 bool destroying_; | 121 bool destroying_; |
| 112 | 122 |
| 113 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); | 123 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); |
| 114 }; | 124 }; |
| 115 } // namespace views | 125 } // namespace views |
| 116 | 126 |
| 117 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 127 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ |
| OLD | NEW |