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_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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "ui/gfx/insets.h" | 10 #include "ui/gfx/insets.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 const int kWebNotificationIconSize = 40; | 41 const int kWebNotificationIconSize = 40; |
42 | 42 |
43 // An base class for a notification entry. Contains background, close button | 43 // An base class for a notification entry. Contains background, close button |
44 // and other elements shared by derived notification views. | 44 // and other elements shared by derived notification views. |
45 class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, | 45 class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, |
46 public views::ButtonListener { | 46 public views::ButtonListener { |
47 public: | 47 public: |
48 MessageView(MessageViewController* controller, | 48 MessageView(MessageViewController* controller, |
49 const std::string& notification_id, | 49 const std::string& notification_id, |
50 const NotifierId& notifier_id, | 50 const NotifierId& notifier_id, |
51 const string16& display_source); | 51 const base::string16& display_source); |
52 virtual ~MessageView(); | 52 virtual ~MessageView(); |
53 | 53 |
54 // Returns the insets for the shadow it will have for rich notification. | 54 // Returns the insets for the shadow it will have for rich notification. |
55 static gfx::Insets GetShadowInsets(); | 55 static gfx::Insets GetShadowInsets(); |
56 | 56 |
57 // Creates a shadow around the notification. | 57 // Creates a shadow around the notification. |
58 void CreateShadowBorder(); | 58 void CreateShadowBorder(); |
59 | 59 |
60 bool IsCloseButtonFocused(); | 60 bool IsCloseButtonFocused(); |
61 void RequestFocusOnCloseButton(); | 61 void RequestFocusOnCloseButton(); |
62 | 62 |
63 void set_accessible_name(const string16& name) { accessible_name_ = name; } | 63 void set_accessible_name(const base::string16& accessible_name) { |
| 64 accessible_name_ = accessible_name; |
| 65 } |
64 | 66 |
65 // Overridden from views::View: | 67 // Overridden from views::View: |
66 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 68 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
67 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 69 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
68 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 70 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
69 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; | 71 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; |
70 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 72 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
71 virtual void OnFocus() OVERRIDE; | 73 virtual void OnFocus() OVERRIDE; |
72 virtual void OnBlur() OVERRIDE; | 74 virtual void OnBlur() OVERRIDE; |
73 virtual void Layout() OVERRIDE; | 75 virtual void Layout() OVERRIDE; |
(...skipping 18 matching lines...) Expand all Loading... |
92 views::ScrollView* scroller() { return scroller_; } | 94 views::ScrollView* scroller() { return scroller_; } |
93 | 95 |
94 private: | 96 private: |
95 MessageViewController* controller_; | 97 MessageViewController* controller_; |
96 std::string notification_id_; | 98 std::string notification_id_; |
97 NotifierId notifier_id_; | 99 NotifierId notifier_id_; |
98 views::View* background_view_; // Owned by views hierarchy. | 100 views::View* background_view_; // Owned by views hierarchy. |
99 scoped_ptr<views::ImageButton> close_button_; | 101 scoped_ptr<views::ImageButton> close_button_; |
100 views::ScrollView* scroller_; | 102 views::ScrollView* scroller_; |
101 | 103 |
102 string16 accessible_name_; | 104 base::string16 accessible_name_; |
103 | 105 |
104 base::string16 display_source_; | 106 base::string16 display_source_; |
105 | 107 |
106 scoped_ptr<views::Painter> focus_painter_; | 108 scoped_ptr<views::Painter> focus_painter_; |
107 | 109 |
108 DISALLOW_COPY_AND_ASSIGN(MessageView); | 110 DISALLOW_COPY_AND_ASSIGN(MessageView); |
109 }; | 111 }; |
110 | 112 |
111 } // namespace message_center | 113 } // namespace message_center |
112 | 114 |
113 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ | 115 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ |
OLD | NEW |