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

Unified Diff: ash/common/system/chromeos/ime_menu/ime_list_view.cc

Issue 2661023006: Remove unused references to NativeTheme in TrayPopupItemStyle. (Closed)
Patch Set: slight improvement Created 3 years, 11 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/chromeos/ime_menu/ime_list_view.cc
diff --git a/ash/common/system/chromeos/ime_menu/ime_list_view.cc b/ash/common/system/chromeos/ime_menu/ime_list_view.cc
index b0c659178cd6647cd3f39c891eafd8d9d2e429d2..849cd58fb674d5a1d473ea89a1c30e934be8f6b0 100644
--- a/ash/common/system/chromeos/ime_menu/ime_list_view.cc
+++ b/ash/common/system/chromeos/ime_menu/ime_list_view.cc
@@ -120,11 +120,14 @@ class ImeListItemView : public ActionableView {
tri_view->AddView(TriView::Container::START, id_label);
// The label shows the IME name.
- label_ = TrayPopupUtils::CreateDefaultLabel();
- label_->SetText(label);
- UpdateStyle();
- label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- tri_view->AddView(TriView::Container::CENTER, label_);
+ auto label_view = TrayPopupUtils::CreateDefaultLabel();
+ label_view->SetText(label);
+ TrayPopupItemStyle style(
+ TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
+ style.SetupLabel(label_view);
+
+ label_view->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ tri_view->AddView(TriView::Container::CENTER, label_view);
if (selected) {
// The checked button indicates the IME is selected.
@@ -133,7 +136,7 @@ class ImeListItemView : public ActionableView {
gfx::VectorIconId::CHECK_CIRCLE, kMenuIconSize, button_color));
tri_view->AddView(TriView::Container::END, checked_image);
}
- SetAccessibleName(label_->text());
+ SetAccessibleName(label_view->text());
}
~ImeListItemView() override {}
@@ -157,11 +160,6 @@ class ImeListItemView : public ActionableView {
ime_list_view_->scroll_content()->ScrollRectToVisible(bounds());
}
- // views::View:
- void OnNativeThemeChanged(const ui::NativeTheme* theme) override {
- UpdateStyle();
- }
-
void GetAccessibleNodeData(ui::AXNodeData* node_data) override {
ActionableView::GetAccessibleNodeData(node_data);
node_data->role = ui::AX_ROLE_CHECK_BOX;
@@ -170,15 +168,6 @@ class ImeListItemView : public ActionableView {
}
private:
- // Updates the style of |label_| based on the current native theme.
- void UpdateStyle() {
- TrayPopupItemStyle style(
- GetNativeTheme(), TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
- style.SetupLabel(label_);
- }
-
- // The label shows the IME name.
- views::Label* label_;
ImeListView* ime_list_view_;
bool selected_;
@@ -191,7 +180,7 @@ class ImeListItemView : public ActionableView {
class MaterialKeyboardStatusRowView : public views::View {
public:
MaterialKeyboardStatusRowView(views::ButtonListener* listener, bool enabled)
- : listener_(listener), label_(nullptr), toggle_(nullptr) {
+ : listener_(listener), toggle_(nullptr) {
Init();
toggle_->SetIsOn(enabled, false);
}
@@ -207,10 +196,6 @@ class MaterialKeyboardStatusRowView : public views::View {
return GetPreferredSize().height();
}
- void OnNativeThemeChanged(const ui::NativeTheme* theme) override {
- UpdateStyle();
- }
-
private:
void Init() {
TrayPopupUtils::ConfigureAsStickyHeader(this);
@@ -225,12 +210,14 @@ class MaterialKeyboardStatusRowView : public views::View {
kImeMenuOnScreenKeyboardIcon, kMenuIconSize, kMenuIconColor));
tri_view->AddView(TriView::Container::START, keyboard_image);
- // The on-screen keyboard label.
- label_ = TrayPopupUtils::CreateDefaultLabel();
- label_->SetText(ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
+ // The on-screen keyboard label ('On-screen keyboard').
+ auto label = TrayPopupUtils::CreateDefaultLabel();
+ label->SetText(ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD));
- UpdateStyle();
- tri_view->AddView(TriView::Container::CENTER, label_);
+ TrayPopupItemStyle style(
+ TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
+ style.SetupLabel(label);
+ tri_view->AddView(TriView::Container::CENTER, label);
// The on-screen keyboard toggle button.
toggle_ = TrayPopupUtils::CreateToggleButton(
@@ -238,19 +225,9 @@ class MaterialKeyboardStatusRowView : public views::View {
tri_view->AddView(TriView::Container::END, toggle_);
}
- // Updates the style of |label_| based on the current native theme.
- void UpdateStyle() {
- TrayPopupItemStyle style(
- GetNativeTheme(), TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
- style.SetupLabel(label_);
- }
-
// ButtonListener to notify when |toggle_| is clicked.
views::ButtonListener* listener_;
- // Label to with text 'On-screen keyboard'.
- views::Label* label_;
-
// ToggleButton to toggle keyboard on or off.
views::ToggleButton* toggle_;
« no previous file with comments | « ash/common/system/chromeos/bluetooth/tray_bluetooth.cc ('k') | ash/common/system/chromeos/ime_menu/ime_menu_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698