| 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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // Overridden from views::View: | 44 // Overridden from views::View: |
| 45 virtual gfx::Size GetPreferredSize() OVERRIDE; | 45 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 46 virtual int GetHeightForWidth(int width) OVERRIDE; | 46 virtual int GetHeightForWidth(int width) OVERRIDE; |
| 47 virtual void Layout() OVERRIDE; | 47 virtual void Layout() OVERRIDE; |
| 48 virtual void OnFocus() OVERRIDE; | 48 virtual void OnFocus() OVERRIDE; |
| 49 virtual void ScrollRectToVisible(const gfx::Rect& rect) OVERRIDE; | 49 virtual void ScrollRectToVisible(const gfx::Rect& rect) OVERRIDE; |
| 50 virtual views::View* GetEventHandlerForRect(const gfx::Rect& rect) OVERRIDE; | 50 virtual views::View* GetEventHandlerForRect(const gfx::Rect& rect) OVERRIDE; |
| 51 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; | 51 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; |
| 52 | 52 |
| 53 // Overridden from MessageView: | 53 // Overridden from MessageView: |
| 54 virtual void UpdateWithNotification( |
| 55 const Notification& notification) OVERRIDE; |
| 54 virtual void ButtonPressed(views::Button* sender, | 56 virtual void ButtonPressed(views::Button* sender, |
| 55 const ui::Event& event) OVERRIDE; | 57 const ui::Event& event) OVERRIDE; |
| 56 | 58 |
| 57 // Overridden from MessageViewController: | 59 // Overridden from MessageViewController: |
| 58 virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE; | 60 virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE; |
| 59 virtual void RemoveNotification(const std::string& notification_id, | 61 virtual void RemoveNotification(const std::string& notification_id, |
| 60 bool by_user) OVERRIDE; | 62 bool by_user) OVERRIDE; |
| 61 | 63 |
| 62 void set_controller(MessageCenterController* controller) { | 64 void set_controller(MessageCenterController* controller) { |
| 63 controller_ = controller; | 65 controller_ = controller; |
| 64 } | 66 } |
| 65 | 67 |
| 66 protected: | 68 protected: |
| 67 NotificationView(MessageCenterController* controller, | 69 NotificationView(MessageCenterController* controller, |
| 68 const Notification& notification); | 70 const Notification& notification); |
| 69 | 71 |
| 70 private: | 72 private: |
| 73 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, CreateOrUpdateTest); |
| 71 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, TestLineLimits); | 74 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, TestLineLimits); |
| 75 |
| 76 void CreateOrUpdateViews(const Notification& notification); |
| 77 void SetAccessibleName(const Notification& notification); |
| 78 |
| 79 void CreateOrUpdateTitleView(const Notification& notification); |
| 80 void CreateOrUpdateMessageView(const Notification& notification); |
| 81 void CreateOrUpdateContextMessageView(const Notification& notification); |
| 82 void CreateOrUpdateProgressBarView(const Notification& notification); |
| 83 void CreateOrUpdateListItemViews(const Notification& notification); |
| 84 void CreateOrUpdateIconView(const Notification& notification); |
| 85 void CreateOrUpdateImageView(const Notification& notification); |
| 86 void CreateOrUpdateActionButtonViews(const Notification& notification); |
| 87 |
| 72 int GetMessageLineLimit(int title_lines, int width); | 88 int GetMessageLineLimit(int title_lines, int width); |
| 73 int GetMessageHeight(int width, int limit); | 89 int GetMessageHeight(int width, int limit); |
| 74 | 90 |
| 75 MessageCenterController* controller_; // Weak, lives longer then views. | 91 MessageCenterController* controller_; // Weak, lives longer then views. |
| 76 | 92 |
| 77 // Describes whether the view should display a hand pointer or not. | 93 // Describes whether the view should display a hand pointer or not. |
| 78 bool clickable_; | 94 bool clickable_; |
| 79 | 95 |
| 80 // Weak references to NotificationView descendants owned by their parents. | 96 // Weak references to NotificationView descendants owned by their parents. |
| 81 views::View* top_view_; | 97 views::View* top_view_; |
| 82 BoundedLabel* title_view_; | 98 BoundedLabel* title_view_; |
| 83 BoundedLabel* message_view_; | 99 BoundedLabel* message_view_; |
| 84 BoundedLabel* context_message_view_; | 100 BoundedLabel* context_message_view_; |
| 85 std::vector<views::View*> item_views_; | 101 std::vector<views::View*> item_views_; |
| 86 views::View* icon_view_; | 102 views::View* icon_view_; |
| 87 views::View* bottom_view_; | 103 views::View* bottom_view_; |
| 88 views::View* image_view_; | 104 views::View* image_view_; |
| 89 views::ProgressBar* progress_bar_view_; | 105 views::ProgressBar* progress_bar_view_; |
| 90 std::vector<views::View*> action_buttons_; | 106 std::vector<views::View*> action_buttons_; |
| 107 std::vector<views::View*> separators_; |
| 91 | 108 |
| 92 DISALLOW_COPY_AND_ASSIGN(NotificationView); | 109 DISALLOW_COPY_AND_ASSIGN(NotificationView); |
| 93 }; | 110 }; |
| 94 | 111 |
| 95 } // namespace message_center | 112 } // namespace message_center |
| 96 | 113 |
| 97 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ | 114 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ |
| OLD | NEW |