summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authormichaelpg <michaelpg@chromium.org>2015-12-11 10:07:30 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-11 18:08:20 +0000
commit6ded5ea5fb7349e35a814c78adaec397f087d605 (patch)
treec8ac3dfe36a4f1614170166ff330d9bd240e4c79 /ash
parent584edf5d5582307ff3a8a77d16b69dd2607e3e37 (diff)
downloadchromium_src-6ded5ea5fb7349e35a814c78adaec397f087d605.zip
chromium_src-6ded5ea5fb7349e35a814c78adaec397f087d605.tar.gz
chromium_src-6ded5ea5fb7349e35a814c78adaec397f087d605.tar.bz2
Move USB Type-C device descriptions to Ash
This moves the strings to Ash so they can be used for notifications. This also has the advantage of making dependents more flexible for when we move from using descriptions based solely on the port, to more useful descriptions based on the device name and whatnot. BUG=547260 Review URL: https://codereview.chromium.org/1509673010 Cr-Commit-Position: refs/heads/master@{#364733}
Diffstat (limited to 'ash')
-rw-r--r--ash/ash_chromeos_strings.grdp33
-rw-r--r--ash/system/chromeos/power/power_status.cc32
-rw-r--r--ash/system/chromeos/power/power_status.h22
3 files changed, 51 insertions, 36 deletions
diff --git a/ash/ash_chromeos_strings.grdp b/ash/ash_chromeos_strings.grdp
index c94576a..639c698 100644
--- a/ash/ash_chromeos_strings.grdp
+++ b/ash/ash_chromeos_strings.grdp
@@ -30,6 +30,39 @@
<message name="IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_MESSAGE_SHORT" desc="The message body of a notification indicating that a low-current USB charger has been connected, short version.">
Your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> may not charge while it is turned on.
</message>
+ <message name="IDS_ASH_POWER_SOURCE_PORT_LEFT" desc="The text identifying an external device, when that device is connected to the USB Type-C port on the left side of this device.">
+ USB-C device (left port)
+ </message>
+ <message name="IDS_ASH_POWER_SOURCE_PORT_RIGHT" desc="The text identifying an external device, when that device is connected to the USB Type-C port on the right side of this device.">
+ USB-C device (right port)
+ </message>
+ <message name="IDS_ASH_POWER_SOURCE_PORT_BACK" desc="The text identifying an external device, when that device is connected to the USB Type-C port on the back of this device.">
+ USB-C device (rear port)
+ </message>
+ <message name="IDS_ASH_POWER_SOURCE_PORT_FRONT" desc="The text identifying an external device, when that device is connected to the USB Type-C port on the front of this device.">
+ USB-C device (front port)
+ </message>
+ <message name="IDS_ASH_POWER_SOURCE_PORT_LEFT_FRONT" desc="The text identifying an external device, when that device is connected to a USB Type-C port on the left side of this device. In this case there are two ports on that side, so this text should refer to the front one on that side.">
+ USB-C device (left side front port)
+ </message>
+ <message name="IDS_ASH_POWER_SOURCE_PORT_LEFT_BACK" desc="The text identifying an external device, when that device is connected to a USB Type-C port on the left side of this device. In this case there are two ports on that side, so this text should refer to the back one on that side.">
+ USB-C device (left side back port)
+ </message>
+ <message name="IDS_ASH_POWER_SOURCE_PORT_RIGHT_FRONT" desc="The text identifying an external device, when that device is connected to a USB Type-C port on the right side of this device. In this case there are two ports on that side, so this text should refer to the front one on that side.">
+ USB-C device (right side front port)
+ </message>
+ <message name="IDS_ASH_POWER_SOURCE_PORT_RIGHT_BACK" desc="The text identifying an external device, when that device is connected to a USB Type-C port on the right side of this device. In this case there are two ports on that side, so this text should refer to the back one on that side.">
+ USB-C device (right side back port)
+ </message>
+ <message name="IDS_ASH_POWER_SOURCE_PORT_BACK_LEFT" desc="The text identifying an external device, when that device is connected to a USB Type-C port on the back of this device. In this case there are two ports on the back, so this text should refer to the one on the left.">
+ USB-C device (left port in the back)
+ </message>
+ <message name="IDS_ASH_POWER_SOURCE_PORT_BACK_RIGHT" desc="The text identifying an external device, when that device is connected to a USB Type-C port on the back of this device. In this case there are two ports on the back, so this text should refer to the one on the right.">
+ USB-C device (right port in the back)
+ </message>
+ <message name="IDS_ASH_POWER_SOURCE_PORT_UNKNOWN" desc="The text referring to the device to charge from, when its port location cannot be determined.">
+ USB-C device
+ </message>
<message name="IDS_CHARGER_REPLACEMENT_ACCESSIBILITY_NOTIFICATION" desc="The notification string used in accessibility to tell user to contact Google for replacing the possible bad charger.">
You may have a bad charger. If you live in the US, please call 866-628-1371 in order to receive help and a replacement. If you live in the UK, please call 0800-026-0613. If you live in Ireland, please call 1-800-832-664. If you live in Canada, please call 866-628-1372. If you live in Australia, please call 1-800-067-460.
diff --git a/ash/system/chromeos/power/power_status.cc b/ash/system/chromeos/power/power_status.cc
index 5154a91..c7cb573 100644
--- a/ash/system/chromeos/power/power_status.cc
+++ b/ash/system/chromeos/power/power_status.cc
@@ -65,34 +65,34 @@ base::string16 GetBatteryTimeAccessibilityString(int hour, int min) {
base::TimeDelta::FromMinutes(min)));
}
-PowerStatus::Port PowerSupplyPortToPowerStatusPort(
- power_manager::PowerSupplyProperties_PowerSource_Port port) {
- switch (port) {
+int PowerSourceToMessageID(
+ const power_manager::PowerSupplyProperties_PowerSource& source) {
+ switch (source.port()) {
case power_manager::PowerSupplyProperties_PowerSource_Port_UNKNOWN:
- return PowerStatus::UNKNOWN_PORT;
+ return IDS_ASH_POWER_SOURCE_PORT_UNKNOWN;
case power_manager::PowerSupplyProperties_PowerSource_Port_LEFT:
- return PowerStatus::LEFT_PORT;
+ return IDS_ASH_POWER_SOURCE_PORT_LEFT;
case power_manager::PowerSupplyProperties_PowerSource_Port_RIGHT:
- return PowerStatus::RIGHT_PORT;
+ return IDS_ASH_POWER_SOURCE_PORT_RIGHT;
case power_manager::PowerSupplyProperties_PowerSource_Port_BACK:
- return PowerStatus::BACK_PORT;
+ return IDS_ASH_POWER_SOURCE_PORT_BACK;
case power_manager::PowerSupplyProperties_PowerSource_Port_FRONT:
- return PowerStatus::FRONT_PORT;
+ return IDS_ASH_POWER_SOURCE_PORT_FRONT;
case power_manager::PowerSupplyProperties_PowerSource_Port_LEFT_FRONT:
- return PowerStatus::LEFT_FRONT_PORT;
+ return IDS_ASH_POWER_SOURCE_PORT_LEFT_FRONT;
case power_manager::PowerSupplyProperties_PowerSource_Port_LEFT_BACK:
- return PowerStatus::LEFT_BACK_PORT;
+ return IDS_ASH_POWER_SOURCE_PORT_LEFT_BACK;
case power_manager::PowerSupplyProperties_PowerSource_Port_RIGHT_FRONT:
- return PowerStatus::RIGHT_FRONT_PORT;
+ return IDS_ASH_POWER_SOURCE_PORT_RIGHT_FRONT;
case power_manager::PowerSupplyProperties_PowerSource_Port_RIGHT_BACK:
- return PowerStatus::RIGHT_BACK_PORT;
+ return IDS_ASH_POWER_SOURCE_PORT_RIGHT_BACK;
case power_manager::PowerSupplyProperties_PowerSource_Port_BACK_LEFT:
- return PowerStatus::BACK_LEFT_PORT;
+ return IDS_ASH_POWER_SOURCE_PORT_BACK_LEFT;
case power_manager::PowerSupplyProperties_PowerSource_Port_BACK_RIGHT:
- return PowerStatus::BACK_RIGHT_PORT;
+ return IDS_ASH_POWER_SOURCE_PORT_BACK_RIGHT;
}
NOTREACHED();
- return PowerStatus::UNKNOWN_PORT;
+ return 0;
}
static PowerStatus* g_power_status = NULL;
@@ -250,7 +250,7 @@ std::vector<PowerStatus::PowerSource> PowerStatus::GetPowerSources() const {
sources.push_back(
{source.id(),
source.active_by_default() ? DEDICATED_CHARGER : DUAL_ROLE_USB,
- PowerSupplyPortToPowerStatusPort(source.port())});
+ PowerSourceToMessageID(source)});
}
return sources;
}
diff --git a/ash/system/chromeos/power/power_status.h b/ash/system/chromeos/power/power_status.h
index 501b5a2..85dd8d3 100644
--- a/ash/system/chromeos/power/power_status.h
+++ b/ash/system/chromeos/power/power_status.h
@@ -50,24 +50,6 @@ class ASH_EXPORT PowerStatus : public chromeos::PowerManagerClient::Observer {
DUAL_ROLE_USB,
};
- // Port locations.
- enum Port {
- // Unknown, or the only port.
- UNKNOWN_PORT,
- LEFT_PORT,
- RIGHT_PORT,
- BACK_PORT,
- FRONT_PORT,
-
- // First word takes precedence, e.g. "frontmost port on the left side".
- LEFT_FRONT_PORT,
- LEFT_BACK_PORT,
- RIGHT_FRONT_PORT,
- RIGHT_BACK_PORT,
- BACK_LEFT_PORT,
- BACK_RIGHT_PORT,
- };
-
// Information about an available power source.
struct PowerSource {
// ID provided by kernel.
@@ -76,8 +58,8 @@ class ASH_EXPORT PowerStatus : public chromeos::PowerManagerClient::Observer {
// Type of power source.
DeviceType type;
- // Location of the port used.
- Port port;
+ // Message ID of a description for this port.
+ int description_id;
};
// Maximum battery time-to-full or time-to-empty that should be displayed