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

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

Issue 1817253003: [MD] Use same focus ring on BarControlButton as MdTextButton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update docs 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void GetAccessibleState(ui::AXViewState* state) override; 98 void GetAccessibleState(ui::AXViewState* state) override;
99 void VisibilityChanged(View* starting_from, bool is_visible) override; 99 void VisibilityChanged(View* starting_from, bool is_visible) override;
100 scoped_ptr<InkDropHover> CreateInkDropHover() const override; 100 scoped_ptr<InkDropHover> CreateInkDropHover() const override;
101 SkColor GetInkDropBaseColor() const override; 101 SkColor GetInkDropBaseColor() const override;
102 102
103 // Overridden from gfx::AnimationDelegate: 103 // Overridden from gfx::AnimationDelegate:
104 void AnimationProgressed(const gfx::Animation* animation) override; 104 void AnimationProgressed(const gfx::Animation* animation) override;
105 105
106 InkDropDelegate* ink_drop_delegate() const { return ink_drop_delegate_; } 106 InkDropDelegate* ink_drop_delegate() const { return ink_drop_delegate_; }
107 107
108 // Overridden from View:
109 void Layout() override;
110 void ViewHierarchyChanged(
111 const ViewHierarchyChangedDetails& details) override;
112 void OnFocus() override;
113 void OnBlur() override;
114
108 protected: 115 protected:
109 // Construct the Button with a Listener. See comment for Button's ctor. 116 // Construct the Button with a Listener. See comment for Button's ctor.
110 explicit CustomButton(ButtonListener* listener); 117 explicit CustomButton(ButtonListener* listener);
111 118
112 // Invoked from SetState() when SetState() is passed a value that differs from 119 // Invoked from SetState() when SetState() is passed a value that differs from
113 // the current state. CustomButton's implementation of StateChanged() does 120 // the current state. CustomButton's implementation of StateChanged() does
114 // nothing; this method is provided for subclasses that wish to do something 121 // nothing; this method is provided for subclasses that wish to do something
115 // on state changes. 122 // on state changes.
116 virtual void StateChanged(); 123 virtual void StateChanged();
117 124
(...skipping 16 matching lines...) Expand all
134 // Returns true if the button should enter hovered state; that is, if the 141 // Returns true if the button should enter hovered state; that is, if the
135 // mouse is over the button, and no other window has capture (which would 142 // mouse is over the button, and no other window has capture (which would
136 // prevent the button from receiving MouseExited events and updating its 143 // prevent the button from receiving MouseExited events and updating its
137 // state). This does not take into account enabled state. 144 // state). This does not take into account enabled state.
138 bool ShouldEnterHoveredState(); 145 bool ShouldEnterHoveredState();
139 146
140 void set_ink_drop_delegate(InkDropDelegate* ink_drop_delegate) { 147 void set_ink_drop_delegate(InkDropDelegate* ink_drop_delegate) {
141 ink_drop_delegate_ = ink_drop_delegate; 148 ink_drop_delegate_ = ink_drop_delegate;
142 } 149 }
143 150
144 // Overridden from View: 151 // When called, creates and uses |md_focus_ring_| instead of a focus painter.
145 void ViewHierarchyChanged( 152 void UseMdFocusRing();
146 const ViewHierarchyChangedDetails& details) override;
147 void OnBlur() override;
148 153
149 // Overridden from Button: 154 // Overridden from Button:
150 void NotifyClick(const ui::Event& event) override; 155 void NotifyClick(const ui::Event& event) override;
151 void OnClickCanceled(const ui::Event& event) override; 156 void OnClickCanceled(const ui::Event& event) override;
152 157
153 const gfx::ThrobAnimation& hover_animation() const { 158 const gfx::ThrobAnimation& hover_animation() const {
154 return hover_animation_; 159 return hover_animation_;
155 } 160 }
156 161
157 private: 162 private:
(...skipping 26 matching lines...) Expand all
184 // TODO(bruthig): Use an InkDropAction enum and drop the flag. 189 // TODO(bruthig): Use an InkDropAction enum and drop the flag.
185 bool has_ink_drop_action_on_click_; 190 bool has_ink_drop_action_on_click_;
186 191
187 // The animation action to trigger on the |ink_drop_delegate_| when the button 192 // The animation action to trigger on the |ink_drop_delegate_| when the button
188 // is clicked. 193 // is clicked.
189 InkDropState ink_drop_action_on_click_; 194 InkDropState ink_drop_action_on_click_;
190 195
191 // The color of the ripple and hover. 196 // The color of the ripple and hover.
192 SkColor ink_drop_base_color_; 197 SkColor ink_drop_base_color_;
193 198
199 // The MD-style focus ring. This is not done via a FocusPainter
200 // because it needs to paint to a layer so it can extend beyond the bounds of
201 // |this|.
202 views::View* md_focus_ring_;
203
194 DISALLOW_COPY_AND_ASSIGN(CustomButton); 204 DISALLOW_COPY_AND_ASSIGN(CustomButton);
195 }; 205 };
196 206
197 } // namespace views 207 } // namespace views
198 208
199 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 209 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/infobar_view.cc ('k') | ui/views/controls/button/custom_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698