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

Side by Side Diff: ui/message_center/views/message_popup_collection.h

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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/message_center/views/message_popup_collection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ 5 #ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_
6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ 6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 const NotifierId& notifier_id, 65 const NotifierId& notifier_id,
66 const base::string16& display_source) override; 66 const base::string16& display_source) override;
67 bool HasClickedListener(const std::string& notification_id) override; 67 bool HasClickedListener(const std::string& notification_id) override;
68 void ClickOnNotificationButton(const std::string& notification_id, 68 void ClickOnNotificationButton(const std::string& notification_id,
69 int button_index) override; 69 int button_index) override;
70 void ClickOnSettingsButton(const std::string& notification_id) override; 70 void ClickOnSettingsButton(const std::string& notification_id) override;
71 void UpdateNotificationSize(const std::string& notification_id) override; 71 void UpdateNotificationSize(const std::string& notification_id) override;
72 72
73 void MarkAllPopupsShown(); 73 void MarkAllPopupsShown();
74 74
75 // Inclement the timer counter, and pause the popup timer if necessary.
76 void PausePopupTimers();
77 // Declement the timer counter, and restart the popup timer if necessary.
78 void RestartPopupTimers();
79
75 // Since these events are really coming from individual toast widgets, 80 // Since these events are really coming from individual toast widgets,
76 // it helps to be able to keep track of the sender. 81 // it helps to be able to keep track of the sender.
77 void OnMouseEntered(ToastContentsView* toast_entered); 82 void OnMouseEntered(ToastContentsView* toast_entered);
78 void OnMouseExited(ToastContentsView* toast_exited); 83 void OnMouseExited(ToastContentsView* toast_exited);
79 84
80 // Invoked by toasts when they start/finish their animations. 85 // Invoked by toasts when they start/finish their animations.
81 // While "defer counter" is greater than zero, the popup collection does 86 // While "defer counter" is greater than zero, the popup collection does
82 // not perform updates. It is used to wait for various animations and user 87 // not perform updates. It is used to wait for various animations and user
83 // actions like serial closing of the toasts, when the remaining toasts "flow 88 // actions like serial closing of the toasts, when the remaining toasts "flow
84 // under the mouse". 89 // under the mouse".
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // sequence, w/o moving the mouse. We reposition the toasts so the next one 163 // sequence, w/o moving the mouse. We reposition the toasts so the next one
159 // happens to be right under the mouse, and the user can just dispose of 164 // happens to be right under the mouse, and the user can just dispose of
160 // multipel toasts by clicking. The mode ends when defer_timer_ expires. 165 // multipel toasts by clicking. The mode ends when defer_timer_ expires.
161 bool user_is_closing_toasts_by_clicking_; 166 bool user_is_closing_toasts_by_clicking_;
162 std::unique_ptr<base::OneShotTimer> defer_timer_; 167 std::unique_ptr<base::OneShotTimer> defer_timer_;
163 // The top edge to align the position of the next toast during 'close by 168 // The top edge to align the position of the next toast during 'close by
164 // clicking" mode. 169 // clicking" mode.
165 // Only to be used when user_is_closing_toasts_by_clicking_ is true. 170 // Only to be used when user_is_closing_toasts_by_clicking_ is true.
166 int target_top_edge_; 171 int target_top_edge_;
167 172
173 // This is the number of pause request for timer. If it's more than zero, the
174 // timer is paused. If zero, the timer is not paused.
175 int timer_pause_counter_ = 0;
176
168 // Weak, only exists temporarily in tests. 177 // Weak, only exists temporarily in tests.
169 std::unique_ptr<base::RunLoop> run_loop_for_test_; 178 std::unique_ptr<base::RunLoop> run_loop_for_test_;
170 179
171 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_; 180 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_;
172 181
173 // Gives out weak pointers to toast contents views which have an unrelated 182 // Gives out weak pointers to toast contents views which have an unrelated
174 // lifetime. Must remain the last member variable. 183 // lifetime. Must remain the last member variable.
175 base::WeakPtrFactory<MessagePopupCollection> weak_factory_; 184 base::WeakPtrFactory<MessagePopupCollection> weak_factory_;
176 185
177 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection); 186 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection);
178 }; 187 };
179 188
180 } // namespace message_center 189 } // namespace message_center
181 190
182 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ 191 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_
OLDNEW
« no previous file with comments | « no previous file | ui/message_center/views/message_popup_collection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698