Chromium Code Reviews| 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..06570d89fb49f15633a32a44ee4ab6a41bb30136 100644 |
| --- a/ui/views/controls/button/checkbox.cc |
| +++ b/ui/views/controls/button/checkbox.cc |
| @@ -15,6 +15,9 @@ |
| #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/button_ink_drop_delegate.h" |
| +#include "ui/views/animation/ink_drop_hover.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 +35,11 @@ Checkbox::Checkbox(const base::string16& label) |
| if (UseMd()) { |
| set_request_focus_on_press(false); |
| + set_ink_drop_delegate( |
| + base::WrapUnique(new ButtonInkDropDelegate(this, this))); |
| + 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 +160,24 @@ void Checkbox::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
| UpdateImage(); |
| } |
| +std::unique_ptr<InkDropRipple> Checkbox::CreateInkDropRipple() const { |
| + // Skip over the LabelButton override. |
| + return InkDropHostView::CreateInkDropRipple(); |
| +} |
| + |
| +std::unique_ptr<InkDropHover> Checkbox::CreateInkDropHover() const { |
| + return nullptr; |
| +} |
| + |
| +gfx::Point Checkbox::GetInkDropCenter() const { |
| + return image()->bounds().CenterPoint(); |
| +} |
| + |
| +SkColor Checkbox::GetInkDropBaseColor() const { |
| + return GetNativeTheme()->GetSystemColor( |
| + ui::NativeTheme::kColorId_UnfocusedBorderColor); |
|
sky
2016/06/02 03:13:30
This seems like a weird choice for a base color. I
Evan Stade
2016/06/02 19:40:18
How so? It's the color of the checkbox square/radi
sky
2016/06/02 21:47:59
I didn't realize we use 'unfocused border color' i
|
| +} |
| + |
| gfx::ImageSkia Checkbox::GetImage(ButtonState for_state) const { |
| if (UseMd()) { |
| return gfx::CreateVectorIcon( |