| 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" |
| 11 #include "ui/message_center/message_center_export.h" | 11 #include "ui/message_center/message_center_export.h" |
| 12 #include "ui/message_center/notification.h" | 12 #include "ui/message_center/notification.h" |
| 13 #include "ui/views/controls/button/button.h" | 13 #include "ui/views/controls/button/button.h" |
| 14 #include "ui/views/controls/slide_out_view.h" | 14 #include "ui/views/controls/slide_out_view.h" |
| 15 | 15 |
| 16 namespace ui { |
| 17 class MenuModel; |
| 18 } |
| 19 |
| 16 namespace views { | 20 namespace views { |
| 17 class ImageButton; | 21 class ImageButton; |
| 18 class Painter; | 22 class Painter; |
| 19 class ScrollView; | 23 class ScrollView; |
| 20 } | 24 } |
| 21 | 25 |
| 22 namespace message_center { | 26 namespace message_center { |
| 23 | 27 |
| 24 // Interface that MessageView uses to report clicks and other user actions. | 28 // Interface that MessageView uses to report clicks and other user actions. |
| 25 // Provided by creator of MessageView. | 29 // Provided by creator of MessageView. |
| 26 class MessageViewController { | 30 class MessageViewController { |
| 27 public: | 31 public: |
| 28 virtual void ClickOnNotification(const std::string& notification_id) = 0; | 32 virtual void ClickOnNotification(const std::string& notification_id) = 0; |
| 29 virtual void RemoveNotification(const std::string& notification_id, | 33 virtual void RemoveNotification(const std::string& notification_id, |
| 30 bool by_user) = 0; | 34 bool by_user) = 0; |
| 31 virtual void DisableNotificationsFromThisSource( | |
| 32 const NotifierId& notifier_id) = 0; | |
| 33 virtual void ShowNotifierSettingsBubble() = 0; | |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 class MessageViewContextMenuController; | |
| 37 | |
| 38 // Individual notifications constants. | 37 // Individual notifications constants. |
| 39 const int kPaddingBetweenItems = 10; | 38 const int kPaddingBetweenItems = 10; |
| 40 const int kPaddingHorizontal = 18; | 39 const int kPaddingHorizontal = 18; |
| 41 const int kWebNotificationButtonWidth = 32; | 40 const int kWebNotificationButtonWidth = 32; |
| 42 const int kWebNotificationIconSize = 40; | 41 const int kWebNotificationIconSize = 40; |
| 43 | 42 |
| 44 // An base class for a notification entry. Contains background, close button | 43 // An base class for a notification entry. Contains background, close button |
| 45 // and other elements shared by derived notification views. | 44 // and other elements shared by derived notification views. |
| 46 class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, | 45 class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, |
| 47 public views::ButtonListener { | 46 public views::ButtonListener { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 76 // Overridden from ui::EventHandler: | 75 // Overridden from ui::EventHandler: |
| 77 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 76 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 78 | 77 |
| 79 // Overridden from ButtonListener: | 78 // Overridden from ButtonListener: |
| 80 virtual void ButtonPressed(views::Button* sender, | 79 virtual void ButtonPressed(views::Button* sender, |
| 81 const ui::Event& event) OVERRIDE; | 80 const ui::Event& event) OVERRIDE; |
| 82 | 81 |
| 83 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } | 82 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } |
| 84 std::string notification_id() { return notification_id_; } | 83 std::string notification_id() { return notification_id_; } |
| 85 NotifierId notifier_id() { return notifier_id_; } | 84 NotifierId notifier_id() { return notifier_id_; } |
| 85 const base::string16& display_source() const { return display_source_; } |
| 86 | 86 |
| 87 protected: | 87 protected: |
| 88 // Overridden from views::SlideOutView: | 88 // Overridden from views::SlideOutView: |
| 89 virtual void OnSlideOut() OVERRIDE; | 89 virtual void OnSlideOut() OVERRIDE; |
| 90 | 90 |
| 91 views::ImageButton* close_button() { return close_button_.get(); } | 91 views::ImageButton* close_button() { return close_button_.get(); } |
| 92 views::ScrollView* scroller() { return scroller_; } | 92 views::ScrollView* scroller() { return scroller_; } |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 MessageViewController* controller_; | 95 MessageViewController* controller_; |
| 96 std::string notification_id_; | 96 std::string notification_id_; |
| 97 NotifierId notifier_id_; | 97 NotifierId notifier_id_; |
| 98 scoped_ptr<MessageViewContextMenuController> context_menu_controller_; | |
| 99 views::View* background_view_; // Owned by views hierarchy. | 98 views::View* background_view_; // Owned by views hierarchy. |
| 100 scoped_ptr<views::ImageButton> close_button_; | 99 scoped_ptr<views::ImageButton> close_button_; |
| 101 views::ScrollView* scroller_; | 100 views::ScrollView* scroller_; |
| 102 | 101 |
| 103 string16 accessible_name_; | 102 string16 accessible_name_; |
| 104 | 103 |
| 104 base::string16 display_source_; |
| 105 |
| 105 scoped_ptr<views::Painter> focus_painter_; | 106 scoped_ptr<views::Painter> focus_painter_; |
| 106 | 107 |
| 107 DISALLOW_COPY_AND_ASSIGN(MessageView); | 108 DISALLOW_COPY_AND_ASSIGN(MessageView); |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 } // namespace message_center | 111 } // namespace message_center |
| 111 | 112 |
| 112 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ | 113 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ |
| OLD | NEW |