Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: ui/views/animation/ink_drop_host_view.h

Issue 2289403002: Making SetInkDropMode public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing unit test v2.0 Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/animation/ink_drop_host_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 ~InkDropHostView() override; 30 ~InkDropHostView() override;
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:
41 // Used in SetInkDropMode() to specify whether the ink drop effect is enabled 40 // Used in SetInkDropMode() 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 41 // 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 42 // whether the default gesture event handler for the ink drop should be
44 // installed or the subclass will handle gesture events itself. 43 // installed or the subclass will handle gesture events itself.
45 enum class InkDropMode { 44 enum class InkDropMode {
46 OFF, 45 OFF,
47 ON, 46 ON,
48 ON_NO_GESTURE_HANDLER, 47 ON_NO_GESTURE_HANDLER,
49 }; 48 };
49 // Toggle to enable/disable an InkDrop on this View. Descendants can override
50 // CreateInkDropHighlight() and CreateInkDropRipple() to change thelook/feel
51 // of the InkDrop.
52 void SetInkDropMode(InkDropMode ink_drop_mode);
50 53
54 protected:
51 static const int kInkDropSmallCornerRadius; 55 static const int kInkDropSmallCornerRadius;
52 56
53 void set_ink_drop_visible_opacity(float visible_opacity) { 57 void set_ink_drop_visible_opacity(float visible_opacity) {
54 ink_drop_visible_opacity_ = visible_opacity; 58 ink_drop_visible_opacity_ = visible_opacity;
55 } 59 }
56 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; } 60 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; }
57 61
58 // Returns the default InkDropRipple centered on |center_point|. 62 // Returns the default InkDropRipple centered on |center_point|.
59 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple( 63 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple(
60 const gfx::Point& center_point) const; 64 const gfx::Point& center_point) const;
(...skipping 23 matching lines...) Expand all
84 88
85 // Overrideable methods to allow views to provide minor tweaks to the default 89 // Overrideable methods to allow views to provide minor tweaks to the default
86 // ink drop. 90 // ink drop.
87 virtual SkColor GetInkDropBaseColor() const; 91 virtual SkColor GetInkDropBaseColor() const;
88 92
89 // Should return true if the ink drop is also used to depict focus. 93 // Should return true if the ink drop is also used to depict focus.
90 virtual bool ShouldShowInkDropForFocus() const; 94 virtual bool ShouldShowInkDropForFocus() const;
91 95
92 InkDrop* ink_drop() { return ink_drop_.get(); } 96 InkDrop* ink_drop() { return ink_drop_.get(); }
93 97
94 // Toggle to enable/disable an InkDrop on this View. Descendants can override
95 // CreateInkDropHighlight() and CreateInkDropRipple() to change the look/feel
96 // of the InkDrop.
97 void SetInkDropMode(InkDropMode ink_drop_mode);
98
99 private: 98 private:
100 class InkDropGestureHandler; 99 class InkDropGestureHandler;
101 friend class InkDropGestureHandler; 100 friend class InkDropGestureHandler;
102 friend class test::InkDropHostViewTestApi; 101 friend class test::InkDropHostViewTestApi;
103 102
104 // The last user Event to trigger an ink drop ripple animation. 103 // The last user Event to trigger an ink drop ripple animation.
105 std::unique_ptr<ui::LocatedEvent> last_ripple_triggering_event_; 104 std::unique_ptr<ui::LocatedEvent> last_ripple_triggering_event_;
106 105
107 std::unique_ptr<InkDrop> ink_drop_; 106 std::unique_ptr<InkDrop> ink_drop_;
108 107
109 // Intentionally declared after |ink_drop_| so that it doesn't access a 108 // Intentionally declared after |ink_drop_| so that it doesn't access a
110 // destroyed |ink_drop_| during destruction. 109 // destroyed |ink_drop_| during destruction.
111 std::unique_ptr<InkDropGestureHandler> gesture_handler_; 110 std::unique_ptr<InkDropGestureHandler> gesture_handler_;
112 111
113 gfx::Size ink_drop_size_; 112 gfx::Size ink_drop_size_;
114 113
115 float ink_drop_visible_opacity_; 114 float ink_drop_visible_opacity_;
116 115
117 // Determines whether the view was already painting to layer before adding ink 116 // Determines whether the view was already painting to layer before adding ink
118 // drop layer. 117 // drop layer.
119 bool old_paint_to_layer_; 118 bool old_paint_to_layer_;
120 119
121 bool destroying_; 120 bool destroying_;
122 121
123 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); 122 DISALLOW_COPY_AND_ASSIGN(InkDropHostView);
124 }; 123 };
125 } // namespace views 124 } // namespace views
126 125
127 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ 126 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/animation/ink_drop_host_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698