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

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: fix 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 // Updates |work_area_| and rearranges the notification toasts if necessary.
83 // This is separated from methods from OnDisplayBoundsChanged(), since
84 // sometimes a work area has to be specified directly. One example is shelf's
85 // auto-hide change. When the shelf in ChromeOS is temporarily shown from auto
86 // hide status, it doesn't change the display's work area but the actual work
87 // area for toasts should be resized.
88 void SetWorkArea(const gfx::Rect& work_area);
89
82 // Overridden from gfx::DislayObserver: 90 // Overridden from gfx::DislayObserver:
83 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE; 91 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE;
84 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; 92 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
85 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; 93 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
86 94
87 private: 95 private:
88 FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest, 96 FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest,
89 ManyPopupNotifications); 97 ManyPopupNotifications);
90 friend class test::MessagePopupCollectionTest; 98 friend class test::MessagePopupCollectionTest;
91 friend class test::MessagePopupCollectionWidgetsTest; 99 friend class test::MessagePopupCollectionWidgetsTest;
(...skipping 29 matching lines...) Expand all
121 ToastContentsView* FindToast(const std::string& notification_id); 129 ToastContentsView* FindToast(const std::string& notification_id);
122 130
123 // While the toasts are animated, avoid updating the collection, to reduce 131 // While the toasts are animated, avoid updating the collection, to reduce
124 // user confusion. Instead, update the collection when all animations are 132 // user confusion. Instead, update the collection when all animations are
125 // done. This method is run when defer counter is zero, may initiate next 133 // done. This method is run when defer counter is zero, may initiate next
126 // update/animation step. 134 // update/animation step.
127 void PerformDeferredTasks(); 135 void PerformDeferredTasks();
128 void OnDeferTimerExpired(); 136 void OnDeferTimerExpired();
129 137
130 // "ForTest" methods. 138 // "ForTest" methods.
131 void SetWorkAreaForTest(const gfx::Rect& work_area);
132 views::Widget* GetWidgetForTest(const std::string& id); 139 views::Widget* GetWidgetForTest(const std::string& id);
133 void RunLoopForTest(); 140 void RunLoopForTest();
134 gfx::Rect GetToastRectAt(size_t index); 141 gfx::Rect GetToastRectAt(size_t index);
135 142
136 gfx::NativeView parent_; 143 gfx::NativeView parent_;
137 MessageCenter* message_center_; 144 MessageCenter* message_center_;
138 MessageCenterTray* tray_; 145 MessageCenterTray* tray_;
139 Toasts toasts_; 146 Toasts toasts_;
140 gfx::Rect work_area_; 147 gfx::Rect work_area_;
141 int64 display_id_; 148 int64 display_id_;
(...skipping 17 matching lines...) Expand all
159 166
160 // Weak, only exists temporarily in tests. 167 // Weak, only exists temporarily in tests.
161 scoped_ptr<base::RunLoop> run_loop_for_test_; 168 scoped_ptr<base::RunLoop> run_loop_for_test_;
162 169
163 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection); 170 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection);
164 }; 171 };
165 172
166 } // namespace message_center 173 } // namespace message_center
167 174
168 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ 175 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_
OLDNEW
« no previous file with comments | « ash/system/web_notification/web_notification_tray.cc ('k') | ui/message_center/views/message_popup_collection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698