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

Unified Diff: ui/views/controls/button/checkbox.cc

Issue 2032683003: Add ripples to md checkboxes/radio buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 | « ui/views/controls/button/checkbox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/checkbox.cc
diff --git a/ui/views/controls/button/checkbox.cc b/ui/views/controls/button/checkbox.cc
index c1db4715f33b532cdc2a7204ff02568972166a93..4feb92f2aa5c8a221e9361c8592c3d30d3258ad7 100644
--- a/ui/views/controls/button/checkbox.cc
+++ b/ui/views/controls/button/checkbox.cc
@@ -15,6 +15,8 @@
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/vector_icons_public.h"
#include "ui/resources/grit/ui_resources.h"
+#include "ui/views/animation/ink_drop_highlight.h"
+#include "ui/views/animation/ink_drop_ripple.h"
#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/painter.h"
#include "ui/views/resources/grit/views_resources.h"
@@ -32,6 +34,10 @@ Checkbox::Checkbox(const base::string16& label)
if (UseMd()) {
set_request_focus_on_press(false);
+ SetInkDropMode(InkDropMode::ON);
+ set_has_ink_drop_action_on_click(true);
+ // The "small" size is 21dp, the large size is 1.33 * 21dp = 28dp.
+ set_ink_drop_size(gfx::Size(21, 21));
} else {
std::unique_ptr<LabelButtonBorder> button_border(new LabelButtonBorder());
// Inset the trailing side by a couple pixels for the focus border.
@@ -152,6 +158,19 @@ void Checkbox::OnNativeThemeChanged(const ui::NativeTheme* theme) {
UpdateImage();
}
+std::unique_ptr<InkDropRipple> Checkbox::CreateInkDropRipple() const {
+ return CreateDefaultInkDropRipple(image()->bounds().CenterPoint());
+}
+
+std::unique_ptr<InkDropHighlight> Checkbox::CreateInkDropHighlight() const {
+ return nullptr;
+}
+
+SkColor Checkbox::GetInkDropBaseColor() const {
+ return GetNativeTheme()->GetSystemColor(
+ ui::NativeTheme::kColorId_UnfocusedBorderColor);
+}
+
gfx::ImageSkia Checkbox::GetImage(ButtonState for_state) const {
if (UseMd()) {
return gfx::CreateVectorIcon(
« no previous file with comments | « ui/views/controls/button/checkbox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698