OLD | NEW |
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/system/chromeos/power/power_status_view.h" | 5 #include "ash/system/chromeos/power/power_status_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "ash/system/chromeos/power/power_status.h" | 9 #include "ash/system/chromeos/power/power_status.h" |
10 #include "ash/system/chromeos/power/tray_power.h" | 10 #include "ash/system/chromeos/power/tray_power.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 int hour = 0, min = 0; | 179 int hour = 0, min = 0; |
180 PowerStatus::SplitTimeIntoHoursAndMinutes(time, &hour, &min); | 180 PowerStatus::SplitTimeIntoHoursAndMinutes(time, &hour, &min); |
181 if (status.IsBatteryCharging()) { | 181 if (status.IsBatteryCharging()) { |
182 time_label_->SetText( | 182 time_label_->SetText( |
183 l10n_util::GetStringFUTF16( | 183 l10n_util::GetStringFUTF16( |
184 IDS_ASH_STATUS_TRAY_BATTERY_TIME_UNTIL_FULL, | 184 IDS_ASH_STATUS_TRAY_BATTERY_TIME_UNTIL_FULL, |
185 base::IntToString16(hour), | 185 base::IntToString16(hour), |
186 base::IntToString16(min))); | 186 base::IntToString16(min))); |
187 } else { | 187 } else { |
188 // This is a low battery warning prompting the user in minutes. | 188 // This is a low battery warning prompting the user in minutes. |
189 min = hour * 60 + min; | |
190 time_label_->SetText(ui::TimeFormat::TimeRemaining( | 189 time_label_->SetText(ui::TimeFormat::TimeRemaining( |
191 base::TimeDelta::FromMinutes(min))); | 190 base::TimeDelta::FromMinutes(hour * 60 + min))); |
192 } | 191 } |
193 } else { | 192 } else { |
194 time_label_->SetText(base::string16()); | 193 time_label_->SetText(base::string16()); |
195 } | 194 } |
196 } | 195 } |
197 | 196 |
198 void PowerStatusView::ChildPreferredSizeChanged(views::View* child) { | 197 void PowerStatusView::ChildPreferredSizeChanged(views::View* child) { |
199 PreferredSizeChanged(); | 198 PreferredSizeChanged(); |
200 } | 199 } |
201 | 200 |
(...skipping 11 matching lines...) Expand all Loading... |
213 | 212 |
214 // Move the time_status_label_ closer to percentage_label_. | 213 // Move the time_status_label_ closer to percentage_label_. |
215 if (percentage_label_ && time_status_label_ && | 214 if (percentage_label_ && time_status_label_ && |
216 percentage_label_->visible() && time_status_label_->visible()) { | 215 percentage_label_->visible() && time_status_label_->visible()) { |
217 time_status_label_->SetX(percentage_label_->bounds().right() + 1); | 216 time_status_label_->SetX(percentage_label_->bounds().right() + 1); |
218 } | 217 } |
219 } | 218 } |
220 | 219 |
221 } // namespace internal | 220 } // namespace internal |
222 } // namespace ash | 221 } // namespace ash |
OLD | NEW |