Commit 20a547de authored by Daniel Campello's avatar Daniel Campello Committed by Commit Bot

wilco_dtc_supportd: Add Low-Power Charger notification

This new notification is originated when the attached power adapter does
not supply enough power.

BUG=b:147843861
TEST=deploy_chrome # Notification displays when power adapter is
connected

Change-Id: Ibb3852c584375d0ffa4ed99eb788fa1522fef80c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078905Reviewed-by: default avatarPolina Bondarenko <pbond@chromium.org>
Reviewed-by: default avatarMattias Nissler <mnissler@chromium.org>
Commit-Queue: Daniel Campello <campello@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746063}
parent 8678a20e
...@@ -1149,6 +1149,12 @@ ...@@ -1149,6 +1149,12 @@
<message name="IDS_WILCO_NOTIFICATION_DOCK_THUNDERBOLT_MESSAGE" desc="The message of the notification shown to inform the user that attached dock will operate in USB Type-C compatible mode."> <message name="IDS_WILCO_NOTIFICATION_DOCK_THUNDERBOLT_MESSAGE" desc="The message of the notification shown to inform the user that attached dock will operate in USB Type-C compatible mode.">
Your docking station will operate in USB Type-C compatible mode. Your docking station will operate in USB Type-C compatible mode.
</message> </message>
<message name="IDS_WILCO_LOW_POWER_CHARGER_TITLE" desc="The title of a notification indicating that a low-power USB charger has been connected.">
Low-power charger connected
</message>
<message name="IDS_WILCO_LOW_POWER_CHARGER_MESSAGE" desc="The message body of a notification indicating that a low-power 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_WILCO_NOTIFICATION_LEARN_MORE" desc="Label on button in various Wilco notification."> <message name="IDS_WILCO_NOTIFICATION_LEARN_MORE" desc="Label on button in various Wilco notification.">
Learn More Learn More
</message> </message>
......
...@@ -370,6 +370,9 @@ void WilcoDtcSupportdBridge::HandleEvent(WilcoDtcSupportdEvent event) { ...@@ -370,6 +370,9 @@ void WilcoDtcSupportdBridge::HandleEvent(WilcoDtcSupportdEvent event) {
case WilcoDtcSupportdEvent::kDockThunderbolt: case WilcoDtcSupportdEvent::kDockThunderbolt:
notification_controller_->ShowDockThunderboltNotification(); notification_controller_->ShowDockThunderboltNotification();
return; return;
case WilcoDtcSupportdEvent::kLowPowerCharger:
notification_controller_->ShowLowPowerChargerNotification();
return;
} }
LOG(ERROR) << "Unrecognized event " << event << " event"; LOG(ERROR) << "Unrecognized event " << event << " event";
} }
......
...@@ -35,6 +35,7 @@ const char kWilcoDtcSupportdNotificationIdIncompatibleDock[] = ...@@ -35,6 +35,7 @@ const char kWilcoDtcSupportdNotificationIdIncompatibleDock[] =
const char kWilcoDtcSupportdNotificationIdDockHardwareError[] = "DockError"; const char kWilcoDtcSupportdNotificationIdDockHardwareError[] = "DockError";
const char kWilcoDtcSupportdNotificationIdDockDisplay[] = "DockDisplay"; const char kWilcoDtcSupportdNotificationIdDockDisplay[] = "DockDisplay";
const char kWilcoDtcSupportdNotificationIdDockThunderbolt[] = "DockThunderbolt"; const char kWilcoDtcSupportdNotificationIdDockThunderbolt[] = "DockThunderbolt";
const char kWilcoDtcSupportdNotificationIdLowPower[] = "LowPower";
class WilcoDtcSupportdNotificationDelegate class WilcoDtcSupportdNotificationDelegate
: public message_center::NotificationDelegate { : public message_center::NotificationDelegate {
...@@ -151,6 +152,18 @@ WilcoDtcSupportdNotificationController::ShowDockThunderboltNotification() ...@@ -151,6 +152,18 @@ WilcoDtcSupportdNotificationController::ShowDockThunderboltNotification()
return kWilcoDtcSupportdNotificationIdDockThunderbolt; return kWilcoDtcSupportdNotificationIdDockThunderbolt;
} }
std::string
WilcoDtcSupportdNotificationController::ShowLowPowerChargerNotification()
const {
DisplayNotification(kWilcoDtcSupportdNotificationIdLowPower,
IDS_WILCO_LOW_POWER_CHARGER_TITLE,
IDS_WILCO_LOW_POWER_CHARGER_MESSAGE,
message_center::SYSTEM_PRIORITY, kNotificationBatteryIcon,
message_center::SystemNotificationWarningLevel::WARNING,
HelpAppLauncher::HelpTopic::HELP_WILCO_BATTERY_CHARGER);
return kWilcoDtcSupportdNotificationIdLowPower;
}
void WilcoDtcSupportdNotificationController::DisplayNotification( void WilcoDtcSupportdNotificationController::DisplayNotification(
const std::string& notification_id, const std::string& notification_id,
const int title_id, const int title_id,
......
...@@ -42,6 +42,9 @@ class WilcoDtcSupportdNotificationController { ...@@ -42,6 +42,9 @@ class WilcoDtcSupportdNotificationController {
// Displays notification when the attached dock has unsupported Thunderbolt // Displays notification when the attached dock has unsupported Thunderbolt
// capabilities. // capabilities.
virtual std::string ShowDockThunderboltNotification() const; virtual std::string ShowDockThunderboltNotification() const;
// Displays notification when the attached charger does not supply enough
// power.
virtual std::string ShowLowPowerChargerNotification() const;
private: private:
void DisplayNotification( void DisplayNotification(
......
...@@ -53,7 +53,10 @@ struct WilcoDtcSupportdNotificationControllerTestParams { ...@@ -53,7 +53,10 @@ struct WilcoDtcSupportdNotificationControllerTestParams {
{&WilcoDtcSupportdNotificationController::ShowDockThunderboltNotification, {&WilcoDtcSupportdNotificationController::ShowDockThunderboltNotification,
IDS_WILCO_NOTIFICATION_DOCK_THUNDERBOLT_TITLE, IDS_WILCO_NOTIFICATION_DOCK_THUNDERBOLT_TITLE,
IDS_WILCO_NOTIFICATION_DOCK_THUNDERBOLT_MESSAGE, IDS_WILCO_NOTIFICATION_DOCK_THUNDERBOLT_MESSAGE,
message_center::DEFAULT_PRIORITY}}; message_center::DEFAULT_PRIORITY},
{&WilcoDtcSupportdNotificationController::ShowLowPowerChargerNotification,
IDS_WILCO_LOW_POWER_CHARGER_TITLE, IDS_WILCO_LOW_POWER_CHARGER_MESSAGE,
message_center::SYSTEM_PRIORITY}};
class WilcoDtcSupportdNotificationControllerTest class WilcoDtcSupportdNotificationControllerTest
: public testing::TestWithParam< : public testing::TestWithParam<
......
...@@ -47,6 +47,8 @@ enum WilcoDtcSupportdEvent { ...@@ -47,6 +47,8 @@ enum WilcoDtcSupportdEvent {
kDockDisplay, kDockDisplay,
// Attached dock will operate in USB Type-C compatible mode. // Attached dock will operate in USB Type-C compatible mode.
kDockThunderbolt, kDockThunderbolt,
// Attached charger does not supply enough power.
kLowPowerCharger,
}; };
// Factory interface exposed by the wilco_dtc_supportd daemon, which allows both // Factory interface exposed by the wilco_dtc_supportd daemon, which allows both
......
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