OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ |
6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ |
7 | 7 |
8 #include "ui/views/view.h" | 8 #include "ui/views/view.h" |
9 | 9 |
10 #include "ui/base/animation/animation_delegate.h" | 10 #include "ui/gfx/animation/animation_delegate.h" |
11 #include "ui/message_center/message_center_export.h" | 11 #include "ui/message_center/message_center_export.h" |
12 #include "ui/message_center/message_center_observer.h" | 12 #include "ui/message_center/message_center_observer.h" |
13 #include "ui/message_center/notification_list.h" | 13 #include "ui/message_center/notification_list.h" |
14 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/button.h" |
15 | 15 |
16 namespace ui { | 16 namespace gfx { |
17 class MultiAnimation; | 17 class MultiAnimation; |
18 } // namespace ui | 18 } // namespace gfx |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 class Button; | 21 class Button; |
22 } // namespace views | 22 } // namespace views |
23 | 23 |
24 namespace message_center { | 24 namespace message_center { |
25 | 25 |
26 class MessageCenter; | 26 class MessageCenter; |
27 class MessageCenterBubble; | 27 class MessageCenterBubble; |
28 class NotificationCenterButton; | 28 class NotificationCenterButton; |
29 class MessageCenterButtonBar; | 29 class MessageCenterButtonBar; |
30 class MessageCenterTray; | 30 class MessageCenterTray; |
31 class MessageCenterView; | 31 class MessageCenterView; |
32 class MessageView; | 32 class MessageView; |
33 class MessageListView; | 33 class MessageListView; |
34 class NotifierSettingsView; | 34 class NotifierSettingsView; |
35 | 35 |
36 // MessageCenterView /////////////////////////////////////////////////////////// | 36 // MessageCenterView /////////////////////////////////////////////////////////// |
37 | 37 |
38 class MESSAGE_CENTER_EXPORT MessageCenterView : public views::View, | 38 class MESSAGE_CENTER_EXPORT MessageCenterView : public views::View, |
39 public MessageCenterObserver, | 39 public MessageCenterObserver, |
40 public ui::AnimationDelegate { | 40 public gfx::AnimationDelegate { |
41 public: | 41 public: |
42 MessageCenterView(MessageCenter* message_center, | 42 MessageCenterView(MessageCenter* message_center, |
43 MessageCenterTray* tray, | 43 MessageCenterTray* tray, |
44 int max_height, | 44 int max_height, |
45 bool initially_settings_visible, | 45 bool initially_settings_visible, |
46 bool top_down); | 46 bool top_down); |
47 virtual ~MessageCenterView(); | 47 virtual ~MessageCenterView(); |
48 | 48 |
49 void SetNotifications(const NotificationList::Notifications& notifications); | 49 void SetNotifications(const NotificationList::Notifications& notifications); |
50 | 50 |
(...skipping 15 matching lines...) Expand all Loading... |
66 virtual int GetHeightForWidth(int width) OVERRIDE; | 66 virtual int GetHeightForWidth(int width) OVERRIDE; |
67 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; | 67 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; |
68 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 68 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
69 | 69 |
70 // Overridden from MessageCenterObserver: | 70 // Overridden from MessageCenterObserver: |
71 virtual void OnNotificationAdded(const std::string& id) OVERRIDE; | 71 virtual void OnNotificationAdded(const std::string& id) OVERRIDE; |
72 virtual void OnNotificationRemoved(const std::string& id, | 72 virtual void OnNotificationRemoved(const std::string& id, |
73 bool by_user) OVERRIDE; | 73 bool by_user) OVERRIDE; |
74 virtual void OnNotificationUpdated(const std::string& id) OVERRIDE; | 74 virtual void OnNotificationUpdated(const std::string& id) OVERRIDE; |
75 | 75 |
76 // Overridden from ui::AnimationDelegate: | 76 // Overridden from gfx::AnimationDelegate: |
77 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 77 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |
78 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 78 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
79 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; | 79 virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE; |
80 | 80 |
81 private: | 81 private: |
82 friend class MessageCenterViewTest; | 82 friend class MessageCenterViewTest; |
83 | 83 |
84 void AddNotificationAt(const Notification& notification, int index); | 84 void AddNotificationAt(const Notification& notification, int index); |
85 void NotificationsChanged(); | 85 void NotificationsChanged(); |
86 void SetNotificationViewForTest(views::View* view); | 86 void SetNotificationViewForTest(views::View* view); |
87 | 87 |
88 MessageCenter* message_center_; // Weak reference. | 88 MessageCenter* message_center_; // Weak reference. |
89 MessageCenterTray* tray_; // Weak reference. | 89 MessageCenterTray* tray_; // Weak reference. |
90 std::vector<MessageView*> message_views_; // Weak references. | 90 std::vector<MessageView*> message_views_; // Weak references. |
91 | 91 |
92 // Child views. | 92 // Child views. |
93 views::ScrollView* scroller_; | 93 views::ScrollView* scroller_; |
94 MessageListView* message_list_view_; | 94 MessageListView* message_list_view_; |
95 NotifierSettingsView* settings_view_; | 95 NotifierSettingsView* settings_view_; |
96 MessageCenterButtonBar* button_bar_; | 96 MessageCenterButtonBar* button_bar_; |
97 views::View* no_notifications_message_view_; | 97 views::View* no_notifications_message_view_; |
98 bool top_down_; | 98 bool top_down_; |
99 | 99 |
100 // Data for transition animation between settings view and message list. | 100 // Data for transition animation between settings view and message list. |
101 bool settings_visible_; | 101 bool settings_visible_; |
102 | 102 |
103 // Animation managing transition between message center and settings (and vice | 103 // Animation managing transition between message center and settings (and vice |
104 // versa). | 104 // versa). |
105 scoped_ptr<ui::MultiAnimation> settings_transition_animation_; | 105 scoped_ptr<gfx::MultiAnimation> settings_transition_animation_; |
106 | 106 |
107 // Helper data to keep track of the transition between settings and | 107 // Helper data to keep track of the transition between settings and |
108 // message center views. | 108 // message center views. |
109 views::View* source_view_; | 109 views::View* source_view_; |
110 int source_height_; | 110 int source_height_; |
111 views::View* target_view_; | 111 views::View* target_view_; |
112 int target_height_; | 112 int target_height_; |
113 | 113 |
114 // True when the widget is closing so that further operations should be | 114 // True when the widget is closing so that further operations should be |
115 // ignored. | 115 // ignored. |
116 bool is_closing_; | 116 bool is_closing_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(MessageCenterView); | 118 DISALLOW_COPY_AND_ASSIGN(MessageCenterView); |
119 }; | 119 }; |
120 | 120 |
121 } // namespace message_center | 121 } // namespace message_center |
122 | 122 |
123 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ | 123 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ |
OLD | NEW |