| 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/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "ui/gfx/insets.h" | 9 #include "ui/gfx/insets.h" |
| 10 #include "ui/message_center/message_center_export.h" | 10 #include "ui/message_center/message_center_export.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // Individual notifications constants. | 26 // Individual notifications constants. |
| 27 const int kPaddingBetweenItems = 10; | 27 const int kPaddingBetweenItems = 10; |
| 28 const int kPaddingHorizontal = 18; | 28 const int kPaddingHorizontal = 18; |
| 29 const int kWebNotificationButtonWidth = 32; | 29 const int kWebNotificationButtonWidth = 32; |
| 30 const int kWebNotificationIconSize = 40; | 30 const int kWebNotificationIconSize = 40; |
| 31 | 31 |
| 32 // An abstract class that forms the basis of a view for a notification entry. | 32 // An abstract class that forms the basis of a view for a notification entry. |
| 33 class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, | 33 class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, |
| 34 public views::ButtonListener { | 34 public views::ButtonListener { |
| 35 public: | 35 public: |
| 36 MessageView(const Notification& notification, | 36 MessageView(const string16& display_source); |
| 37 MessageCenter* message_center, | |
| 38 MessageCenterTray* tray); | |
| 39 virtual ~MessageView(); | 37 virtual ~MessageView(); |
| 40 | 38 |
| 39 // Overrided by derived classes. |
| 40 virtual void ClickOnNotification() = 0; |
| 41 virtual void RemoveNotification(bool by_user) = 0; |
| 42 virtual void DisableNotificationsFromThisSource() = 0; |
| 43 virtual void ShowNotifierSettingsBubble() = 0; |
| 44 |
| 41 // Returns the insets for the shadow it will have for rich notification. | 45 // Returns the insets for the shadow it will have for rich notification. |
| 42 static gfx::Insets GetShadowInsets(); | 46 static gfx::Insets GetShadowInsets(); |
| 43 | 47 |
| 44 // Creates a shadow around the notification. | 48 // Creates a shadow around the notification. |
| 45 void CreateShadowBorder(); | 49 void CreateShadowBorder(); |
| 46 | 50 |
| 47 bool IsCloseButtonFocused(); | 51 bool IsCloseButtonFocused(); |
| 48 void RequestFocusOnCloseButton(); | 52 void RequestFocusOnCloseButton(); |
| 49 | 53 |
| 50 void set_accessible_name(const string16& name) { accessible_name_ = name; } | 54 void set_accessible_name(const string16& name) { accessible_name_ = name; } |
| 51 | 55 |
| 52 // Overridden from views::View: | 56 // Overridden from views::View: |
| 53 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 57 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 54 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 58 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 55 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 59 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
| 56 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; | 60 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; |
| 57 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | 61 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
| 58 | 62 |
| 59 // Overridden from ui::EventHandler: | 63 // Overridden from ui::EventHandler: |
| 60 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 64 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 61 | 65 |
| 62 // Overridden from ButtonListener: | 66 // Overridden from ButtonListener: |
| 63 virtual void ButtonPressed(views::Button* sender, | 67 virtual void ButtonPressed(views::Button* sender, |
| 64 const ui::Event& event) OVERRIDE; | 68 const ui::Event& event) OVERRIDE; |
| 65 | 69 |
| 66 const std::string& notification_id() { return notification_id_; } | |
| 67 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } | 70 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } |
| 68 | 71 |
| 69 protected: | 72 protected: |
| 70 MessageView(); | |
| 71 | |
| 72 // Overridden from views::SlideOutView: | 73 // Overridden from views::SlideOutView: |
| 73 virtual void OnSlideOut() OVERRIDE; | 74 virtual void OnSlideOut() OVERRIDE; |
| 74 | 75 |
| 75 MessageCenter* message_center() { return message_center_; } | |
| 76 views::ImageButton* close_button() { return close_button_.get(); } | 76 views::ImageButton* close_button() { return close_button_.get(); } |
| 77 views::ScrollView* scroller() { return scroller_; } | 77 views::ScrollView* scroller() { return scroller_; } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 MessageCenter* message_center_; // Weak reference. | |
| 81 std::string notification_id_; | |
| 82 | |
| 83 scoped_ptr<MessageViewContextMenuController> context_menu_controller_; | 80 scoped_ptr<MessageViewContextMenuController> context_menu_controller_; |
| 84 scoped_ptr<views::ImageButton> close_button_; | 81 scoped_ptr<views::ImageButton> close_button_; |
| 85 views::ScrollView* scroller_; | 82 views::ScrollView* scroller_; |
| 86 | 83 |
| 87 string16 accessible_name_; | 84 string16 accessible_name_; |
| 88 | 85 |
| 89 DISALLOW_COPY_AND_ASSIGN(MessageView); | 86 DISALLOW_COPY_AND_ASSIGN(MessageView); |
| 90 }; | 87 }; |
| 91 | 88 |
| 92 } // namespace message_center | 89 } // namespace message_center |
| 93 | 90 |
| 94 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ | 91 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ |
| OLD | NEW |