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

Side by Side Diff: ui/views/controls/button/vector_icon_button.cc

Issue 2389453002: Remove IsModeMaterial checks in ui/views/ (Closed)
Patch Set: oops Created 4 years, 2 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 "ui/views/controls/button/vector_icon_button.h" 5 #include "ui/views/controls/button/vector_icon_button.h"
6 6
7 #include "ui/base/material_design/material_design_controller.h"
8 #include "ui/gfx/color_palette.h" 7 #include "ui/gfx/color_palette.h"
9 #include "ui/gfx/color_utils.h" 8 #include "ui/gfx/color_utils.h"
10 #include "ui/gfx/paint_vector_icon.h" 9 #include "ui/gfx/paint_vector_icon.h"
11 #include "ui/gfx/vector_icons_public.h" 10 #include "ui/gfx/vector_icons_public.h"
12 #include "ui/views/border.h" 11 #include "ui/views/border.h"
13 #include "ui/views/controls/button/vector_icon_button_delegate.h" 12 #include "ui/views/controls/button/vector_icon_button_delegate.h"
14 #include "ui/views/painter.h" 13 #include "ui/views/painter.h"
15 14
16 namespace views { 15 namespace views {
17 16
18 namespace { 17 namespace {
19 18
20 // Extra space around the buttons to increase their event target size. 19 // Extra space around the buttons to increase their event target size.
21 const int kButtonExtraTouchSize = 4; 20 const int kButtonExtraTouchSize = 4;
22 21
23 } // namespace 22 } // namespace
24 23
25 VectorIconButton::VectorIconButton(VectorIconButtonDelegate* delegate) 24 VectorIconButton::VectorIconButton(VectorIconButtonDelegate* delegate)
26 : views::ImageButton(delegate), 25 : views::ImageButton(delegate),
27 delegate_(delegate), 26 delegate_(delegate),
28 id_(gfx::VectorIconId::VECTOR_ICON_NONE) { 27 id_(gfx::VectorIconId::VECTOR_ICON_NONE) {
29 if (ui::MaterialDesignController::IsModeMaterial()) 28 SetInkDropMode(InkDropMode::ON);
30 SetInkDropMode(InkDropMode::ON);
31 set_has_ink_drop_action_on_click(true); 29 set_has_ink_drop_action_on_click(true);
32 SetImageAlignment(views::ImageButton::ALIGN_CENTER, 30 SetImageAlignment(views::ImageButton::ALIGN_CENTER,
33 views::ImageButton::ALIGN_MIDDLE); 31 views::ImageButton::ALIGN_MIDDLE);
34 SetFocusPainter(nullptr); 32 SetFocusPainter(nullptr);
35 } 33 }
36 34
37 VectorIconButton::~VectorIconButton() {} 35 VectorIconButton::~VectorIconButton() {}
38 36
39 void VectorIconButton::SetIcon(gfx::VectorIconId id) { 37 void VectorIconButton::SetIcon(gfx::VectorIconId id) {
40 id_ = id; 38 id_ = id;
(...skipping 13 matching lines...) Expand all
54 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2)); 52 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2));
55 SetImage(views::CustomButton::STATE_DISABLED, &image); 53 SetImage(views::CustomButton::STATE_DISABLED, &image);
56 set_ink_drop_base_color(icon_color); 54 set_ink_drop_base_color(icon_color);
57 } 55 }
58 56
59 void VectorIconButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { 57 void VectorIconButton::OnNativeThemeChanged(const ui::NativeTheme* theme) {
60 OnThemeChanged(); 58 OnThemeChanged();
61 } 59 }
62 60
63 } // namespace views 61 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698