#ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_
#define UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/message_center/message_center_export.h"
#include "ui/message_center/message_center_observer.h"
#include "ui/message_center/notification_list.h"
#include "ui/message_center/views/message_center_controller.h"
#include "ui/message_center/views/message_view.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/view.h"
namespace gfx {
class MultiAnimation;
}
namespace views {
class Button;
}
namespace message_center {
class MessageCenter;
class MessageCenterBubble;
class NotificationCenterButton;
class MessageCenterButtonBar;
class MessageCenterTray;
class MessageCenterView;
class MessageView;
class MessageViewContextMenuController;
class MessageListView;
class NotificationView;
class NotifierSettingsView;
class MESSAGE_CENTER_EXPORT MessageCenterView : public views::View,
public MessageCenterObserver,
public MessageCenterController,
public gfx::AnimationDelegate {
public:
MessageCenterView(MessageCenter* message_center,
MessageCenterTray* tray,
int max_height,
bool initially_settings_visible,
bool top_down);
virtual ~MessageCenterView();
void SetNotifications(const NotificationList::Notifications& notifications);
void ClearAllNotifications();
void OnAllNotificationsCleared();
size_t NumMessageViewsForTest() const;
void SetSettingsVisible(bool visible);
void OnSettingsChanged();
bool settings_visible() const { return settings_visible_; }
void SetIsClosing(bool is_closing);
protected:
virtual void Layout() OVERRIDE;
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual int GetHeightForWidth(int width) OVERRIDE;
virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE;
virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
virtual void OnNotificationAdded(const std::string& id) OVERRIDE;
virtual void OnNotificationRemoved(const std::string& id,
bool by_user) OVERRIDE;
virtual void OnNotificationUpdated(const std::string& id) OVERRIDE;
virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE;
virtual void RemoveNotification(const std::string& notification_id,
bool by_user) OVERRIDE;
virtual scoped_ptr<ui::MenuModel> CreateMenuModel(
const NotifierId& notifier_id,
const base::string16& display_source) OVERRIDE;
virtual bool HasClickedListener(const std::string& notification_id) OVERRIDE;
virtual void ClickOnNotificationButton(const std::string& notification_id,
int button_index) OVERRIDE;
virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE;
private:
friend class MessageCenterViewTest;
void AddNotificationAt(const Notification& notification, int index);
void NotificationsChanged();
void SetNotificationViewForTest(MessageView* view);
MessageCenter* message_center_;
MessageCenterTray* tray_;
typedef std::map<std::string, NotificationView*> NotificationViewsMap;
NotificationViewsMap notification_views_;
views::ScrollView* scroller_;
scoped_ptr<MessageListView> message_list_view_;
scoped_ptr<views::View> empty_list_view_;
NotifierSettingsView* settings_view_;
MessageCenterButtonBar* button_bar_;
bool top_down_;
bool settings_visible_;
scoped_ptr<gfx::MultiAnimation> settings_transition_animation_;
views::View* source_view_;
int source_height_;
views::View* target_view_;
int target_height_;
bool is_closing_;
scoped_ptr<MessageViewContextMenuController> context_menu_controller_;
DISALLOW_COPY_AND_ASSIGN(MessageCenterView);
};
}
#endif