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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « ui/message_center/popup_timer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/message_center/popup_timers_controller.h" 5 #include "ui/message_center/popup_timers_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "ui/message_center/message_center_style.h" 10 #include "ui/message_center/message_center_style.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 for (; iter != popup_notifications.end(); ++iter) { 93 for (; iter != popup_notifications.end(); ++iter) {
94 if ((*iter)->id() == id) 94 if ((*iter)->id() == id)
95 break; 95 break;
96 } 96 }
97 97
98 if (iter == popup_notifications.end() || (*iter)->never_timeout()) { 98 if (iter == popup_notifications.end() || (*iter)->never_timeout()) {
99 CancelTimer(id); 99 CancelTimer(id);
100 return; 100 return;
101 } 101 }
102 102
103 auto timer = popup_timers_.find(id);
104 // The timer must already have been started and not be running. Relies on
105 // the invariant that |popup_timers_| only contains timers that have been
106 // started.
107 bool was_paused = timer != popup_timers_.end() && !timer->second->IsRunning();
103 CancelTimer(id); 108 CancelTimer(id);
104 StartTimer(id, GetTimeoutForNotification(*iter)); 109 StartTimer(id, GetTimeoutForNotification(*iter));
110
111 // If a timer was paused before, pause it afterwards as well.
112 // See crbug.com/710298
113 if (was_paused) {
114 auto timer = popup_timers_.find(id);
115 timer->second->Pause();
116 }
105 } 117 }
106 118
107 void PopupTimersController::OnNotificationRemoved(const std::string& id, 119 void PopupTimersController::OnNotificationRemoved(const std::string& id,
108 bool by_user) { 120 bool by_user) {
109 CancelTimer(id); 121 CancelTimer(id);
110 } 122 }
111 123
112 } // namespace message_center 124 } // namespace message_center
OLDNEW
« 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