summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-29 23:00:44 +0000
committerjennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-29 23:00:44 +0000
commitdae0607bc24f517e8423cc5e4c984d5a018ce5f7 (patch)
treeed51e3472c03cc0471b46ad4612edc1a8971166a
parent104e10d950aa35178da5617ed7aaea67989c918c (diff)
downloadchromium_src-dae0607bc24f517e8423cc5e4c984d5a018ce5f7.zip
chromium_src-dae0607bc24f517e8423cc5e4c984d5a018ce5f7.tar.gz
chromium_src-dae0607bc24f517e8423cc5e4c984d5a018ce5f7.tar.bz2
Merge 164345 - Display battery percentage if it is calculating the battery time.
BUG=157943 Review URL: https://codereview.chromium.org/11262050 TBR=jennyz@chromium.org Review URL: https://codereview.chromium.org/11338022 git-svn-id: svn://svn.chromium.org/chrome/branches/1271/src@164764 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/system/power/power_status_view.cc35
1 files changed, 21 insertions, 14 deletions
diff --git a/ash/system/power/power_status_view.cc b/ash/system/power/power_status_view.cc
index b5aa3a0..3629588 100644
--- a/ash/system/power/power_status_view.cc
+++ b/ash/system/power/power_status_view.cc
@@ -109,8 +109,7 @@ void PowerStatusView::UpdateTextForDefaultView() {
time_status_label_->SetText(
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_ASH_STATUS_TRAY_BATTERY_FULL));
- } else if (supply_status_.is_calculating_battery_time ||
- supply_status_.battery_percentage < 0.0f) {
+ } else if (supply_status_.battery_percentage < 0.0f) {
time_status_label_->SetText(
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_ASH_STATUS_TRAY_BATTERY_CALCULATING));
@@ -121,19 +120,27 @@ void PowerStatusView::UpdateTextForDefaultView() {
string16 battery_time = string16();
int hour = 0;
int min = 0;
- base::TimeDelta time = base::TimeDelta::FromSeconds(
- supply_status_.averaged_battery_time_to_empty);
- hour = time.InHours();
- min = (time - base::TimeDelta::FromHours(hour)).InMinutes();
- if (hour || min) {
- string16 minute = min < 10 ?
- ASCIIToUTF16("0") + base::IntToString16(min) :
- base::IntToString16(min);
+ if (supply_status_.is_calculating_battery_time) {
battery_time =
- l10n_util::GetStringFUTF16(
- IDS_ASH_STATUS_TRAY_BATTERY_TIME_ONLY,
- base::IntToString16(hour),
- minute);
+ ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
+ IDS_ASH_STATUS_TRAY_BATTERY_CALCULATING);
+ } else {
+ base::TimeDelta time = base::TimeDelta::FromSeconds(
+ supply_status_.line_power_on ?
+ supply_status_.averaged_battery_time_to_full :
+ supply_status_.averaged_battery_time_to_empty);
+ hour = time.InHours();
+ min = (time - base::TimeDelta::FromHours(hour)).InMinutes();
+ if (hour || min) {
+ string16 minute = min < 10 ?
+ ASCIIToUTF16("0") + base::IntToString16(min) :
+ base::IntToString16(min);
+ battery_time =
+ l10n_util::GetStringFUTF16(
+ IDS_ASH_STATUS_TRAY_BATTERY_TIME_ONLY,
+ base::IntToString16(hour),
+ minute);
+ }
}
string16 battery_status = battery_time.empty() ?
battery_percentage :