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 enum InkDropType { | |
| 42 NO_INK_DROP, | |
| 43 INK_DROP_WITHOUT_GESTURE_HANDLING, | |
|
James Cook
2016/06/27 22:47:28
I like this much better. Can you add a brief comme
mohsen
2016/06/29 21:41:37
Done.
| |
| 44 INK_DROP_WITH_GESTURE_HANDLING, | |
| 45 }; | |
| 46 | |
| 41 static const int kInkDropSmallCornerRadius; | 47 static const int kInkDropSmallCornerRadius; |
| 42 | 48 |
| 43 void set_ink_drop_visible_opacity(float visible_opacity) { | 49 void set_ink_drop_visible_opacity(float visible_opacity) { |
| 44 ink_drop_visible_opacity_ = visible_opacity; | 50 ink_drop_visible_opacity_ = visible_opacity; |
| 45 } | 51 } |
| 46 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; } | 52 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; } |
| 47 | 53 |
| 48 // Returns the default InkDropRipple centered on |center_point|. | 54 // Returns the default InkDropRipple centered on |center_point|. |
| 49 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple( | 55 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple( |
| 50 const gfx::Point& center_point) const; | 56 const gfx::Point& center_point) const; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 77 virtual SkColor GetInkDropBaseColor() const; | 83 virtual SkColor GetInkDropBaseColor() const; |
| 78 | 84 |
| 79 // Should return true if the ink drop is also used to depict focus. | 85 // Should return true if the ink drop is also used to depict focus. |
| 80 virtual bool ShouldShowInkDropForFocus() const; | 86 virtual bool ShouldShowInkDropForFocus() const; |
| 81 | 87 |
| 82 InkDrop* ink_drop() { return ink_drop_.get(); } | 88 InkDrop* ink_drop() { return ink_drop_.get(); } |
| 83 | 89 |
| 84 // Toggle to enable/disable an InkDrop on this View. Descendants can override | 90 // Toggle to enable/disable an InkDrop on this View. Descendants can override |
| 85 // CreateInkDropHighlight() and CreateInkDropRipple() to change the look/feel | 91 // CreateInkDropHighlight() and CreateInkDropRipple() to change the look/feel |
| 86 // of the InkDrop. | 92 // of the InkDrop. |
| 87 void SetHasInkDrop(bool has_an_ink_drop); | 93 void SetHasInkDrop(InkDropType ink_drop_type); |
| 88 | 94 |
| 89 private: | 95 private: |
| 90 class InkDropGestureHandler; | 96 class InkDropGestureHandler; |
| 91 friend class InkDropGestureHandler; | 97 friend class InkDropGestureHandler; |
| 92 friend class test::InkDropHostViewTestApi; | 98 friend class test::InkDropHostViewTestApi; |
| 93 | 99 |
| 94 // The last user Event to trigger an ink drop ripple animation. | 100 // The last user Event to trigger an ink drop ripple animation. |
| 95 std::unique_ptr<ui::LocatedEvent> last_ripple_triggering_event_; | 101 std::unique_ptr<ui::LocatedEvent> last_ripple_triggering_event_; |
| 96 | 102 |
| 97 std::unique_ptr<InkDrop> ink_drop_; | 103 std::unique_ptr<InkDrop> ink_drop_; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 108 // drop layer. | 114 // drop layer. |
| 109 bool old_paint_to_layer_; | 115 bool old_paint_to_layer_; |
| 110 | 116 |
| 111 bool destroying_; | 117 bool destroying_; |
| 112 | 118 |
| 113 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); | 119 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); |
| 114 }; | 120 }; |
| 115 } // namespace views | 121 } // namespace views |
| 116 | 122 |
| 117 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ | 123 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ |
| OLD | NEW |