Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6991)

Unified Diff: ash/system/session_length_limit/tray_session_length_limit.cc

Issue 23464044: Prevents session_length_timeout reappearing when it's already dismissed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..60fe3693147980a5fb6910fb6703c3f5dbb72117 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 it's internal state has been
bartfab (slow) 2013/09/09 20:36:30 Nit: s/it's/its/
Jun Mukai 2013/09/09 20:44:25 Done.
+// 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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698