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

Unified Diff: ash/common/system/chromeos/palette/palette_tray.cc

Issue 2502153002: Use correct fonts and add ripples to palette tray help/settings icon. (Closed)
Patch Set: Created 4 years, 1 month 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
Index: ash/common/system/chromeos/palette/palette_tray.cc
diff --git a/ash/common/system/chromeos/palette/palette_tray.cc b/ash/common/system/chromeos/palette/palette_tray.cc
index 9e52bea400008e4c6f3e3c67a3997e40f2926f68..f1b01dc75b94bdcaf812f15e33a5123cc7696eb1 100644
--- a/ash/common/system/chromeos/palette/palette_tray.cc
+++ b/ash/common/system/chromeos/palette/palette_tray.cc
@@ -4,17 +4,20 @@
#include "ash/common/system/chromeos/palette/palette_tray.h"
+#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/session/session_state_delegate.h"
#include "ash/common/shelf/shelf_constants.h"
#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/shelf/wm_shelf_util.h"
#include "ash/common/system/chromeos/palette/palette_tool_manager.h"
#include "ash/common/system/chromeos/palette/palette_utils.h"
+#include "ash/common/system/tray/system_menu_button.h"
#include "ash/common/system/tray/system_tray_controller.h"
#include "ash/common/system/tray/system_tray_delegate.h"
#include "ash/common/system/tray/tray_bubble_wrapper.h"
#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_popup_header_button.h"
+#include "ash/common/system/tray/tray_popup_item_style.h"
#include "ash/common/wm_lookup.h"
#include "ash/common/wm_root_window_controller.h"
#include "ash/common/wm_shell.h"
@@ -82,13 +85,6 @@ bool IsInUserSession() {
LoginStatus::KIOSK_APP;
}
-// Returns the font used by the title view.
-const gfx::FontList& GetTitleFont() {
- // TODO(tdanderson|jdufault): Use TrayPopupItemStyle instead.
- return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
- 2, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::MEDIUM);
-}
-
class TitleView : public views::View, public views::ButtonListener {
public:
explicit TitleView(PaletteTray* palette_tray) : palette_tray_(palette_tray) {
@@ -97,28 +93,41 @@ class TitleView : public views::View, public views::ButtonListener {
kHorizontalPaddingBetweenTitleEntries);
SetLayoutManager(box_layout);
- views::Label* text_label =
+ views::Label* title_label =
new views::Label(l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_TITLE));
- text_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- text_label->SetFontList(GetTitleFont());
- AddChildView(text_label);
- box_layout->SetFlexForView(text_label, 1);
-
- gfx::ImageSkia settings_icon =
- gfx::CreateVectorIcon(kSystemMenuSettingsIcon, kMenuIconColor);
- gfx::ImageSkia help_icon =
- gfx::CreateVectorIcon(kSystemMenuHelpIcon, kMenuIconColor);
-
- help_button_ = new ash::TrayPopupHeaderButton(this, help_icon,
- IDS_ASH_STATUS_TRAY_HELP);
- help_button_->SetTooltipText(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP));
- AddChildView(help_button_);
+ title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ TrayPopupItemStyle style(title_label->GetNativeTheme(),
tdanderson 2016/11/16 20:44:16 Ditto to my previous comment, please introduce Upd
jdufault 2016/11/28 17:59:15 Done.
+ TrayPopupItemStyle::FontStyle::TITLE);
+ style.SetupLabel(title_label);
+ AddChildView(title_label);
+ box_layout->SetFlexForView(title_label, 1);
tdanderson 2016/11/16 20:44:16 Please add a "TODO(tdanderson|jdufault): Use TriVi
jdufault 2016/11/28 17:59:15 Added TODO; I'll try to come back to this after no
+ if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
+ help_button_ =
+ new SystemMenuButton(this, SystemMenuButton::InkDropStyle::FLOOD_FILL,
tdanderson 2016/11/16 20:44:16 Since the help and settings button don't have a ve
jdufault 2016/11/28 17:59:15 Done.
+ kSystemMenuHelpIcon, IDS_ASH_STATUS_TRAY_HELP);
+ settings_button_ = new SystemMenuButton(
+ this, SystemMenuButton::InkDropStyle::FLOOD_FILL,
+ kSystemMenuSettingsIcon, IDS_ASH_STATUS_TRAY_SETTINGS);
+ } else {
+ gfx::ImageSkia help_icon =
+ gfx::CreateVectorIcon(kSystemMenuHelpIcon, kMenuIconColor);
+ gfx::ImageSkia settings_icon =
+ gfx::CreateVectorIcon(kSystemMenuSettingsIcon, kMenuIconColor);
+
+ auto* help_button = new ash::TrayPopupHeaderButton(
+ this, help_icon, IDS_ASH_STATUS_TRAY_HELP);
+ help_button->SetTooltipText(
+ l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP));
+ help_button_ = help_button;
+
+ auto* settings_button = new ash::TrayPopupHeaderButton(
+ this, settings_icon, IDS_ASH_STATUS_TRAY_SETTINGS);
+ settings_button->SetTooltipText(
+ l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SETTINGS));
+ settings_button_ = settings_button;
+ }
- settings_button_ = new ash::TrayPopupHeaderButton(
- this, settings_icon, IDS_ASH_STATUS_TRAY_SETTINGS);
- settings_button_->SetTooltipText(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SETTINGS));
+ AddChildView(help_button_);
AddChildView(settings_button_);
}
@@ -144,8 +153,8 @@ class TitleView : public views::View, public views::ButtonListener {
// Unowned pointers to button views so we can determine which button was
// clicked.
- ash::TrayPopupHeaderButton* settings_button_;
- ash::TrayPopupHeaderButton* help_button_;
+ views::View* settings_button_;
+ views::View* help_button_;
PaletteTray* palette_tray_;
DISALLOW_COPY_AND_ASSIGN(TitleView);

Powered by Google App Engine
This is Rietveld 408576698