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

Unified Diff: ui/message_center/popup_timers_controller.cc

Issue 2815093006: Stop notification updates from unpausing toast timers. (Closed)
Patch Set: Created 3 years, 8 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 | « ui/message_center/popup_timer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/popup_timers_controller.cc
diff --git a/ui/message_center/popup_timers_controller.cc b/ui/message_center/popup_timers_controller.cc
index aae50daf81b5d56a6449febf8e4fc49af2f5009e..a967681d1f01048f987d5b91534d20d74ffc7ccf 100644
--- a/ui/message_center/popup_timers_controller.cc
+++ b/ui/message_center/popup_timers_controller.cc
@@ -100,8 +100,20 @@ void PopupTimersController::OnNotificationUpdated(const std::string& id) {
return;
}
+ auto timer = popup_timers_.find(id);
+ // The timer must already have been started and not be running. Relies on
+ // the invariant that |popup_timers_| only contains timers that have been
+ // started.
+ bool was_paused = timer != popup_timers_.end() && !timer->second->IsRunning();
CancelTimer(id);
StartTimer(id, GetTimeoutForNotification(*iter));
+
+ // If a timer was paused before, pause it afterwards as well.
+ // See crbug.com/710298
+ if (was_paused) {
+ auto timer = popup_timers_.find(id);
+ timer->second->Pause();
+ }
}
void PopupTimersController::OnNotificationRemoved(const std::string& id,
« no previous file with comments | « ui/message_center/popup_timer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698