| 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 "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 gfx::Size GetPreferredSize() const override; | 55 gfx::Size GetPreferredSize() const override; |
| 56 int GetHeightForWidth(int width) const override; | 56 int GetHeightForWidth(int width) const override; |
| 57 void Layout() override; | 57 void Layout() override; |
| 58 void OnFocus() override; | 58 void OnFocus() override; |
| 59 void ScrollRectToVisible(const gfx::Rect& rect) override; | 59 void ScrollRectToVisible(const gfx::Rect& rect) override; |
| 60 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; | 60 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; |
| 61 | 61 |
| 62 // Overridden from MessageView: | 62 // Overridden from MessageView: |
| 63 void UpdateWithNotification(const Notification& notification) override; | 63 void UpdateWithNotification(const Notification& notification) override; |
| 64 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 64 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 65 bool IsCloseButtonFocused() override; |
| 66 void RequestFocusOnCloseButton() override; |
| 67 bool IsClosable() override; |
| 65 | 68 |
| 66 // Overridden from MessageViewController: | 69 // Overridden from MessageViewController: |
| 67 void ClickOnNotification(const std::string& notification_id) override; | 70 void ClickOnNotification(const std::string& notification_id) override; |
| 68 void RemoveNotification(const std::string& notification_id, | 71 void RemoveNotification(const std::string& notification_id, |
| 69 bool by_user) override; | 72 bool by_user) override; |
| 70 | 73 |
| 71 void set_controller(MessageCenterController* controller) { | 74 void set_controller(MessageCenterController* controller) { |
| 72 controller_ = controller; | 75 controller_ = controller; |
| 73 } | 76 } |
| 74 | 77 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 98 | 101 |
| 99 void CreateOrUpdateTitleView(const Notification& notification); | 102 void CreateOrUpdateTitleView(const Notification& notification); |
| 100 void CreateOrUpdateMessageView(const Notification& notification); | 103 void CreateOrUpdateMessageView(const Notification& notification); |
| 101 void CreateOrUpdateContextMessageView(const Notification& notification); | 104 void CreateOrUpdateContextMessageView(const Notification& notification); |
| 102 void CreateOrUpdateSettingsButtonView(const Notification& notification); | 105 void CreateOrUpdateSettingsButtonView(const Notification& notification); |
| 103 void CreateOrUpdateProgressBarView(const Notification& notification); | 106 void CreateOrUpdateProgressBarView(const Notification& notification); |
| 104 void CreateOrUpdateListItemViews(const Notification& notification); | 107 void CreateOrUpdateListItemViews(const Notification& notification); |
| 105 void CreateOrUpdateIconView(const Notification& notification); | 108 void CreateOrUpdateIconView(const Notification& notification); |
| 106 void CreateOrUpdateImageView(const Notification& notification); | 109 void CreateOrUpdateImageView(const Notification& notification); |
| 107 void CreateOrUpdateActionButtonViews(const Notification& notification); | 110 void CreateOrUpdateActionButtonViews(const Notification& notification); |
| 111 void CreateOrUpdateCloseButtonView(const Notification& notification); |
| 108 | 112 |
| 109 int GetMessageLineLimit(int title_lines, int width) const; | 113 int GetMessageLineLimit(int title_lines, int width) const; |
| 110 int GetMessageHeight(int width, int limit) const; | 114 int GetMessageHeight(int width, int limit) const; |
| 111 | 115 |
| 112 // Formats the context message to be displayed based on |context| | 116 // Formats the context message to be displayed based on |context| |
| 113 // so it shows as much information as possible | 117 // so it shows as much information as possible |
| 114 // given the space available in the ContextMessage section of the | 118 // given the space available in the ContextMessage section of the |
| 115 // notification. | 119 // notification. |
| 116 base::string16 FormatContextMessage(const Notification& notification) const; | 120 base::string16 FormatContextMessage(const Notification& notification) const; |
| 117 | 121 |
| 118 MessageCenterController* controller_; // Weak, lives longer then views. | 122 MessageCenterController* controller_; // Weak, lives longer then views. |
| 119 | 123 |
| 120 // Describes whether the view should display a hand pointer or not. | 124 // Describes whether the view should display a hand pointer or not. |
| 121 bool clickable_; | 125 bool clickable_; |
| 122 | 126 |
| 123 // Weak references to NotificationView descendants owned by their parents. | 127 // Weak references to NotificationView descendants owned by their parents. |
| 124 views::View* top_view_; | 128 views::View* top_view_; |
| 125 BoundedLabel* title_view_; | 129 BoundedLabel* title_view_; |
| 126 BoundedLabel* message_view_; | 130 BoundedLabel* message_view_; |
| 127 BoundedLabel* context_message_view_; | 131 BoundedLabel* context_message_view_; |
| 128 views::ImageButton* settings_button_view_; | 132 views::ImageButton* settings_button_view_; |
| 129 std::vector<views::View*> item_views_; | 133 std::vector<views::View*> item_views_; |
| 130 ProportionalImageView* icon_view_; | 134 ProportionalImageView* icon_view_; |
| 131 views::View* bottom_view_; | 135 views::View* bottom_view_; |
| 132 views::View* image_container_; | 136 views::View* image_container_; |
| 133 ProportionalImageView* image_view_; | 137 ProportionalImageView* image_view_; |
| 134 NotificationProgressBarBase* progress_bar_view_; | 138 NotificationProgressBarBase* progress_bar_view_; |
| 135 std::vector<NotificationButton*> action_buttons_; | 139 std::vector<NotificationButton*> action_buttons_; |
| 140 scoped_ptr<views::ImageButton> close_button_; |
| 136 std::vector<views::View*> separators_; | 141 std::vector<views::View*> separators_; |
| 137 | 142 |
| 138 DISALLOW_COPY_AND_ASSIGN(NotificationView); | 143 DISALLOW_COPY_AND_ASSIGN(NotificationView); |
| 139 }; | 144 }; |
| 140 | 145 |
| 141 } // namespace message_center | 146 } // namespace message_center |
| 142 | 147 |
| 143 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ | 148 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ |
| OLD | NEW |