| 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_NOTIFICATION_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ |
| 6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ui/message_center/message_center_export.h" | 10 #include "ui/message_center/message_center_export.h" |
| 11 #include "ui/message_center/views/message_view.h" | 11 #include "ui/message_center/views/message_view.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 class ProgressBar; | 14 class ProgressBar; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace message_center { | 17 namespace message_center { |
| 18 | 18 |
| 19 class BoundedLabel; | 19 class BoundedLabel; |
| 20 class MessageCenter; | 20 class MessageCenter; |
| 21 class NotificationView; | 21 class NotificationViewContextMenuController; |
| 22 class PaddedButton; | 22 class PaddedButton; |
| 23 | 23 |
| 24 // View that displays all current types of notification (web, basic, image, and | 24 // View that displays all current types of notification (web, basic, image, and |
| 25 // list). Future notification types may be handled by other classes, in which | 25 // list). Future notification types may be handled by other classes, in which |
| 26 // case instances of those classes would be returned by the Create() factory | 26 // case instances of those classes would be returned by the Create() factory |
| 27 // method below. | 27 // method below. |
| 28 class MESSAGE_CENTER_EXPORT NotificationView : public MessageView { | 28 class MESSAGE_CENTER_EXPORT NotificationView : public MessageView { |
| 29 public: | 29 public: |
| 30 // Creates appropriate MessageViews for notifications. Those currently are | 30 // Creates appropriate MessageViews for notifications. Those currently are |
| 31 // always NotificationView instances but in the future | 31 // always NotificationView instances but in the future |
| (...skipping 26 matching lines...) Expand all Loading... |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 NotificationView(const Notification& notification, | 60 NotificationView(const Notification& notification, |
| 61 MessageCenter* message_center, | 61 MessageCenter* message_center, |
| 62 MessageCenterTray* tray, | 62 MessageCenterTray* tray, |
| 63 bool expanded); | 63 bool expanded); |
| 64 | 64 |
| 65 // Overrides from base class MessageView: | 65 // Overrides from base class MessageView: |
| 66 virtual void ClickOnNotification() OVERRIDE; | 66 virtual void ClickOnNotification() OVERRIDE; |
| 67 virtual void RemoveNotification(bool by_user) OVERRIDE; | 67 virtual void RemoveNotification(bool by_user) OVERRIDE; |
| 68 virtual void DisableNotificationsFromThisSource() OVERRIDE; | |
| 69 virtual void ShowNotifierSettingsBubble() OVERRIDE; | |
| 70 | 68 |
| 71 private: | 69 private: |
| 72 bool IsExpansionNeeded(int width); | 70 bool IsExpansionNeeded(int width); |
| 73 bool IsMessageExpansionNeeded(int width); | 71 bool IsMessageExpansionNeeded(int width); |
| 74 int GetMessageLineLimit(int width); | 72 int GetMessageLineLimit(int width); |
| 75 int GetMessageLines(int width, int limit); | 73 int GetMessageLines(int width, int limit); |
| 76 int GetMessageHeight(int width, int limit); | 74 int GetMessageHeight(int width, int limit); |
| 77 | 75 |
| 78 MessageCenter* message_center_; // Weak. | 76 MessageCenter* message_center_; // Weak. |
| 79 MessageCenterTray* tray_; // Weak. | |
| 80 std::string notification_id_; | 77 std::string notification_id_; |
| 81 message_center::NotifierId notifier_id_; | 78 message_center::NotifierId notifier_id_; |
| 82 | 79 |
| 83 // Describes whether the view should display a hand pointer or not. | 80 // Describes whether the view should display a hand pointer or not. |
| 84 bool clickable_; | 81 bool clickable_; |
| 85 bool is_expanded_; | 82 bool is_expanded_; |
| 86 | 83 |
| 87 // Weak references to NotificationView descendants owned by their parents. | 84 // Weak references to NotificationView descendants owned by their parents. |
| 88 views::View* background_view_; | 85 views::View* background_view_; |
| 89 views::View* top_view_; | 86 views::View* top_view_; |
| 90 BoundedLabel* title_view_; | 87 BoundedLabel* title_view_; |
| 91 BoundedLabel* message_view_; | 88 BoundedLabel* message_view_; |
| 92 BoundedLabel* context_message_view_; | 89 BoundedLabel* context_message_view_; |
| 93 std::vector<views::View*> item_views_; | 90 std::vector<views::View*> item_views_; |
| 94 views::View* icon_view_; | 91 views::View* icon_view_; |
| 95 views::View* bottom_view_; | 92 views::View* bottom_view_; |
| 96 views::View* image_view_; | 93 views::View* image_view_; |
| 97 views::ProgressBar* progress_bar_view_; | 94 views::ProgressBar* progress_bar_view_; |
| 98 std::vector<views::View*> action_buttons_; | 95 std::vector<views::View*> action_buttons_; |
| 99 PaddedButton* expand_button_; | 96 PaddedButton* expand_button_; |
| 100 | 97 |
| 98 scoped_ptr<NotificationViewContextMenuController> context_menu_controller_; |
| 99 |
| 101 DISALLOW_COPY_AND_ASSIGN(NotificationView); | 100 DISALLOW_COPY_AND_ASSIGN(NotificationView); |
| 102 }; | 101 }; |
| 103 | 102 |
| 104 } // namespace message_center | 103 } // namespace message_center |
| 105 | 104 |
| 106 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ | 105 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ |
| OLD | NEW |