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

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

Issue 2788673004: 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
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 void PausePopupTimers();
76 void RestartPopupTimers();
77
75 // Since these events are really coming from individual toast widgets, 78 // Since these events are really coming from individual toast widgets,
76 // it helps to be able to keep track of the sender. 79 // it helps to be able to keep track of the sender.
77 void OnMouseEntered(ToastContentsView* toast_entered); 80 void OnMouseEntered(ToastContentsView* toast_entered);
78 void OnMouseExited(ToastContentsView* toast_exited); 81 void OnMouseExited(ToastContentsView* toast_exited);
79 82
80 // Invoked by toasts when they start/finish their animations. 83 // Invoked by toasts when they start/finish their animations.
81 // While "defer counter" is greater than zero, the popup collection does 84 // 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 85 // 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 86 // actions like serial closing of the toasts, when the remaining toasts "flow
84 // under the mouse". 87 // 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 161 // 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 162 // 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. 163 // multipel toasts by clicking. The mode ends when defer_timer_ expires.
161 bool user_is_closing_toasts_by_clicking_; 164 bool user_is_closing_toasts_by_clicking_;
162 std::unique_ptr<base::OneShotTimer> defer_timer_; 165 std::unique_ptr<base::OneShotTimer> defer_timer_;
163 // The top edge to align the position of the next toast during 'close by 166 // The top edge to align the position of the next toast during 'close by
164 // clicking" mode. 167 // clicking" mode.
165 // Only to be used when user_is_closing_toasts_by_clicking_ is true. 168 // Only to be used when user_is_closing_toasts_by_clicking_ is true.
166 int target_top_edge_; 169 int target_top_edge_;
167 170
171 int timer_pause_counter_ = 0;
yhanada 2017/04/04 04:24:09 It's great to add comment about what this variable
yoshiki 2017/04/04 04:58:27 Done.
172
168 // Weak, only exists temporarily in tests. 173 // Weak, only exists temporarily in tests.
169 std::unique_ptr<base::RunLoop> run_loop_for_test_; 174 std::unique_ptr<base::RunLoop> run_loop_for_test_;
170 175
171 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_; 176 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_;
172 177
173 // Gives out weak pointers to toast contents views which have an unrelated 178 // Gives out weak pointers to toast contents views which have an unrelated
174 // lifetime. Must remain the last member variable. 179 // lifetime. Must remain the last member variable.
175 base::WeakPtrFactory<MessagePopupCollection> weak_factory_; 180 base::WeakPtrFactory<MessagePopupCollection> weak_factory_;
176 181
177 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection); 182 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection);
178 }; 183 };
179 184
180 } // namespace message_center 185 } // namespace message_center
181 186
182 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ 187 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698