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_MESSAGE_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ |
6 #define UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ |
7 | 7 |
8 #include "ui/message_center/notification.h" | 8 #include "ui/message_center/notification.h" |
9 #include "ui/message_center/notification_list.h" | 9 #include "ui/message_center/notification_list.h" |
10 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 // An abstract class that forms the basis of a view for a notification entry. | 28 // An abstract class that forms the basis of a view for a notification entry. |
29 class MessageView : public views::SlideOutView, | 29 class MessageView : public views::SlideOutView, |
30 public views::ButtonListener { | 30 public views::ButtonListener { |
31 public: | 31 public: |
32 MessageView(NotificationList::Delegate* list_delegate, | 32 MessageView(NotificationList::Delegate* list_delegate, |
33 const Notification& notification); | 33 const Notification& notification); |
34 | 34 |
35 virtual ~MessageView(); | 35 virtual ~MessageView(); |
36 | 36 |
37 // Creates the elements that make up the view layout. Must be called | |
38 // immediately after construction. | |
39 virtual void SetUpView() = 0; | |
40 | |
41 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } | 37 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } |
42 | 38 |
43 // Overridden from views::View. | 39 // Overridden from views::View. |
44 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 40 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
45 | 41 |
46 // Overridden from ui::EventHandler. | 42 // Overridden from ui::EventHandler. |
47 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 43 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
48 | 44 |
49 // Overridden from ButtonListener. | 45 // Overridden from ButtonListener. |
50 virtual void ButtonPressed(views::Button* sender, | 46 virtual void ButtonPressed(views::Button* sender, |
51 const ui::Event& event) OVERRIDE; | 47 const ui::Event& event) OVERRIDE; |
52 | 48 |
53 protected: | 49 protected: |
54 MessageView(); | 50 MessageView(); |
55 | 51 |
56 // Shows the menu for the notification. | 52 // Shows the menu for the notification. |
57 void ShowMenu(gfx::Point screen_location); | 53 void ShowMenu(gfx::Point screen_location); |
58 | 54 |
59 // Overridden from views::SlideOutView. | 55 // Overridden from views::SlideOutView. |
60 virtual void OnSlideOut() OVERRIDE; | 56 virtual void OnSlideOut() OVERRIDE; |
61 | 57 |
62 NotificationList::Delegate* list_delegate() { return list_delegate_; } | 58 NotificationList::Delegate* list_delegate() { return list_delegate_; } |
63 Notification& notification() { return notification_; } | 59 const std::string& notification_id() { return notification_id_; } |
| 60 const string16& display_source() const { return display_source_; } |
| 61 const std::string& extension_id() const { return extension_id_; } |
64 views::ImageButton* close_button() { return close_button_.get(); } | 62 views::ImageButton* close_button() { return close_button_.get(); } |
65 views::ScrollView* scroller() { return scroller_; } | 63 views::ScrollView* scroller() { return scroller_; } |
66 | 64 |
67 private: | 65 private: |
68 NotificationList::Delegate* list_delegate_; | 66 NotificationList::Delegate* list_delegate_; // Weak, global (MessageCenter). |
69 Notification notification_; | 67 std::string notification_id_; |
| 68 string16 display_source_; |
| 69 std::string extension_id_; |
| 70 |
70 scoped_ptr<views::ImageButton> close_button_; | 71 scoped_ptr<views::ImageButton> close_button_; |
71 | 72 |
72 views::ScrollView* scroller_; | 73 views::ScrollView* scroller_; |
73 | 74 |
74 DISALLOW_COPY_AND_ASSIGN(MessageView); | 75 DISALLOW_COPY_AND_ASSIGN(MessageView); |
75 }; | 76 }; |
76 | 77 |
77 } // namespace message_center | 78 } // namespace message_center |
78 | 79 |
79 #endif // UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ | 80 #endif // UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ |
OLD | NEW |