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

Side by Side Diff: chrome/browser/ui/views/bar_control_button.cc

Issue 2070143003: Add MD ink drop ripple to app list button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@b612539_shelf_button_ripple
Patch Set: Rebased 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "chrome/browser/ui/views/bar_control_button.h" 5 #include "chrome/browser/ui/views/bar_control_button.h"
6 6
7 #include "ui/base/material_design/material_design_controller.h" 7 #include "ui/base/material_design/material_design_controller.h"
8 #include "ui/gfx/color_utils.h" 8 #include "ui/gfx/color_utils.h"
9 #include "ui/gfx/paint_vector_icon.h" 9 #include "ui/gfx/paint_vector_icon.h"
10 #include "ui/gfx/vector_icons_public.h" 10 #include "ui/gfx/vector_icons_public.h"
11 #include "ui/views/border.h" 11 #include "ui/views/border.h"
12 #include "ui/views/painter.h" 12 #include "ui/views/painter.h"
13 13
14 namespace { 14 namespace {
15 15
16 // Extra space around the buttons to increase their event target size. 16 // Extra space around the buttons to increase their event target size.
17 const int kButtonExtraTouchSize = 4; 17 const int kButtonExtraTouchSize = 4;
18 18
19 } // namespace 19 } // namespace
20 20
21 BarControlButton::BarControlButton(views::ButtonListener* listener) 21 BarControlButton::BarControlButton(views::ButtonListener* listener)
22 : views::ImageButton(listener), id_(gfx::VectorIconId::VECTOR_ICON_NONE) { 22 : views::ImageButton(listener), id_(gfx::VectorIconId::VECTOR_ICON_NONE) {
23 SetHasInkDrop(ui::MaterialDesignController::IsModeMaterial()); 23 if (ui::MaterialDesignController::IsModeMaterial())
24 SetInkDropMode(InkDropMode::ON);
24 set_has_ink_drop_action_on_click(true); 25 set_has_ink_drop_action_on_click(true);
25 SetImageAlignment(views::ImageButton::ALIGN_CENTER, 26 SetImageAlignment(views::ImageButton::ALIGN_CENTER,
26 views::ImageButton::ALIGN_MIDDLE); 27 views::ImageButton::ALIGN_MIDDLE);
27 SetFocusPainter(nullptr); 28 SetFocusPainter(nullptr);
28 } 29 }
29 30
30 BarControlButton::~BarControlButton() {} 31 BarControlButton::~BarControlButton() {}
31 32
32 void BarControlButton::SetIcon( 33 void BarControlButton::SetIcon(
33 gfx::VectorIconId id, 34 gfx::VectorIconId id,
(...skipping 14 matching lines...) Expand all
48 gfx::ImageSkia image = gfx::CreateVectorIcon(id_, icon_color); 49 gfx::ImageSkia image = gfx::CreateVectorIcon(id_, icon_color);
49 SetImage(views::CustomButton::STATE_NORMAL, &image); 50 SetImage(views::CustomButton::STATE_NORMAL, &image);
50 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2)); 51 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2));
51 SetImage(views::CustomButton::STATE_DISABLED, &image); 52 SetImage(views::CustomButton::STATE_DISABLED, &image);
52 set_ink_drop_base_color(icon_color); 53 set_ink_drop_base_color(icon_color);
53 } 54 }
54 55
55 void BarControlButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { 56 void BarControlButton::OnNativeThemeChanged(const ui::NativeTheme* theme) {
56 OnThemeChanged(); 57 OnThemeChanged();
57 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698