OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_NOTIFICATION_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ |
6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ |
7 | 7 |
8 #include "ui/message_center/notification_list.h" | 8 #include <vector> |
| 9 |
9 #include "ui/message_center/views/message_view.h" | 10 #include "ui/message_center/views/message_view.h" |
10 | 11 |
11 namespace message_center { | 12 namespace message_center { |
12 | 13 |
| 14 class NotificationChangeObserver; |
| 15 |
13 // View that displays all current types of notification (web, basic, image, and | 16 // View that displays all current types of notification (web, basic, image, and |
14 // list). Future notification types may be handled by other classes, in which | 17 // list). Future notification types may be handled by other classes, in which |
15 // case instances of those classes would be returned by the | 18 // case instances of those classes would be returned by the Create() factory |
16 // ViewForNotification() factory method below. | 19 // method below. |
17 class NotificationView : public MessageView { | 20 class NotificationView : public MessageView { |
18 public: | 21 public: |
19 // Creates appropriate MessageViews for notifications. Those currently are | 22 // Creates appropriate MessageViews for notifications. Those currently are |
20 // always NotificationView instances but in the future may be instances of | 23 // always NotificationView or MessageSimpleView instances but in the future |
21 // other classes, with the class depending on the notification type. | 24 // may be instances of other classes, with the class depending on the |
| 25 // notification type. |
22 static MessageView* Create(const Notification& notification, | 26 static MessageView* Create(const Notification& notification, |
23 NotificationList::Delegate* list_delegate); | 27 NotificationChangeObserver* observer, |
| 28 bool expanded); |
24 | 29 |
25 virtual ~NotificationView(); | 30 virtual ~NotificationView(); |
26 | 31 |
27 // Overridden from View. | 32 // Overridden from views::View: |
28 virtual void Layout() OVERRIDE; | 33 virtual void Layout() OVERRIDE; |
29 virtual gfx::Size GetPreferredSize() OVERRIDE; | 34 virtual gfx::Size GetPreferredSize() OVERRIDE; |
30 | 35 |
31 // Overridden from MessageView. | 36 // Overridden from MessageView: |
| 37 virtual void Update(const Notification& notification) OVERRIDE; |
32 virtual void ButtonPressed(views::Button* sender, | 38 virtual void ButtonPressed(views::Button* sender, |
33 const ui::Event& event) OVERRIDE; | 39 const ui::Event& event) OVERRIDE; |
34 | 40 |
35 private: | 41 private: |
36 NotificationView(NotificationList::Delegate* list_delegate, | 42 NotificationView(const Notification& notification, |
37 const Notification& notification); | 43 NotificationChangeObserver* observer, |
| 44 bool expanded); |
38 | 45 |
39 views::View* MakeContentView(const Notification& notification); | 46 void AddChildViews(const Notification& notification); |
| 47 void AddContentView(const Notification& notification); |
40 | 48 |
41 views::View* content_view_; | 49 views::View* content_view_; |
| 50 views::ImageView* icon_view_; |
42 std::vector<views::Button*> action_buttons_; | 51 std::vector<views::Button*> action_buttons_; |
43 | 52 |
44 DISALLOW_COPY_AND_ASSIGN(NotificationView); | 53 DISALLOW_COPY_AND_ASSIGN(NotificationView); |
45 }; | 54 }; |
46 | 55 |
47 } // namespace message_center | 56 } // namespace message_center |
48 | 57 |
49 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ | 58 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ |
OLD | NEW |