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

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

Issue 1645843003: Implement Non-Closable Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary property. Created 4 years, 9 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
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_VIEWS_MESSAGE_VIEW_H_ 5 #ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_
6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ 6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 28 matching lines...) Expand all
39 virtual void RemoveNotification(const std::string& notification_id, 39 virtual void RemoveNotification(const std::string& notification_id,
40 bool by_user) = 0; 40 bool by_user) = 0;
41 }; 41 };
42 42
43 // Individual notifications constants. 43 // Individual notifications constants.
44 const int kPaddingBetweenItems = 10; 44 const int kPaddingBetweenItems = 10;
45 const int kPaddingHorizontal = 18; 45 const int kPaddingHorizontal = 18;
46 const int kWebNotificationButtonWidth = 32; 46 const int kWebNotificationButtonWidth = 32;
47 const int kWebNotificationIconSize = 40; 47 const int kWebNotificationIconSize = 40;
48 48
49 // An base class for a notification entry. Contains background, close button 49 // An base class for a notification entry. Contains background and other
50 // and other elements shared by derived notification views. 50 // elements shared by derived notification views.
51 class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, 51 class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView,
52 public views::ButtonListener { 52 public views::ButtonListener {
53 public: 53 public:
54 MessageView(MessageViewController* controller, 54 MessageView(MessageViewController* controller,
55 const std::string& notification_id, 55 const std::string& notification_id,
56 const NotifierId& notifier_id, 56 const NotifierId& notifier_id,
57 const gfx::ImageSkia& small_image, 57 const gfx::ImageSkia& small_image,
58 const base::string16& display_source); 58 const base::string16& display_source);
59 ~MessageView() override; 59 ~MessageView() override;
60 60
61 // Updates this view with the new data contained in the notification. 61 // Updates this view with the new data contained in the notification.
62 virtual void UpdateWithNotification(const Notification& notification); 62 virtual void UpdateWithNotification(const Notification& notification);
63 63
64 // Returns the insets for the shadow it will have for rich notification. 64 // Returns the insets for the shadow it will have for rich notification.
65 static gfx::Insets GetShadowInsets(); 65 static gfx::Insets GetShadowInsets();
66 66
67 // Creates a shadow around the notification. 67 // Creates a shadow around the notification.
68 void CreateShadowBorder(); 68 void CreateShadowBorder();
69 69
70 bool IsCloseButtonFocused(); 70 virtual bool IsCloseButtonFocused();
71 void RequestFocusOnCloseButton(); 71 virtual void RequestFocusOnCloseButton();
72 virtual bool IsPinned();
72 73
73 void set_accessible_name(const base::string16& accessible_name) { 74 void set_accessible_name(const base::string16& accessible_name) {
74 accessible_name_ = accessible_name; 75 accessible_name_ = accessible_name;
75 } 76 }
76 77
77 // Overridden from views::View: 78 // Overridden from views::View:
78 void GetAccessibleState(ui::AXViewState* state) override; 79 void GetAccessibleState(ui::AXViewState* state) override;
79 bool OnMousePressed(const ui::MouseEvent& event) override; 80 bool OnMousePressed(const ui::MouseEvent& event) override;
80 bool OnKeyPressed(const ui::KeyEvent& event) override; 81 bool OnKeyPressed(const ui::KeyEvent& event) override;
81 bool OnKeyReleased(const ui::KeyEvent& event) override; 82 bool OnKeyReleased(const ui::KeyEvent& event) override;
(...skipping 11 matching lines...) Expand all
93 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } 94 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; }
94 std::string notification_id() { return notification_id_; } 95 std::string notification_id() { return notification_id_; }
95 NotifierId notifier_id() { return notifier_id_; } 96 NotifierId notifier_id() { return notifier_id_; }
96 const base::string16& display_source() const { return display_source_; } 97 const base::string16& display_source() const { return display_source_; }
97 98
98 protected: 99 protected:
99 // Overridden from views::SlideOutView: 100 // Overridden from views::SlideOutView:
100 void OnSlideOut() override; 101 void OnSlideOut() override;
101 102
102 views::ImageView* small_image() { return small_image_view_.get(); } 103 views::ImageView* small_image() { return small_image_view_.get(); }
103 views::ImageButton* close_button() { return close_button_.get(); }
104 views::ScrollView* scroller() { return scroller_; } 104 views::ScrollView* scroller() { return scroller_; }
105 105
106 private: 106 private:
107 MessageViewController* controller_; 107 MessageViewController* controller_;
108 std::string notification_id_; 108 std::string notification_id_;
109 NotifierId notifier_id_; 109 NotifierId notifier_id_;
110 views::View* background_view_; // Owned by views hierarchy. 110 views::View* background_view_; // Owned by views hierarchy.
111 scoped_ptr<views::ImageButton> close_button_;
112 scoped_ptr<views::ImageView> small_image_view_; 111 scoped_ptr<views::ImageView> small_image_view_;
113 views::ScrollView* scroller_; 112 views::ScrollView* scroller_;
114 113
115 base::string16 accessible_name_; 114 base::string16 accessible_name_;
116 115
117 base::string16 display_source_; 116 base::string16 display_source_;
118 117
119 scoped_ptr<views::Painter> focus_painter_; 118 scoped_ptr<views::Painter> focus_painter_;
120 119
121 // Changes the background color being used by |background_view_| and schedules 120 // Changes the background color being used by |background_view_| and schedules
122 // a paint. 121 // a paint.
123 void SetDrawBackgroundAsActive(bool active); 122 void SetDrawBackgroundAsActive(bool active);
124 123
125 DISALLOW_COPY_AND_ASSIGN(MessageView); 124 DISALLOW_COPY_AND_ASSIGN(MessageView);
126 }; 125 };
127 126
128 } // namespace message_center 127 } // namespace message_center
129 128
130 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ 129 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_
OLDNEW
« no previous file with comments | « ui/message_center/views/message_popup_collection_unittest.cc ('k') | ui/message_center/views/message_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698