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

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

Issue 2244003002: Materialized font style for TrayItemMore type system tray rows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Deferred generic TrayItemPopupStyle application to TrayItemMore. 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
Index: ash/common/system/tray/tray_item_more.cc
diff --git a/ash/common/system/tray/tray_item_more.cc b/ash/common/system/tray/tray_item_more.cc
index 6d4fe55191bcf428fd06a196cbcf24986915adac..0e82407e304c0eed1f356e980c740adc4780e118 100644
--- a/ash/common/system/tray/tray_item_more.cc
+++ b/ash/common/system/tray/tray_item_more.cc
@@ -8,6 +8,7 @@
#include "ash/common/system/tray/fixed_sized_image_view.h"
#include "ash/common/system/tray/system_tray_item.h"
#include "ash/common/system/tray/tray_constants.h"
+#include "ash/common/system/tray/tray_popup_item_style.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "grit/ash_resources.h"
#include "ui/accessibility/ax_view_state.h"
@@ -75,6 +76,15 @@ void TrayItemMore::ReplaceIcon(views::View* view) {
AddChildViewAt(view, 0);
}
+void TrayItemMore::UpdateStyle() {
+ if (!MaterialDesignController::IsSystemTrayMenuMaterial())
+ return;
+
+ TrayPopupItemStyle style(GetNativeTheme(),
+ TrayPopupItemStyle::FontStyle::DEFAULT_VIEW_LABEL);
+ style.SetupLabel(label_);
+}
+
bool TrayItemMore::PerformAction(const ui::Event& event) {
if (!show_more_)
return false;
@@ -112,4 +122,17 @@ void TrayItemMore::GetAccessibleState(ui::AXViewState* state) {
state->name = accessible_name_;
}
+void TrayItemMore::ViewHierarchyChanged(
+ const ViewHierarchyChangedDetails& details) {
+ ActionableView::ViewHierarchyChanged(details);
+
+ if (details.is_add && details.child == this)
+ UpdateStyle();
+}
+
+void TrayItemMore::OnNativeThemeChanged(const ui::NativeTheme* theme) {
+ ActionableView::OnNativeThemeChanged(theme);
+ UpdateStyle();
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698