| Index: ash/system/session_length_limit/tray_session_length_limit.cc
|
| diff --git a/ash/system/session_length_limit/tray_session_length_limit.cc b/ash/system/session_length_limit/tray_session_length_limit.cc
|
| index af32635bb9b5f1a1036309c53e79d66030b81ad6..4357b7c1312b5963b6aa46f1375ef55ee7bfe205 100644
|
| --- a/ash/system/session_length_limit/tray_session_length_limit.cc
|
| +++ b/ash/system/session_length_limit/tray_session_length_limit.cc
|
| @@ -76,11 +76,25 @@ base::string16 FormatRemainingSessionTimeNotification(
|
| ui::TimeFormat::TimeDurationLong(remaining_session_time));
|
| }
|
|
|
| +// Creates, or updates the notification for session length timeout with
|
| +// |remaining_time|. |state_changed| is true when its internal state has been
|
| +// changed from another.
|
| void CreateOrUpdateNotification(const base::TimeDelta& remaining_time,
|
| - bool enable_spoken_feedback) {
|
| + bool state_changed) {
|
| + message_center::MessageCenter* message_center =
|
| + message_center::MessageCenter::Get();
|
| +
|
| + // Do not create a new notification if no state has changed. It may happen
|
| + // when the notification is already closed by the user, see crbug.com/285941.
|
| + if (!state_changed &&
|
| + !message_center->HasNotification(kSessionLengthTimeoutNotificationId)) {
|
| + return;
|
| + }
|
| +
|
| ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
|
| message_center::RichNotificationData data;
|
| - data.should_make_spoken_feedback_for_popup_updates = enable_spoken_feedback;
|
| + // Makes the spoken feedback only when the state has been changed.
|
| + data.should_make_spoken_feedback_for_popup_updates = state_changed;
|
| scoped_ptr<Notification> notification(new Notification(
|
| message_center::NOTIFICATION_TYPE_SIMPLE,
|
| kSessionLengthTimeoutNotificationId,
|
|
|