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

Side by Side Diff: ash/common/system/chromeos/power/power_status_view.cc

Issue 2661023006: Remove unused references to NativeTheme in TrayPopupItemStyle. (Closed)
Patch Set: slight improvement Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/power/power_status_view.h" 5 #include "ash/common/system/chromeos/power/power_status_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/system/chromeos/power/power_status.h" 8 #include "ash/common/system/chromeos/power/power_status.h"
9 #include "ash/common/system/chromeos/power/tray_power.h" 9 #include "ash/common/system/chromeos/power/tray_power.h"
10 #include "ash/common/system/tray/fixed_sized_image_view.h" 10 #include "ash/common/system/tray/fixed_sized_image_view.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 } 133 }
134 } 134 }
135 percentage_label_->SetVisible(!battery_percentage.empty()); 135 percentage_label_->SetVisible(!battery_percentage.empty());
136 percentage_label_->SetText(battery_percentage); 136 percentage_label_->SetText(battery_percentage);
137 separator_label_->SetVisible(!battery_percentage.empty() && 137 separator_label_->SetVisible(!battery_percentage.empty() &&
138 !battery_time_status.empty()); 138 !battery_time_status.empty());
139 time_status_label_->SetVisible(!battery_time_status.empty()); 139 time_status_label_->SetVisible(!battery_time_status.empty());
140 time_status_label_->SetText(battery_time_status); 140 time_status_label_->SetText(battery_time_status);
141 141
142 if (MaterialDesignController::IsSystemTrayMenuMaterial()) 142 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
143 accessible_name_ = PowerStatus::Get()->GetAccessibleNameString(true); 143 accessible_name_ = PowerStatus::Get()->GetAccessibleNameString(true);
144 }
145 144
146 void PowerStatusView::UpdateStyle() { 145 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SYSTEM_INFO);
147 TrayPopupItemStyle style(GetNativeTheme(), 146 style.SetupLabel(percentage_label_);
148 TrayPopupItemStyle::FontStyle::SYSTEM_INFO); 147 style.SetupLabel(separator_label_);
149 style.SetupLabel(percentage_label_); 148 style.SetupLabel(time_status_label_);
150 style.SetupLabel(separator_label_); 149 }
151 style.SetupLabel(time_status_label_);
152 } 150 }
153 151
154 void PowerStatusView::ChildPreferredSizeChanged(views::View* child) { 152 void PowerStatusView::ChildPreferredSizeChanged(views::View* child) {
155 PreferredSizeChanged(); 153 PreferredSizeChanged();
156 } 154 }
157 155
158 void PowerStatusView::Layout() { 156 void PowerStatusView::Layout() {
159 views::View::Layout(); 157 views::View::Layout();
160 158
161 // Move the time_status_label_, separator_label_, and percentage_label_ 159 // Move the time_status_label_, separator_label_, and percentage_label_
162 // closer to each other. 160 // closer to each other.
163 if (percentage_label_ && separator_label_ && time_status_label_ && 161 if (percentage_label_ && separator_label_ && time_status_label_ &&
164 percentage_label_->visible() && time_status_label_->visible()) { 162 percentage_label_->visible() && time_status_label_->visible()) {
165 separator_label_->SetX(percentage_label_->bounds().right() + 1); 163 separator_label_->SetX(percentage_label_->bounds().right() + 1);
166 time_status_label_->SetX(separator_label_->bounds().right() + 1); 164 time_status_label_->SetX(separator_label_->bounds().right() + 1);
167 } 165 }
168 } 166 }
169 167
170 void PowerStatusView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
171 UpdateStyle();
172 }
173
174 void PowerStatusView::GetAccessibleNodeData(ui::AXNodeData* node_data) { 168 void PowerStatusView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
175 if (!MaterialDesignController::IsSystemTrayMenuMaterial()) 169 if (!MaterialDesignController::IsSystemTrayMenuMaterial())
176 return; 170 return;
177 171
178 node_data->role = ui::AX_ROLE_LABEL_TEXT; 172 node_data->role = ui::AX_ROLE_LABEL_TEXT;
179 node_data->SetName(accessible_name_); 173 node_data->SetName(accessible_name_);
180 } 174 }
181 175
182 } // namespace ash 176 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/power/power_status_view.h ('k') | ash/common/system/chromeos/screen_security/screen_tray_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698