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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/custom_button.h
diff --git a/ui/views/controls/button/custom_button.h b/ui/views/controls/button/custom_button.h
index fa0a215d1007b47ea0078735afccd6b8d0d6bae2..d91d3e68771cd9ec6ec873891541b048ec1437a2 100644
--- a/ui/views/controls/button/custom_button.h
+++ b/ui/views/controls/button/custom_button.h
@@ -105,6 +105,13 @@ class VIEWS_EXPORT CustomButton : public Button, public gfx::AnimationDelegate {
InkDropDelegate* ink_drop_delegate() const { return ink_drop_delegate_; }
+ // Overridden from View:
+ void Layout() override;
+ void ViewHierarchyChanged(
+ const ViewHierarchyChangedDetails& details) override;
+ void OnFocus() override;
+ void OnBlur() override;
+
protected:
// Construct the Button with a Listener. See comment for Button's ctor.
explicit CustomButton(ButtonListener* listener);
@@ -141,10 +148,8 @@ class VIEWS_EXPORT CustomButton : public Button, public gfx::AnimationDelegate {
ink_drop_delegate_ = ink_drop_delegate;
}
- // Overridden from View:
- void ViewHierarchyChanged(
- const ViewHierarchyChangedDetails& details) override;
- void OnBlur() override;
+ // When called, creates and uses |md_focus_ring_| instead of a focus painter.
+ void UseMdFocusRing();
// Overridden from Button:
void NotifyClick(const ui::Event& event) override;
@@ -191,6 +196,11 @@ class VIEWS_EXPORT CustomButton : public Button, public gfx::AnimationDelegate {
// The color of the ripple and hover.
SkColor ink_drop_base_color_;
+ // The MD-style focus ring. This is not done via a FocusPainter
+ // because it needs to paint to a layer so it can extend beyond the bounds of
+ // |this|.
+ views::View* md_focus_ring_;
+
DISALLOW_COPY_AND_ASSIGN(CustomButton);
};
« 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