Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: ui/message_center/message_view.h

Issue 12277024: Notificaitons refactor step 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed latest nits Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 12 matching lines...) Expand all
23 const int kPaddingHorizontal = 18; 23 const int kPaddingHorizontal = 18;
24 const int kWebNotificationButtonWidth = 32; 24 const int kWebNotificationButtonWidth = 32;
25 const int kWebNotificationIconSize = 40; 25 const int kWebNotificationIconSize = 40;
26 const int kWebNotificationWidth = 300; 26 const int kWebNotificationWidth = 300;
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 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 37 // Creates the elements that make up the view layout. Must be called
38 // immediately after construction. 38 // immediately after construction.
39 virtual void SetUpView() = 0; 39 virtual void SetUpView() = 0;
40 40
41 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } 41 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; }
42 42
43 // Overridden from views::View. 43 // Overridden from views::View.
44 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; 44 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
45 45
46 // Overridden from ui::EventHandler. 46 // Overridden from ui::EventHandler.
47 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 47 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
48 48
49 // Overridden from ButtonListener. 49 // Overridden from ButtonListener.
50 virtual void ButtonPressed(views::Button* sender, 50 virtual void ButtonPressed(views::Button* sender,
51 const ui::Event& event) OVERRIDE; 51 const ui::Event& event) OVERRIDE;
52 52
53 protected: 53 protected:
54 MessageView(); 54 MessageView();
55 55
56 // Shows the menu for the notification. 56 // Shows the menu for the notification.
57 void ShowMenu(gfx::Point screen_location); 57 void ShowMenu(gfx::Point screen_location);
58 58
59 // Overridden from views::SlideOutView. 59 // Overridden from views::SlideOutView.
60 virtual void OnSlideOut() OVERRIDE; 60 virtual void OnSlideOut() OVERRIDE;
61 61
62 NotificationList::Delegate* list_delegate() { return list_delegate_; } 62 NotificationList::Delegate* list_delegate() { return list_delegate_; }
63 Notification& notification() { return notification_; } 63 Notification* notification() { return notification_; }
64 views::ImageButton* close_button() { return close_button_.get(); } 64 views::ImageButton* close_button() { return close_button_.get(); }
65 views::ScrollView* scroller() { return scroller_; } 65 views::ScrollView* scroller() { return scroller_; }
66 66
67 private: 67 private:
68 NotificationList::Delegate* list_delegate_; 68 NotificationList::Delegate* list_delegate_; // Weak, global (MessageCenter).
69 Notification notification_; 69 Notification* notification_; // Weak, owned by NotificationList.
70 scoped_ptr<views::ImageButton> close_button_; 70 scoped_ptr<views::ImageButton> close_button_;
71 71
72 views::ScrollView* scroller_; 72 views::ScrollView* scroller_;
73 73
74 DISALLOW_COPY_AND_ASSIGN(MessageView); 74 DISALLOW_COPY_AND_ASSIGN(MessageView);
75 }; 75 };
76 76
77 } // namespace message_center 77 } // namespace message_center
78 78
79 #endif // UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ 79 #endif // UI_MESSAGE_CENTER_MESSAGE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698