Commit ecf17887 authored by dewittj's avatar dewittj Committed by Commit bot

Pull MessageListView into its own file for easier testing.

Tests will appear in a future CL.

BUG=NONE

Review URL: https://codereview.chromium.org/961993007

Cr-Commit-Position: refs/heads/master@{#327308}
parent 7470d4c0
...@@ -94,6 +94,8 @@ component("message_center") { ...@@ -94,6 +94,8 @@ component("message_center") {
"views/message_center_controller.h", "views/message_center_controller.h",
"views/message_center_view.cc", "views/message_center_view.cc",
"views/message_center_view.h", "views/message_center_view.h",
"views/message_list_view.cc",
"views/message_list_view.h",
"views/message_popup_collection.cc", "views/message_popup_collection.cc",
"views/message_popup_collection.h", "views/message_popup_collection.h",
"views/message_view.cc", "views/message_view.cc",
......
...@@ -87,6 +87,8 @@ ...@@ -87,6 +87,8 @@
'views/message_center_controller.h', 'views/message_center_controller.h',
'views/message_center_view.cc', 'views/message_center_view.cc',
'views/message_center_view.h', 'views/message_center_view.h',
'views/message_list_view.cc',
'views/message_list_view.h',
'views/message_popup_collection.cc', 'views/message_popup_collection.cc',
'views/message_popup_collection.h', 'views/message_popup_collection.h',
'views/message_view.cc', 'views/message_view.cc',
......
...@@ -12,33 +12,27 @@ ...@@ -12,33 +12,27 @@
#include "ui/message_center/notification_list.h" #include "ui/message_center/notification_list.h"
#include "ui/message_center/views/message_center_controller.h" #include "ui/message_center/views/message_center_controller.h"
#include "ui/message_center/views/message_view.h" #include "ui/message_center/views/message_view.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/view.h" #include "ui/views/view.h"
namespace gfx { namespace gfx {
class MultiAnimation; class MultiAnimation;
} // namespace gfx } // namespace gfx
namespace views {
class Button;
} // namespace views
namespace message_center { namespace message_center {
class MessageCenter; class MessageCenter;
class MessageCenterBubble;
class NotificationCenterButton;
class MessageCenterButtonBar; class MessageCenterButtonBar;
class MessageCenterTray; class MessageCenterTray;
class MessageCenterView;
class MessageView; class MessageView;
class MessageViewContextMenuController; class MessageViewContextMenuController;
class MessageListView; class MessageListView;
class NotificationView; class NotificationView;
class NotifierSettingsView; class NotifierSettingsView;
// MessageCenterView /////////////////////////////////////////////////////////// // Container for all the top-level views in the notification center, such as the
// button bar, settings view, scrol view, and message list view. Acts as a
// controller for the message list view, passing data back and forth to message
// center.
class MESSAGE_CENTER_EXPORT MessageCenterView : public views::View, class MESSAGE_CENTER_EXPORT MessageCenterView : public views::View,
public MessageCenterObserver, public MessageCenterObserver,
public MessageCenterController, public MessageCenterController,
......
This diff is collapsed.
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_LIST_VIEW_H_
#define UI_MESSAGE_CENTER_VIEWS_MESSAGE_LIST_VIEW_H_
#include <list>
#include <set>
#include "ui/compositor/paint_context.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/message_center/notification.h"
#include "ui/views/animation/bounds_animator_observer.h"
#include "ui/views/view.h"
namespace gfx {
class Canvas;
}
namespace ui {
class Layer;
}
namespace views {
class BoundsAnimator;
}
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 {
public:
explicit MessageListView(MessageCenterView* message_center_view,
bool top_down);
~MessageListView() override;
void AddNotificationAt(MessageView* view, int i);
void RemoveNotification(MessageView* view);
void UpdateNotification(MessageView* view, const Notification& notification);
void SetRepositionTarget(const gfx::Rect& target_rect);
void ResetRepositionSession();
void ClearAllNotifications(const gfx::Rect& visible_scroll_rect);
protected:
// Overridden from views::View.
void Layout() override;
gfx::Size GetPreferredSize() const override;
int GetHeightForWidth(int width) const override;
void PaintChildren(const ui::PaintContext& context) override;
void ReorderChildLayers(ui::Layer* parent_layer) override;
// Overridden from views::BoundsAnimatorObserver.
void OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) override;
void OnBoundsAnimatorDone(views::BoundsAnimator* animator) override;
private:
bool IsValidChild(const views::View* child) const;
void DoUpdateIfPossible();
// Animates all notifications below target upwards to align with the top of
// the last closed notification.
void AnimateNotificationsBelowTarget();
// Animates all notifications above target downwards to align with the top of
// the last closed notification.
void AnimateNotificationsAboveTarget();
// Schedules animation for a child to the specified position. Returns false
// if |child| will disappear after the animation.
bool AnimateChild(views::View* child, int top, int height);
// Animate clearing one notification.
void AnimateClearingOneNotification();
MessageCenterView* message_center_view() const {
return message_center_view_;
}
MessageCenterView* message_center_view_; // Weak reference.
// The top position of the reposition target rectangle.
int reposition_top_;
int fixed_height_;
bool has_deferred_task_;
bool clear_all_started_;
bool top_down_;
std::set<views::View*> adding_views_;
std::set<views::View*> deleting_views_;
std::set<views::View*> deleted_when_done_;
std::list<views::View*> clearing_all_views_;
scoped_ptr<views::BoundsAnimator> animator_;
base::WeakPtrFactory<MessageListView> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(MessageListView);
};
} // namespace message_center
#endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_LIST_VIEW_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment