| 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 "ash/common/system/tray/tray_popup_utils.h" | 10 #include "ash/common/system/tray/tray_popup_utils.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 SetImage(views::Button::STATE_NORMAL, &normal_icon); | 32 SetImage(views::Button::STATE_NORMAL, &normal_icon); |
| 33 SetImage(views::Button::STATE_DISABLED, &disabled_icon); | 33 SetImage(views::Button::STATE_DISABLED, &disabled_icon); |
| 34 | 34 |
| 35 const int horizontal_padding = (kMenuButtonSize - normal_icon.width()) / 2; | 35 const int horizontal_padding = (kMenuButtonSize - normal_icon.width()) / 2; |
| 36 const int vertical_padding = (kMenuButtonSize - normal_icon.height()) / 2; | 36 const int vertical_padding = (kMenuButtonSize - normal_icon.height()) / 2; |
| 37 SetBorder(views::CreateEmptyBorder(vertical_padding, horizontal_padding, | 37 SetBorder(views::CreateEmptyBorder(vertical_padding, horizontal_padding, |
| 38 vertical_padding, horizontal_padding)); | 38 vertical_padding, horizontal_padding)); |
| 39 | 39 |
| 40 SetTooltipText(l10n_util::GetStringUTF16(accessible_name_id)); | 40 SetTooltipText(l10n_util::GetStringUTF16(accessible_name_id)); |
| 41 | 41 |
| 42 SetFocusForPlatform(); | 42 SetFocusPainter(TrayPopupUtils::CreateFocusPainter()); |
| 43 SetFocusPainter(views::Painter::CreateSolidFocusPainter( | 43 TrayPopupUtils::ConfigureTrayPopupButton(this); |
| 44 kFocusBorderColor, kFocusBorderThickness, gfx::InsetsF())); | |
| 45 | |
| 46 SetInkDropMode(InkDropMode::ON); | |
| 47 set_has_ink_drop_action_on_click(true); | |
| 48 set_ink_drop_base_color(kTrayPopupInkDropBaseColor); | |
| 49 set_ink_drop_visible_opacity(kTrayPopupInkDropRippleOpacity); | |
| 50 } | 44 } |
| 51 | 45 |
| 52 SystemMenuButton::SystemMenuButton(views::ButtonListener* listener, | 46 SystemMenuButton::SystemMenuButton(views::ButtonListener* listener, |
| 53 TrayPopupInkDropStyle ink_drop_style, | 47 TrayPopupInkDropStyle ink_drop_style, |
| 54 const gfx::VectorIcon& icon, | 48 const gfx::VectorIcon& icon, |
| 55 int accessible_name_id) | 49 int accessible_name_id) |
| 56 : SystemMenuButton(listener, | 50 : SystemMenuButton(listener, |
| 57 ink_drop_style, | 51 ink_drop_style, |
| 58 gfx::CreateVectorIcon(icon, kMenuIconColor), | 52 gfx::CreateVectorIcon(icon, kMenuIconColor), |
| 59 gfx::CreateVectorIcon(icon, kMenuIconColorDisabled), | 53 gfx::CreateVectorIcon(icon, kMenuIconColorDisabled), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 86 : TrayPopupUtils::CreateInkDropHighlight(ink_drop_style_, this, | 80 : TrayPopupUtils::CreateInkDropHighlight(ink_drop_style_, this, |
| 87 ink_drop_color_.value()); | 81 ink_drop_color_.value()); |
| 88 } | 82 } |
| 89 | 83 |
| 90 std::unique_ptr<views::InkDropMask> SystemMenuButton::CreateInkDropMask() | 84 std::unique_ptr<views::InkDropMask> SystemMenuButton::CreateInkDropMask() |
| 91 const { | 85 const { |
| 92 return TrayPopupUtils::CreateInkDropMask(ink_drop_style_, this); | 86 return TrayPopupUtils::CreateInkDropMask(ink_drop_style_, this); |
| 93 } | 87 } |
| 94 | 88 |
| 95 } // namespace ash | 89 } // namespace ash |
| OLD | NEW |