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

Unified Diff: ui/message_center/views/message_popup_collection.h

Issue 14139014: Reposition toasts to align the closed one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix timeout Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/message_center/message_center.gyp ('k') | ui/message_center/views/message_popup_collection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..494941c44faf2f1afb4eb5f1b991812b9b64e6d6 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;
@@ -35,6 +40,7 @@ class ToastContentsView;
// 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 +49,49 @@ 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();
+ // 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 views::WidgetObserver:
virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
+ // 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);
};
« no previous file with comments | « ui/message_center/message_center.gyp ('k') | ui/message_center/views/message_popup_collection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698