| Index: ui/message_center/views/message_popup_collection.h
|
| diff --git a/ui/message_center/views/message_popup_collection.h b/ui/message_center/views/message_popup_collection.h
|
| index 6a8d10a021473139d26562d7f77c22b4b58e85f1..15f16b264e9fa90349bc539841a7553de9ca3eaa 100644
|
| --- a/ui/message_center/views/message_popup_collection.h
|
| +++ b/ui/message_center/views/message_popup_collection.h
|
| @@ -12,7 +12,9 @@
|
| #include "base/gtest_prod_util.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "ui/gfx/native_widget_types.h"
|
| +#include "ui/gfx/rect.h"
|
| #include "ui/message_center/message_center_export.h"
|
| +#include "ui/message_center/message_center_observer.h"
|
| #include "ui/views/widget/widget_observer.h"
|
|
|
| namespace views {
|
| @@ -24,6 +26,9 @@ FORWARD_DECLARE_TEST(WebNotificationTrayTest, ManyPopupNotifications);
|
| }
|
|
|
| namespace message_center {
|
| +namespace test {
|
| +class MessagePopupCollectionTest;
|
| +}
|
|
|
| class MessageCenter;
|
| class ToastContentsView;
|
| @@ -34,7 +39,7 @@ class ToastContentsView;
|
| // contents of each toast are for the message center and layout strategy would
|
| // be slightly different.
|
| class MESSAGE_CENTER_EXPORT MessagePopupCollection
|
| - : public views::WidgetObserver,
|
| + : public MessageCenterObserver,
|
| public base::SupportsWeakPtr<MessagePopupCollection> {
|
| public:
|
| // |parent| specifies the parent widget of the toast windows. The default
|
| @@ -43,24 +48,46 @@ class MESSAGE_CENTER_EXPORT MessagePopupCollection
|
| MessageCenter* message_center);
|
| virtual ~MessagePopupCollection();
|
|
|
| - void UpdatePopups();
|
| -
|
| void OnMouseEntered();
|
| void OnMouseExited();
|
|
|
| private:
|
| FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest,
|
| ManyPopupNotifications);
|
| + friend class test::MessagePopupCollectionTest;
|
| typedef std::map<std::string, ToastContentsView*> ToastContainer;
|
|
|
| void CloseAllWidgets();
|
|
|
| - // Overridden from views::WidgetObserver:
|
| - virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
|
| + // Returns the bottom-right position of the current work area.
|
| + gfx::Point GetWorkAreaBottomRight();
|
| +
|
| + // Creates new widgets for new toast notifications, and updates |toasts_| and
|
| + // |widgets_| correctly.
|
| + void UpdateWidgets();
|
| +
|
| + // Repositions all of the widgets based on the current work area.
|
| + void RepositionWidgets();
|
| +
|
| + // Repositions widgets. |target_rrect| denotes the region of the notification
|
| + // recently removed, and this attempts to slide widgets so that the user can
|
| + // click close-button without mouse moves. See crbug.com/224089
|
| + void RepositionWidgetsWithTarget(const gfx::Rect& target_rect);
|
| +
|
| + // Overridden from MessageCenterObserver:
|
| + virtual void OnNotificationAdded(const std::string& notification_id) OVERRIDE;
|
| + virtual void OnNotificationRemoved(const std::string& notification_id,
|
| + bool by_user) OVERRIDE;
|
| + virtual void OnNotificationUpdated(
|
| + const std::string& notification_id) OVERRIDE;
|
| +
|
| + void SetWorkAreaForTest(const gfx::Rect& work_area);
|
|
|
| gfx::NativeView parent_;
|
| MessageCenter* message_center_;
|
| ToastContainer toasts_;
|
| + std::list<views::Widget*> widgets_;
|
| + gfx::Rect work_area_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection);
|
| };
|
|
|