Commit 95a7656a authored by dhnishi's avatar dhnishi Committed by Commit bot

Display "<1%" instead of "0%" on the battery usage display.

Review URL: https://codereview.chromium.org/586563002

Cr-Commit-Position: refs/heads/master@{#296096}
parent 5e272f8a
......@@ -7995,9 +7995,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_WEBSITE_SETTINGS_BATTERY_STOP_BUTTON" desc="The 'Stop' button in the Website Settings single site view dialog.">
Stop
</message>
<message name="IDS_WEBSITE_SETTINGS_BATTERY_PERCENT" desc="The percent from 0 to 100 of battery consumption from a given origin or app on the Website Settings dialog.">
<message name="IDS_WEBSITE_SETTINGS_BATTERY_PERCENT" desc="The percent from 1 to 100 of battery consumption from a given origin or app on the Website Settings dialog.">
<ph name="VALUE">$1<ex>100</ex></ph>%
</message>
<message name="IDS_WEBSITE_SETTINGS_BATTERY_ZERO_PERCENT" desc="The percent shown when less than 1% of battery was consumed from a given origin or app on the Website Settings dialog.">
&lt;1%
</message>
<message name="IDS_WEBSITE_SETTINGS_ALLOWED_LIST_TITLE" desc="Label above the list of allowed origins for a given permission on the Website Settings dialog.">
Allowed
</message>
......
......@@ -676,10 +676,16 @@ void WebsiteSettingsHandler::UpdateBatteryUsage() {
base::DictionaryValue* origin_entry = new base::DictionaryValue();
origin_entry->SetInteger("usage", it->second);
origin_entry->SetString(
"usageString",
l10n_util::GetStringFUTF16Int(IDS_WEBSITE_SETTINGS_BATTERY_PERCENT,
it->second));
if (it->second == 0) {
origin_entry->SetString(
"usageString",
l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_BATTERY_ZERO_PERCENT));
} else {
origin_entry->SetString(
"usageString",
l10n_util::GetStringFUTF16Int(IDS_WEBSITE_SETTINGS_BATTERY_PERCENT,
it->second));
}
origin_entry->SetStringWithoutPathExpansion("readableName",
GetReadableName(it->first));
power_map.SetWithoutPathExpansion(origin, origin_entry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment