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

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

Issue 2554903003: Add unittest for MessageListView (Closed)
Patch Set: fixed the build failrue on win Created 4 years 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/views/message_center_view.cc ('k') | ui/message_center/views/message_list_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/message_list_view.h
diff --git a/ui/message_center/views/message_list_view.h b/ui/message_center/views/message_list_view.h
index 0f381d3a5ff23c0364ea0550a865975eef5813d3..ee3564df76b53d4a4504bfa53472499a09b7f39a 100644
--- a/ui/message_center/views/message_list_view.h
+++ b/ui/message_center/views/message_list_view.h
@@ -24,17 +24,21 @@ class Layer;
namespace message_center {
-class MessageCenterView;
class MessageView;
// Displays a list of messages for rich notifications. Functions as an array of
// MessageViews and animates them on transitions. It also supports
// repositioning.
-class MessageListView : public views::View,
- public views::BoundsAnimatorObserver {
+class MESSAGE_CENTER_EXPORT MessageListView
+ : public views::View,
+ public views::BoundsAnimatorObserver {
public:
- explicit MessageListView(MessageCenterView* message_center_view,
- bool top_down);
+ class Observer {
+ public:
+ virtual void OnAllNotificationsCleared() = 0;
+ };
+
+ explicit MessageListView(bool top_down);
~MessageListView() override;
void AddNotificationAt(MessageView* view, int i);
@@ -44,7 +48,10 @@ class MessageListView : public views::View,
void ResetRepositionSession();
void ClearAllClosableNotifications(const gfx::Rect& visible_scroll_rect);
- MESSAGE_CENTER_EXPORT void SetRepositionTargetForTest(
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ void SetRepositionTargetForTest(
const gfx::Rect& target_rect);
protected:
@@ -61,6 +68,7 @@ class MessageListView : public views::View,
private:
friend class MessageCenterViewTest;
+ friend class MessageListViewTest;
bool IsValidChild(const views::View* child) const;
void DoUpdateIfPossible();
@@ -81,11 +89,10 @@ class MessageListView : public views::View,
// Animate clearing one notification.
void AnimateClearingOneNotification();
- MessageCenterView* message_center_view() const {
- return message_center_view_;
- }
- MessageCenterView* message_center_view_; // Weak reference.
+ // List of MessageListView::Observer
+ base::ObserverList<Observer> observers_;
+
// The top position of the reposition target rectangle.
int reposition_top_;
int fixed_height_;
@@ -107,4 +114,5 @@ class MessageListView : public views::View,
};
} // namespace message_center
+
#endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_LIST_VIEW_H_
« no previous file with comments | « ui/message_center/views/message_center_view.cc ('k') | ui/message_center/views/message_list_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698