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

Unified Diff: ash/common/system/tray/special_popup_row.cc

Issue 2367903002: Introduce SystemMenuButton for Ash material design (Closed)
Patch Set: comments Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/system/tray/special_popup_row.h ('k') | ash/common/system/tray/system_menu_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/tray/special_popup_row.cc
diff --git a/ash/common/system/tray/special_popup_row.cc b/ash/common/system/tray/special_popup_row.cc
index b25965febd4bd75d686fcba2425fbc794105e9a2..7ddc711331ae86eb4b1d2f13ed3ad9d886f497b6 100644
--- a/ash/common/system/tray/special_popup_row.cc
+++ b/ash/common/system/tray/special_popup_row.cc
@@ -7,6 +7,7 @@
#include "ash/common/ash_constants.h"
#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/system/tray/hover_highlight_view.h"
+#include "ash/common/system/tray/system_menu_button.h"
#include "ash/common/system/tray/throbber_view.h"
#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_popup_header_button.h"
@@ -96,36 +97,23 @@ void SpecialPopupRow::SetContent(views::View* view) {
}
views::Button* SpecialPopupRow::AddBackButton(views::ButtonListener* listener) {
- return AddImageButton(listener, kSystemMenuArrowBackIcon,
- IDS_ASH_STATUS_TRAY_PREVIOUS_MENU, false);
+ return AddSystemMenuButton(listener, kSystemMenuArrowBackIcon,
+ IDS_ASH_STATUS_TRAY_PREVIOUS_MENU, false);
}
views::Button* SpecialPopupRow::AddSettingsButton(
views::ButtonListener* listener) {
- return AddImageButton(listener, kSystemMenuSettingsIcon,
- IDS_ASH_STATUS_TRAY_SETTINGS, true);
+ return AddSystemMenuButton(listener, kSystemMenuSettingsIcon,
+ IDS_ASH_STATUS_TRAY_SETTINGS, true);
}
-views::ImageButton* SpecialPopupRow::AddImageButton(
+SystemMenuButton* SpecialPopupRow::AddSystemMenuButton(
views::ButtonListener* listener,
const gfx::VectorIcon& icon,
int accessible_name_id,
bool after_content) {
- views::ImageButton* button = new views::ImageButton(listener);
-
- gfx::ImageSkia image = gfx::CreateVectorIcon(icon, kMenuIconColor);
- button->SetImage(views::Button::STATE_NORMAL, &image);
- const int horizontal_padding = (kMenuButtonSize - image.width()) / 2;
- const int vertical_padding = (kMenuButtonSize - image.height()) / 2;
- button->SetBorder(
- views::Border::CreateEmptyBorder(vertical_padding, horizontal_padding,
- vertical_padding, horizontal_padding));
-
- ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- button->SetTooltipText(bundle.GetLocalizedString(accessible_name_id));
- button->SetFocusForPlatform();
- button->SetFocusPainter(views::Painter::CreateSolidFocusPainter(
- kFocusBorderColor, gfx::Insets(1, 1, 1, 1)));
+ SystemMenuButton* button =
+ new SystemMenuButton(listener, icon, accessible_name_id);
if (after_content)
AddViewAfterContent(button);
« no previous file with comments | « ash/common/system/tray/special_popup_row.h ('k') | ash/common/system/tray/system_menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698