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 "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // An base class for a notification entry. Contains background, close button | 48 // An base class for a notification entry. Contains background, close button |
49 // and other elements shared by derived notification views. | 49 // and other elements shared by derived notification views. |
50 class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, | 50 class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, |
51 public views::ButtonListener { | 51 public views::ButtonListener { |
52 public: | 52 public: |
53 MessageView(MessageViewController* controller, | 53 MessageView(MessageViewController* controller, |
54 const std::string& notification_id, | 54 const std::string& notification_id, |
55 const NotifierId& notifier_id, | 55 const NotifierId& notifier_id, |
56 const gfx::ImageSkia& small_image, | 56 const gfx::ImageSkia& small_image, |
57 const base::string16& display_source); | 57 const base::string16& display_source); |
58 virtual ~MessageView(); | 58 ~MessageView() override; |
59 | 59 |
60 // Updates this view with the new data contained in the notification. | 60 // Updates this view with the new data contained in the notification. |
61 virtual void UpdateWithNotification(const Notification& notification); | 61 virtual void UpdateWithNotification(const Notification& notification); |
62 | 62 |
63 // Returns the insets for the shadow it will have for rich notification. | 63 // Returns the insets for the shadow it will have for rich notification. |
64 static gfx::Insets GetShadowInsets(); | 64 static gfx::Insets GetShadowInsets(); |
65 | 65 |
66 // Creates a shadow around the notification. | 66 // Creates a shadow around the notification. |
67 void CreateShadowBorder(); | 67 void CreateShadowBorder(); |
68 | 68 |
69 bool IsCloseButtonFocused(); | 69 bool IsCloseButtonFocused(); |
70 void RequestFocusOnCloseButton(); | 70 void RequestFocusOnCloseButton(); |
71 | 71 |
72 void set_accessible_name(const base::string16& accessible_name) { | 72 void set_accessible_name(const base::string16& accessible_name) { |
73 accessible_name_ = accessible_name; | 73 accessible_name_ = accessible_name; |
74 } | 74 } |
75 | 75 |
76 // Overridden from views::View: | 76 // Overridden from views::View: |
77 virtual void GetAccessibleState(ui::AXViewState* state) override; | 77 void GetAccessibleState(ui::AXViewState* state) override; |
78 virtual bool OnMousePressed(const ui::MouseEvent& event) override; | 78 bool OnMousePressed(const ui::MouseEvent& event) override; |
79 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; | 79 bool OnKeyPressed(const ui::KeyEvent& event) override; |
80 virtual bool OnKeyReleased(const ui::KeyEvent& event) override; | 80 bool OnKeyReleased(const ui::KeyEvent& event) override; |
81 virtual void OnPaint(gfx::Canvas* canvas) override; | 81 void OnPaint(gfx::Canvas* canvas) override; |
82 virtual void OnFocus() override; | 82 void OnFocus() override; |
83 virtual void OnBlur() override; | 83 void OnBlur() override; |
84 virtual void Layout() override; | 84 void Layout() override; |
85 | 85 |
86 // Overridden from ui::EventHandler: | 86 // Overridden from ui::EventHandler: |
87 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 87 void OnGestureEvent(ui::GestureEvent* event) override; |
88 | 88 |
89 // Overridden from ButtonListener: | 89 // Overridden from ButtonListener: |
90 virtual void ButtonPressed(views::Button* sender, | 90 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
91 const ui::Event& event) override; | |
92 | 91 |
93 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } | 92 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } |
94 std::string notification_id() { return notification_id_; } | 93 std::string notification_id() { return notification_id_; } |
95 NotifierId notifier_id() { return notifier_id_; } | 94 NotifierId notifier_id() { return notifier_id_; } |
96 const base::string16& display_source() const { return display_source_; } | 95 const base::string16& display_source() const { return display_source_; } |
97 | 96 |
98 protected: | 97 protected: |
99 // Overridden from views::SlideOutView: | 98 // Overridden from views::SlideOutView: |
100 virtual void OnSlideOut() override; | 99 void OnSlideOut() override; |
101 | 100 |
102 views::ImageView* small_image() { return small_image_view_.get(); } | 101 views::ImageView* small_image() { return small_image_view_.get(); } |
103 views::ImageButton* close_button() { return close_button_.get(); } | 102 views::ImageButton* close_button() { return close_button_.get(); } |
104 views::ScrollView* scroller() { return scroller_; } | 103 views::ScrollView* scroller() { return scroller_; } |
105 | 104 |
106 private: | 105 private: |
107 MessageViewController* controller_; | 106 MessageViewController* controller_; |
108 std::string notification_id_; | 107 std::string notification_id_; |
109 NotifierId notifier_id_; | 108 NotifierId notifier_id_; |
110 views::View* background_view_; // Owned by views hierarchy. | 109 views::View* background_view_; // Owned by views hierarchy. |
(...skipping 10 matching lines...) Expand all Loading... |
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_ |
OLD | NEW |