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

Unified Diff: ui/message_center/views/message_popup_collection.cc

Issue 2800923005: Pause close timer of notification while it's active (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/views/message_popup_collection.h ('k') | ui/message_center/views/toast_contents_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/message_popup_collection.cc
diff --git a/ui/message_center/views/message_popup_collection.cc b/ui/message_center/views/message_popup_collection.cc
index c9556d3d712ea70f7e91d9a0a9c0210becf0202f..0a2afc4caa5640e5fbf5418c1365456bc70a6c47 100644
--- a/ui/message_center/views/message_popup_collection.cc
+++ b/ui/message_center/views/message_popup_collection.cc
@@ -138,6 +138,26 @@ void MessagePopupCollection::MarkAllPopupsShown() {
}
}
+void MessagePopupCollection::PausePopupTimers() {
+ DCHECK(timer_pause_counter_ >= 0);
+ if (timer_pause_counter_ <= 0) {
+ message_center_->PausePopupTimers();
+ timer_pause_counter_ = 1;
+ } else {
+ timer_pause_counter_++;
+ }
+}
+
+void MessagePopupCollection::RestartPopupTimers() {
+ DCHECK(timer_pause_counter_ >= 1);
+ if (timer_pause_counter_ <= 1) {
+ message_center_->RestartPopupTimers();
+ timer_pause_counter_ = 0;
+ } else {
+ timer_pause_counter_--;
+ }
+}
+
void MessagePopupCollection::UpdateWidgets() {
if (message_center_->IsMessageCenterVisible()) {
DCHECK_EQ(0u, message_center_->GetPopupNotifications().size());
@@ -229,7 +249,7 @@ void MessagePopupCollection::OnMouseEntered(ToastContentsView* toast_entered) {
// toasts. So we need to keep track of which one is the currently active one.
latest_toast_entered_ = toast_entered;
- message_center_->PausePopupTimers();
+ PausePopupTimers();
if (user_is_closing_toasts_by_clicking_)
defer_timer_->Stop();
@@ -249,7 +269,7 @@ void MessagePopupCollection::OnMouseExited(ToastContentsView* toast_exited) {
this,
&MessagePopupCollection::OnDeferTimerExpired);
} else {
- message_center_->RestartPopupTimers();
+ RestartPopupTimers();
}
}
@@ -412,7 +432,7 @@ void MessagePopupCollection::OnDeferTimerExpired() {
user_is_closing_toasts_by_clicking_ = false;
DecrementDeferCounter();
- message_center_->RestartPopupTimers();
+ RestartPopupTimers();
}
void MessagePopupCollection::OnNotificationUpdated(
« no previous file with comments | « ui/message_center/views/message_popup_collection.h ('k') | ui/message_center/views/toast_contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698