| OLD | NEW |
| 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/gfx/color_utils.h" | 8 #include "ui/gfx/color_utils.h" |
| 8 #include "ui/gfx/paint_vector_icon.h" | 9 #include "ui/gfx/paint_vector_icon.h" |
| 9 #include "ui/gfx/vector_icons_public.h" | 10 #include "ui/gfx/vector_icons_public.h" |
| 10 #include "ui/views/border.h" | 11 #include "ui/views/border.h" |
| 11 #include "ui/views/painter.h" | 12 #include "ui/views/painter.h" |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 // Extra space around the buttons to increase their event target size. | 16 // Extra space around the buttons to increase their event target size. |
| 16 const int kButtonExtraTouchSize = 4; | 17 const int kButtonExtraTouchSize = 4; |
| 17 | 18 |
| 18 } // namespace | 19 } // namespace |
| 19 | 20 |
| 20 BarControlButton::BarControlButton(views::ButtonListener* listener) | 21 BarControlButton::BarControlButton(views::ButtonListener* listener) |
| 21 : views::ImageButton(listener), id_(gfx::VectorIconId::VECTOR_ICON_NONE) { | 22 : views::ImageButton(listener), id_(gfx::VectorIconId::VECTOR_ICON_NONE) { |
| 22 SetHasInkDrop(true); | 23 SetHasInkDrop(ui::MaterialDesignController::IsModeMaterial()); |
| 23 set_has_ink_drop_action_on_click(true); | 24 set_has_ink_drop_action_on_click(true); |
| 24 SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 25 SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
| 25 views::ImageButton::ALIGN_MIDDLE); | 26 views::ImageButton::ALIGN_MIDDLE); |
| 26 SetFocusPainter(nullptr); | 27 SetFocusPainter(nullptr); |
| 27 } | 28 } |
| 28 | 29 |
| 29 BarControlButton::~BarControlButton() {} | 30 BarControlButton::~BarControlButton() {} |
| 30 | 31 |
| 31 void BarControlButton::SetIcon( | 32 void BarControlButton::SetIcon( |
| 32 gfx::VectorIconId id, | 33 gfx::VectorIconId id, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 47 gfx::ImageSkia image = gfx::CreateVectorIcon(id_, icon_color); | 48 gfx::ImageSkia image = gfx::CreateVectorIcon(id_, icon_color); |
| 48 SetImage(views::CustomButton::STATE_NORMAL, &image); | 49 SetImage(views::CustomButton::STATE_NORMAL, &image); |
| 49 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2)); | 50 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2)); |
| 50 SetImage(views::CustomButton::STATE_DISABLED, &image); | 51 SetImage(views::CustomButton::STATE_DISABLED, &image); |
| 51 set_ink_drop_base_color(icon_color); | 52 set_ink_drop_base_color(icon_color); |
| 52 } | 53 } |
| 53 | 54 |
| 54 void BarControlButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { | 55 void BarControlButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
| 55 OnThemeChanged(); | 56 OnThemeChanged(); |
| 56 } | 57 } |
| OLD | NEW |