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

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

Issue 19291004: Observes work area change and auto-hide for notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
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 <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // not perform updates. It is used to wait for various animations and user 72 // not perform updates. It is used to wait for various animations and user
73 // actions like serial closing of the toasts, when the remaining toasts "flow 73 // actions like serial closing of the toasts, when the remaining toasts "flow
74 // under the mouse". 74 // under the mouse".
75 void IncrementDeferCounter(); 75 void IncrementDeferCounter();
76 void DecrementDeferCounter(); 76 void DecrementDeferCounter();
77 77
78 // Runs the next step in update/animate sequence, if the defer counter is not 78 // Runs the next step in update/animate sequence, if the defer counter is not
79 // zero. Otherwise, simply waits when it becomes zero. 79 // zero. Otherwise, simply waits when it becomes zero.
80 void DoUpdateIfPossible(); 80 void DoUpdateIfPossible();
81 81
82 void SetWorkArea(const gfx::Rect& work_area);
dewittj 2013/07/16 21:31:33 Comment here
Jun Mukai 2013/07/16 22:49:42 Done.
83
82 // Overridden from gfx::DislayObserver: 84 // Overridden from gfx::DislayObserver:
83 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE; 85 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE;
84 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; 86 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
85 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; 87 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
86 88
87 private: 89 private:
88 FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest, 90 FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest,
89 ManyPopupNotifications); 91 ManyPopupNotifications);
90 friend class test::MessagePopupCollectionTest; 92 friend class test::MessagePopupCollectionTest;
91 friend class test::MessagePopupCollectionWidgetsTest; 93 friend class test::MessagePopupCollectionWidgetsTest;
(...skipping 29 matching lines...) Expand all
121 ToastContentsView* FindToast(const std::string& notification_id); 123 ToastContentsView* FindToast(const std::string& notification_id);
122 124
123 // While the toasts are animated, avoid updating the collection, to reduce 125 // While the toasts are animated, avoid updating the collection, to reduce
124 // user confusion. Instead, update the collection when all animations are 126 // user confusion. Instead, update the collection when all animations are
125 // done. This method is run when defer counter is zero, may initiate next 127 // done. This method is run when defer counter is zero, may initiate next
126 // update/animation step. 128 // update/animation step.
127 void PerformDeferredTasks(); 129 void PerformDeferredTasks();
128 void OnDeferTimerExpired(); 130 void OnDeferTimerExpired();
129 131
130 // "ForTest" methods. 132 // "ForTest" methods.
131 void SetWorkAreaForTest(const gfx::Rect& work_area);
132 views::Widget* GetWidgetForTest(const std::string& id); 133 views::Widget* GetWidgetForTest(const std::string& id);
133 void RunLoopForTest(); 134 void RunLoopForTest();
134 gfx::Rect GetToastRectAt(size_t index); 135 gfx::Rect GetToastRectAt(size_t index);
135 136
136 gfx::NativeView parent_; 137 gfx::NativeView parent_;
137 MessageCenter* message_center_; 138 MessageCenter* message_center_;
138 MessageCenterTray* tray_; 139 MessageCenterTray* tray_;
139 Toasts toasts_; 140 Toasts toasts_;
140 gfx::Rect work_area_; 141 gfx::Rect work_area_;
141 int64 display_id_; 142 int64 display_id_;
(...skipping 17 matching lines...) Expand all
159 160
160 // Weak, only exists temporarily in tests. 161 // Weak, only exists temporarily in tests.
161 scoped_ptr<base::RunLoop> run_loop_for_test_; 162 scoped_ptr<base::RunLoop> run_loop_for_test_;
162 163
163 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection); 164 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection);
164 }; 165 };
165 166
166 } // namespace message_center 167 } // namespace message_center
167 168
168 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ 169 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698