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

Side by Side Diff: ui/views/controls/button/custom_button.h

Issue 1661673004: Enables hot-tracking for overflow extension buttons in the app menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restores hot-tracking of extension buttons in app menu with MD (rebase) Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 6 #define UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ui/events/event_constants.h" 10 #include "ui/events/event_constants.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 // Returns true if the event is one that can trigger notifying the listener. 116 // Returns true if the event is one that can trigger notifying the listener.
117 // This implementation returns true if the left mouse button is down. 117 // This implementation returns true if the left mouse button is down.
118 virtual bool IsTriggerableEvent(const ui::Event& event); 118 virtual bool IsTriggerableEvent(const ui::Event& event);
119 119
120 // Returns true if the button should become pressed when the user 120 // Returns true if the button should become pressed when the user
121 // holds the mouse down over the button. For this implementation, 121 // holds the mouse down over the button. For this implementation,
122 // we simply return IsTriggerableEvent(event). 122 // we simply return IsTriggerableEvent(event).
123 virtual bool ShouldEnterPushedState(const ui::Event& event); 123 virtual bool ShouldEnterPushedState(const ui::Event& event);
124 124
125 // Returns true if hover effect should be visible.
126 virtual bool ShouldShowInkDropHover() const;
127
125 void set_has_ink_drop_action_on_click(bool has_ink_drop_action_on_click) { 128 void set_has_ink_drop_action_on_click(bool has_ink_drop_action_on_click) {
126 has_ink_drop_action_on_click_ = has_ink_drop_action_on_click; 129 has_ink_drop_action_on_click_ = has_ink_drop_action_on_click;
127 } 130 }
128 131
129 // Returns true if the button should enter hovered state; that is, if the 132 // Returns true if the button should enter hovered state; that is, if the
130 // mouse is over the button, and no other window has capture (which would 133 // mouse is over the button, and no other window has capture (which would
131 // prevent the button from receiving MouseExited events and updating its 134 // prevent the button from receiving MouseExited events and updating its
132 // state). This does not take into account enabled state. 135 // state). This does not take into account enabled state.
133 bool ShouldEnterHoveredState(); 136 bool ShouldEnterHoveredState();
134 137
135 InkDropDelegate* ink_drop_delegate() const { return ink_drop_delegate_; } 138 InkDropDelegate* ink_drop_delegate() const { return ink_drop_delegate_; }
136 void set_ink_drop_delegate(InkDropDelegate* ink_drop_delegate) { 139 void set_ink_drop_delegate(InkDropDelegate* ink_drop_delegate) {
137 ink_drop_delegate_ = ink_drop_delegate; 140 ink_drop_delegate_ = ink_drop_delegate;
138 } 141 }
139 142
140 // Overridden from View: 143 // Overridden from View:
141 void ViewHierarchyChanged( 144 void ViewHierarchyChanged(
142 const ViewHierarchyChangedDetails& details) override; 145 const ViewHierarchyChangedDetails& details) override;
143 void OnBlur() override; 146 void OnBlur() override;
144 147
145 // Overridden from Button: 148 // Overridden from Button:
146 void NotifyClick(const ui::Event& event) override; 149 void NotifyClick(const ui::Event& event) override;
147 void OnClickCanceled(const ui::Event& event) override; 150 void OnClickCanceled(const ui::Event& event) override;
148 151
149 const gfx::ThrobAnimation& hover_animation() const { 152 const gfx::ThrobAnimation& hover_animation() const {
150 return hover_animation_; 153 return hover_animation_;
151 } 154 }
152 155
153 private: 156 private:
154 bool ShouldShowInkDropHover() const;
155
156 ButtonState state_; 157 ButtonState state_;
157 158
158 gfx::ThrobAnimation hover_animation_; 159 gfx::ThrobAnimation hover_animation_;
159 160
160 // Should we animate when the state changes? Defaults to true. 161 // Should we animate when the state changes? Defaults to true.
161 bool animate_on_state_change_; 162 bool animate_on_state_change_;
162 163
163 // Is the hover animation running because StartThrob was invoked? 164 // Is the hover animation running because StartThrob was invoked?
164 bool is_throbbing_; 165 bool is_throbbing_;
165 166
(...skipping 22 matching lines...) Expand all
188 189
189 // The color of the ripple and hover. 190 // The color of the ripple and hover.
190 SkColor ink_drop_base_color_; 191 SkColor ink_drop_base_color_;
191 192
192 DISALLOW_COPY_AND_ASSIGN(CustomButton); 193 DISALLOW_COPY_AND_ASSIGN(CustomButton);
193 }; 194 };
194 195
195 } // namespace views 196 } // namespace views
196 197
197 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 198 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698