Commit 08867bcc authored by Roman Aleksandrov's avatar Roman Aleksandrov Committed by Commit Bot

Relaunch Notification: Change text of notifications

Change the way the Recommended notification is updated on the ChromeOS
to adjust to text changes. Text of the Recommended notification
reflects whether the Recommended deadline was already passed or not.

Bug: 963883
Change-Id: If4fa74f8ebb7b606b96fcc18af7030493665a1e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1622848Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Commit-Queue: Roman Aleksandrov <raleksandrov@google.com>
Cr-Commit-Position: refs/heads/master@{#663115}
parent 131ac25d
......@@ -214,6 +214,45 @@
Try again
</message>
<!-- Upgrade notifications -->
<message name="IDS_RELAUNCH_REQUIRED_TITLE_DAYS" desc="The title of a dialog that tells users the device must be restarted within two or more days.">
{0, plural,
=1 {Update within a day}
other {Update within # days}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_HOURS" desc="The title of a dialog that tells users the device must be restarted within one or more hours.">
{0, plural,
=1 {Update within an hour}
other {Update within # hours}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_MINUTES" desc="The title of a dialog that tells users the device must be restarted within one or more minutes.">
{0, plural,
=1 {Update within 1 minute}
other {Update within # minutes}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_SECONDS" desc="The title of a dialog that tells users the device must be restarted within some number of seconds.">
{0, plural,
=0 {Update now}
=1 {Update within 1 second}
other {Update within # seconds}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_BODY" desc="The body text of a dialog that tells users the device must be restarted.">
Your company or organization requires an update to this device
</message>
<message name="IDS_RELAUNCH_RECOMMENDED_TITLE" desc="The title of a dialog that tells users that a device restart is recommended for an update.">
Update available
</message>
<message name="IDS_RELAUNCH_RECOMMENDED_OVERDUE_TITLE" desc="The title of a dialog that tells users that a device restart had been recommended for an update.">
Update overdue
</message>
<message name="IDS_RELAUNCH_RECOMMENDED_BODY" desc="The body text of a dialog that tells users the device must be restarted.">
Your company or organization asks that you update this device
</message>
<message name="IDS_RELAUNCH_RECOMMENDED_OVERDUE_BODY" desc="The body text of a dialog that tells users the device must be restarted right now.">
Your company or organization requires an update to this device right away
</message>
<!-- Chrome OS Strings -->
<message name="IDS_ECHO_CONSENT_DIALOG_TEXT" desc="Dialog text shown when user is asked to give consent to proceed with redeeming an ECHO offer.">
<ph name="SERVICE_NAME">$1<ex>Google Drive</ex></ph> wants to check if you are using an eligible Chrome OS device.
......
......@@ -1214,76 +1214,39 @@ Please check your email at <ph name="ACCOUNT_EMAIL">$2<ex>jane.doe@example.com</
<!-- Relaunch notification bubble and dialog. -->
<if expr="not is_android">
<if expr="not chromeos">
<then>
<message name="IDS_RELAUNCH_RECOMMENDED_TITLE" desc="The title of a dialog that tells users that a browser relaunch is recommended for an update available for some number of days.">
{0, plural,
=0 {A Chromium update is available}
=1 {A Chromium update is available}
other {A Chromium update has been available for # days}}
</message>
<message name="IDS_RELAUNCH_RECOMMENDED_BODY" desc="The body text of a dialog that tells users that a browser relaunch is recommended for an update.">
Your administrator asks that you relaunch Chromium to apply this update
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_DAYS" desc="The title of a dialog that tells users the browser must be relaunched within two or more days.">
{0, plural,
=1 {Relaunch Chromium within a day}
other {Relaunch Chromium within # days}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_HOURS" desc="The title of a dialog that tells users the browser must be relaunched within one or more hours.">
{0, plural,
=1 {Chromium will relaunch in an hour}
other {Chromium will relaunch in # hours}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_MINUTES" desc="The title of a dialog that tells users the browser must be relaunched within one or more minutes.">
{0, plural,
=1 {Chromium will relaunch in 1 minute}
other {Chromium will relaunch in # minutes}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_SECONDS" desc="The title of a dialog that tells users the browser must be relaunched within some number of seconds.">
{0, plural,
=0 {Chromium will relaunch now}
=1 {Chromium will relaunch in 1 second}
other {Chromium will relaunch in # seconds}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_BODY" desc="The body text of a dialog that tells users the browser must be relaunched.">
Your administrator requires that you relaunch Chromium to apply an update
</message>
</then>
<else>
<message name="IDS_RELAUNCH_RECOMMENDED_TITLE" desc="The title of a dialog that tells users that a device restart is recommended for an update available for some number of days.">
{0, plural,
=0 {A Chromium OS update is available}
=1 {A Chromium OS update is available}
other {A Chromium OS update has been available for # days}}
</message>
<message name="IDS_RELAUNCH_RECOMMENDED_BODY" desc="The body text of a dialog that tells users that a device restart is recommended for an update.">
Your administrator asks that you restart Chromium OS to apply this update
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_DAYS" desc="The title of a dialog that tells users the device must be restarted within two or more days.">
{0, plural,
=1 {Restart Chromium OS within a day}
other {Restart Chromium OS within # days}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_HOURS" desc="The title of a dialog that tells users the device must be restarted within one or more hours.">
{0, plural,
=1 {Chromium OS will restart in an hour}
other {Chromium OS will restart in # hours}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_MINUTES" desc="The title of a dialog that tells users the device must be restarted within one or more minutes.">
{0, plural,
=1 {Chromium OS will restart in 1 minute}
other {Chromium OS will restart in # minutes}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_SECONDS" desc="The title of a dialog that tells users the device must be restarted within some number of seconds.">
{0, plural,
=0 {Chromium OS will restart now}
=1 {Chromium OS will restart in 1 second}
other {Chromium OS will restart in # seconds}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_BODY" desc="The body text of a dialog that tells users the device must be restarted.">
Your administrator requires that you restart Chromium OS to apply an update
</message>
</else>
<message name="IDS_RELAUNCH_RECOMMENDED_TITLE" desc="The title of a dialog that tells users that a browser relaunch is recommended for an update available for some number of days.">
{0, plural,
=0 {A Chromium update is available}
=1 {A Chromium update is available}
other {A Chromium update has been available for # days}}
</message>
<message name="IDS_RELAUNCH_RECOMMENDED_BODY" desc="The body text of a dialog that tells users that a browser relaunch is recommended for an update.">
Your administrator asks that you relaunch Chromium to apply this update
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_DAYS" desc="The title of a dialog that tells users the browser must be relaunched within two or more days.">
{0, plural,
=1 {Relaunch Chromium within a day}
other {Relaunch Chromium within # days}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_HOURS" desc="The title of a dialog that tells users the browser must be relaunched within one or more hours.">
{0, plural,
=1 {Chromium will relaunch in an hour}
other {Chromium will relaunch in # hours}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_MINUTES" desc="The title of a dialog that tells users the browser must be relaunched within one or more minutes.">
{0, plural,
=1 {Chromium will relaunch in 1 minute}
other {Chromium will relaunch in # minutes}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_SECONDS" desc="The title of a dialog that tells users the browser must be relaunched within some number of seconds.">
{0, plural,
=0 {Chromium will relaunch now}
=1 {Chromium will relaunch in 1 second}
other {Chromium will relaunch in # seconds}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_BODY" desc="The body text of a dialog that tells users the browser must be relaunched.">
Your administrator requires that you relaunch Chromium to apply an update
</message>
</if>
</if>
<!-- Chromium launch blocking dialog. -->
......
......@@ -1233,76 +1233,39 @@ Please check your email at <ph name="ACCOUNT_EMAIL">$2<ex>jane.doe@example.com</
<!-- Relaunch notification bubble and dialog. -->
<if expr="not is_android">
<if expr="not chromeos">
<then>
<message name="IDS_RELAUNCH_RECOMMENDED_TITLE" desc="The title of a dialog that tells users that a browser relaunch is recommended for an update available for some number of days.">
{0, plural,
=0 {A Chrome update is available}
=1 {A Chrome update is available}
other {A Chrome update has been available for # days}}
</message>
<message name="IDS_RELAUNCH_RECOMMENDED_BODY" desc="The body text of a dialog that tells users that a browser relaunch is recommended for an update.">
Your administrator asks that you relaunch Chrome to apply this update
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_DAYS" desc="The title of a dialog that tells users the browser must be relaunched within two or more days.">
{0, plural,
=1 {Relaunch Chrome within a day}
other {Relaunch Chrome within # days}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_HOURS" desc="The title of a dialog that tells users the browser must be relaunched within one or more hours.">
{0, plural,
=1 {Chrome will relaunch in an hour}
other {Chrome will relaunch in # hours}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_MINUTES" desc="The title of a dialog that tells users the browser must be relaunched within one or more minutes.">
{0, plural,
=1 {Chrome will relaunch in 1 minute}
other {Chrome will relaunch in # minutes}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_SECONDS" desc="The title of a dialog that tells users the browser must be relaunched within some number of seconds.">
{0, plural,
=0 {Chrome will relaunch now}
=1 {Chrome will relaunch in 1 second}
other {Chrome will relaunch in # seconds}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_BODY" desc="The body text of a dialog that tells users the browser must be relaunched.">
Your administrator requires that you relaunch Chrome to apply an update
</message>
</then>
<else>
<message name="IDS_RELAUNCH_RECOMMENDED_TITLE" desc="The title of a dialog that tells users that a device restart is recommended for an update available for some number of days.">
{0, plural,
=0 {A Chrome OS update is available}
=1 {A Chrome OS update is available}
other {A Chrome OS update has been available for # days}}
</message>
<message name="IDS_RELAUNCH_RECOMMENDED_BODY" desc="The body text of a dialog that tells users that a device restart is recommended for an update.">
Your administrator asks that you restart Chrome OS to apply this update
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_DAYS" desc="The title of a dialog that tells users the device must be restarted within two or more days.">
{0, plural,
=1 {Restart Chrome OS within a day}
other {Restart Chrome OS within # days}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_HOURS" desc="The title of a dialog that tells users the device must be restarted within one or more hours.">
{0, plural,
=1 {Chrome OS will restart in an hour}
other {Chrome OS will restart in # hours}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_MINUTES" desc="The title of a dialog that tells users the device must be restarted within one or more minutes.">
{0, plural,
=1 {Chrome OS will restart in 1 minute}
other {Chrome OS will restart in # minutes}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_SECONDS" desc="The title of a dialog that tells users the device must be restarted within some number of seconds.">
{0, plural,
=0 {Chrome OS will restart now}
=1 {Chrome OS will restart in 1 second}
other {Chrome OS will restart in # seconds}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_BODY" desc="The body text of a dialog that tells users the device must be restarted.">
Your administrator requires that you restart Chrome OS to apply an update
</message>
</else>
<message name="IDS_RELAUNCH_RECOMMENDED_TITLE" desc="The title of a dialog that tells users that a browser relaunch is recommended for an update available for some number of days.">
{0, plural,
=0 {A Chrome update is available}
=1 {A Chrome update is available}
other {A Chrome update has been available for # days}}
</message>
<message name="IDS_RELAUNCH_RECOMMENDED_BODY" desc="The body text of a dialog that tells users that a browser relaunch is recommended for an update.">
Your administrator asks that you relaunch Chrome to apply this update
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_DAYS" desc="The title of a dialog that tells users the browser must be relaunched within two or more days.">
{0, plural,
=1 {Relaunch Chrome within a day}
other {Relaunch Chrome within # days}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_HOURS" desc="The title of a dialog that tells users the browser must be relaunched within one or more hours.">
{0, plural,
=1 {Chrome will relaunch in an hour}
other {Chrome will relaunch in # hours}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_MINUTES" desc="The title of a dialog that tells users the browser must be relaunched within one or more minutes.">
{0, plural,
=1 {Chrome will relaunch in 1 minute}
other {Chrome will relaunch in # minutes}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_TITLE_SECONDS" desc="The title of a dialog that tells users the browser must be relaunched within some number of seconds.">
{0, plural,
=0 {Chrome will relaunch now}
=1 {Chrome will relaunch in 1 second}
other {Chrome will relaunch in # seconds}}
</message>
<message name="IDS_RELAUNCH_REQUIRED_BODY" desc="The body text of a dialog that tells users the browser must be relaunched.">
Your administrator requires that you relaunch Chrome to apply an update
</message>
</if>
</if>
......
......@@ -188,8 +188,10 @@ void RelaunchNotificationController::ShowRelaunchNotification(
if (last_notification_style_ == NotificationStyle::kRecommended) {
// Show the dialog if there has been a level change.
if (level != last_level_)
NotifyRelaunchRecommended();
if (level != last_level_) {
NotifyRelaunchRecommended(level ==
UpgradeDetector::UPGRADE_ANNOYANCE_HIGH);
}
// If this is the final showing (the one at the "high" level), start the
// timer to reshow the bubble at each "elevated to high" interval.
......@@ -271,18 +273,20 @@ void RelaunchNotificationController::StartReshowTimer() {
void RelaunchNotificationController::OnReshowRelaunchRecommended() {
DCHECK_EQ(last_notification_style_, NotificationStyle::kRecommended);
NotifyRelaunchRecommended();
NotifyRelaunchRecommended(true);
StartReshowTimer();
}
void RelaunchNotificationController::NotifyRelaunchRecommended() {
void RelaunchNotificationController::NotifyRelaunchRecommended(
bool past_deadline) {
last_relaunch_notification_time_ = clock_->Now();
DoNotifyRelaunchRecommended();
DoNotifyRelaunchRecommended(past_deadline);
}
void RelaunchNotificationController::DoNotifyRelaunchRecommended() {
void RelaunchNotificationController::DoNotifyRelaunchRecommended(
bool past_deadline) {
platform_impl_.NotifyRelaunchRecommended(
upgrade_detector_->upgrade_detected_time());
upgrade_detector_->upgrade_detected_time(), past_deadline);
}
void RelaunchNotificationController::NotifyRelaunchRequired() {
......
......@@ -118,8 +118,9 @@ class RelaunchNotificationController : public UpgradeObserver {
base::Time high_deadline);
// Update |last_relaunch_notification_time_| before calling
// DoNotifyRelaunchRecommended.
void NotifyRelaunchRecommended();
// DoNotifyRelaunchRecommended. |past_deadline| reflects whether the
// Recommended deadline was already passed or not.
void NotifyRelaunchRecommended(bool past_deadline);
// Provide deadline to DoNotifyRelaunchRequired.
virtual void NotifyRelaunchRequired();
......@@ -128,7 +129,9 @@ class RelaunchNotificationController : public UpgradeObserver {
// notifications, are virtual for the sake of testing.
// Shows the relaunch recommended notification if it is not already open.
virtual void DoNotifyRelaunchRecommended();
// |past_deadline| reflects whether the Recommended deadline was already
// passed or not.
virtual void DoNotifyRelaunchRecommended(bool past_deadline);
// Shows the relaunch required notification if it is not already open.
virtual void DoNotifyRelaunchRequired(base::Time deadline);
......
......@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "chrome/browser/ui/ash/system_tray_client.h"
#include "chrome/browser/ui/views/relaunch_notification/relaunch_notification_metrics.h"
#include "chrome/browser/ui/views/relaunch_notification/relaunch_recommended_timer.h"
#include "chrome/browser/ui/views/relaunch_notification/relaunch_required_timer.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
......@@ -20,19 +19,18 @@ RelaunchNotificationControllerPlatformImpl::
~RelaunchNotificationControllerPlatformImpl() = default;
void RelaunchNotificationControllerPlatformImpl::NotifyRelaunchRecommended(
base::Time detection_time) {
if (!relaunch_recommended_timer_) {
relaunch_recommended_timer_ = std::make_unique<RelaunchRecommendedTimer>(
detection_time,
base::BindRepeating(&RelaunchNotificationControllerPlatformImpl::
RefreshRelaunchRecommendedTitle,
base::Unretained(this)));
base::Time /*detection_time*/,
bool past_deadline) {
RecordRecommendedShowResult();
RefreshRelaunchRecommendedTitle(past_deadline);
}
void RelaunchNotificationControllerPlatformImpl::RecordRecommendedShowResult() {
if (!recorded_shown_) {
relaunch_notification::RecordRecommendedShowResult(
relaunch_notification::ShowResult::kShown);
recorded_shown_ = true;
}
RefreshRelaunchRecommendedTitle();
}
void RelaunchNotificationControllerPlatformImpl::NotifyRelaunchRequired(
......@@ -55,8 +53,7 @@ void RelaunchNotificationControllerPlatformImpl::CloseRelaunchNotification() {
SystemTrayClient::Get()->SetUpdateNotificationState(
ash::mojom::NotificationStyle::DEFAULT, base::string16(),
base::string16());
relaunch_recommended_timer_.reset();
recorded_shown_ = false;
relaunch_required_timer_.reset();
}
......@@ -66,11 +63,18 @@ void RelaunchNotificationControllerPlatformImpl::SetDeadline(
}
void RelaunchNotificationControllerPlatformImpl::
RefreshRelaunchRecommendedTitle() {
SystemTrayClient::Get()->SetUpdateNotificationState(
ash::mojom::NotificationStyle::ADMIN_RECOMMENDED,
relaunch_recommended_timer_->GetWindowTitle(),
l10n_util::GetStringUTF16(IDS_RELAUNCH_RECOMMENDED_BODY));
RefreshRelaunchRecommendedTitle(bool past_deadline) {
if (past_deadline) {
SystemTrayClient::Get()->SetUpdateNotificationState(
ash::mojom::NotificationStyle::ADMIN_RECOMMENDED,
l10n_util::GetStringUTF16(IDS_RELAUNCH_RECOMMENDED_OVERDUE_TITLE),
l10n_util::GetStringUTF16(IDS_RELAUNCH_RECOMMENDED_OVERDUE_BODY));
} else {
SystemTrayClient::Get()->SetUpdateNotificationState(
ash::mojom::NotificationStyle::ADMIN_RECOMMENDED,
l10n_util::GetStringUTF16(IDS_RELAUNCH_RECOMMENDED_TITLE),
l10n_util::GetStringUTF16(IDS_RELAUNCH_RECOMMENDED_BODY));
}
}
void RelaunchNotificationControllerPlatformImpl::
......
......@@ -9,7 +9,6 @@
#include "base/time/time.h"
class RelaunchRecommendedTimer;
class RelaunchRequiredTimer;
class RelaunchNotificationControllerPlatformImpl {
......@@ -19,7 +18,7 @@ class RelaunchNotificationControllerPlatformImpl {
~RelaunchNotificationControllerPlatformImpl();
// Shows the relaunch recommended notification if it is not already open.
void NotifyRelaunchRecommended(base::Time detection_time);
void NotifyRelaunchRecommended(base::Time detection_time, bool past_deadline);
// Shows the relaunch required notification if it is not already open.
void NotifyRelaunchRequired(base::Time deadline);
......@@ -37,20 +36,22 @@ class RelaunchNotificationControllerPlatformImpl {
private:
// Callback triggered whenever the recommended notification's title has to
// refresh.
void RefreshRelaunchRecommendedTitle();
void RefreshRelaunchRecommendedTitle(bool past_deadline);
// Ensure show recording only once.
void RecordRecommendedShowResult();
// Callback triggered whenever the required notification's title has to
// refresh.
void RefreshRelaunchRequiredTitle();
// Timer that takes care of the string refresh in the relaunch recommended
// notification title.
std::unique_ptr<RelaunchRecommendedTimer> relaunch_recommended_timer_;
// Timer that takes care of the string refresh in the relaunch required
// notification title.
std::unique_ptr<RelaunchRequiredTimer> relaunch_required_timer_;
// Indicate that show of the Recommended notification was already recorded.
bool recorded_shown_ = false;
DISALLOW_COPY_AND_ASSIGN(RelaunchNotificationControllerPlatformImpl);
};
......
......@@ -52,7 +52,8 @@ RelaunchNotificationControllerPlatformImpl::
RelaunchNotificationControllerPlatformImpl() = default;
void RelaunchNotificationControllerPlatformImpl::NotifyRelaunchRecommended(
base::Time detection_time) {
base::Time detection_time,
bool /*past_deadline*/) {
// Nothing to do if the bubble is visible.
if (widget_)
return;
......
......@@ -19,7 +19,7 @@ class RelaunchNotificationControllerPlatformImpl
RelaunchNotificationControllerPlatformImpl();
// Shows the relaunch recommended notification if it is not already open.
void NotifyRelaunchRecommended(base::Time detection_time);
void NotifyRelaunchRecommended(base::Time detection_time, bool past_deadline);
// Shows the relaunch required notification if it is not already open.
void NotifyRelaunchRequired(base::Time deadline);
......
......@@ -52,7 +52,7 @@ class FakeRelaunchNotificationController
using RelaunchNotificationController::kRelaunchGracePeriod;
private:
void DoNotifyRelaunchRecommended() override {
void DoNotifyRelaunchRecommended(bool /*past_deadline*/) override {
delegate_->NotifyRelaunchRecommended();
}
......
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