| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/common/system/tray/system_menu_button.h" | 5 #include "ash/common/system/tray/system_menu_button.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_constants.h" | 7 #include "ash/common/ash_constants.h" |
| 8 #include "ash/common/system/tray/system_tray.h" | 8 #include "ash/common/system/tray/system_tray.h" |
| 9 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| 11 #include "ui/gfx/paint_vector_icon.h" | 11 #include "ui/gfx/paint_vector_icon.h" |
| 12 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 12 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 13 #include "ui/views/animation/ink_drop_highlight.h" | 13 #include "ui/views/animation/ink_drop_highlight.h" |
| 14 #include "ui/views/border.h" | 14 #include "ui/views/border.h" |
| 15 #include "ui/views/painter.h" | 15 #include "ui/views/painter.h" |
| 16 | 16 |
| 17 namespace ash { | 17 namespace ash { |
| 18 | 18 |
| 19 SystemMenuButton::SystemMenuButton(views::ButtonListener* listener, | 19 SystemMenuButton::SystemMenuButton(views::ButtonListener* listener, |
| 20 const gfx::VectorIcon& icon, | 20 const gfx::VectorIcon& icon, |
| 21 int accessible_name_id) | 21 int accessible_name_id) |
| 22 : views::ImageButton(listener) { | 22 : views::ImageButton(listener) { |
| 23 gfx::ImageSkia image = gfx::CreateVectorIcon(icon, kMenuIconColor); | 23 gfx::ImageSkia image = gfx::CreateVectorIcon(icon, kMenuIconColor); |
| 24 SetImage(views::Button::STATE_NORMAL, &image); | 24 SetImage(views::Button::STATE_NORMAL, &image); |
| 25 gfx::ImageSkia disabled_image = |
| 26 gfx::CreateVectorIcon(icon, kMenuIconColorDisabled); |
| 27 SetImage(views::Button::STATE_DISABLED, &disabled_image); |
| 28 |
| 25 const int horizontal_padding = (kMenuButtonSize - image.width()) / 2; | 29 const int horizontal_padding = (kMenuButtonSize - image.width()) / 2; |
| 26 const int vertical_padding = (kMenuButtonSize - image.height()) / 2; | 30 const int vertical_padding = (kMenuButtonSize - image.height()) / 2; |
| 27 SetBorder( | 31 SetBorder( |
| 28 views::Border::CreateEmptyBorder(vertical_padding, horizontal_padding, | 32 views::Border::CreateEmptyBorder(vertical_padding, horizontal_padding, |
| 29 vertical_padding, horizontal_padding)); | 33 vertical_padding, horizontal_padding)); |
| 30 | 34 |
| 31 SetTooltipText(l10n_util::GetStringUTF16(accessible_name_id)); | 35 SetTooltipText(l10n_util::GetStringUTF16(accessible_name_id)); |
| 32 | 36 |
| 33 // TODO(tdanderson): Update the focus rect color, border thickness, and | 37 // TODO(tdanderson): Update the focus rect color, border thickness, and |
| 34 // location for material design. | 38 // location for material design. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 53 std::unique_ptr<views::InkDropHighlight> | 57 std::unique_ptr<views::InkDropHighlight> |
| 54 SystemMenuButton::CreateInkDropHighlight() const { | 58 SystemMenuButton::CreateInkDropHighlight() const { |
| 55 return nullptr; | 59 return nullptr; |
| 56 } | 60 } |
| 57 | 61 |
| 58 bool SystemMenuButton::ShouldShowInkDropForFocus() const { | 62 bool SystemMenuButton::ShouldShowInkDropForFocus() const { |
| 59 return false; | 63 return false; |
| 60 } | 64 } |
| 61 | 65 |
| 62 } // namespace ash | 66 } // namespace ash |
| OLD | NEW |