Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: ui/message_center/views/notification_view.h

Issue 1980753002: Move close button to MessageView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use-messageview
Patch Set: move CreateOrUpdateCloseButtonView Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/message_center/views/message_view.cc ('k') | ui/message_center/views/notification_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 gfx::Size GetPreferredSize() const override; 53 gfx::Size GetPreferredSize() const override;
54 int GetHeightForWidth(int width) const override; 54 int GetHeightForWidth(int width) const override;
55 void Layout() override; 55 void Layout() override;
56 void OnFocus() override; 56 void OnFocus() override;
57 void ScrollRectToVisible(const gfx::Rect& rect) override; 57 void ScrollRectToVisible(const gfx::Rect& rect) override;
58 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; 58 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override;
59 59
60 // Overridden from MessageView: 60 // Overridden from MessageView:
61 void UpdateWithNotification(const Notification& notification) override; 61 void UpdateWithNotification(const Notification& notification) override;
62 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 62 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
63 bool IsCloseButtonFocused() override;
64 void RequestFocusOnCloseButton() override;
65 bool IsPinned() override;
66 63
67 protected: 64 protected:
68 NotificationView(MessageCenterController* controller, 65 NotificationView(MessageCenterController* controller,
69 const Notification& notification); 66 const Notification& notification);
70 67
71 private: 68 private:
72 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, CreateOrUpdateTest); 69 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, CreateOrUpdateTest);
73 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, 70 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest,
74 CreateOrUpdateTestSettingsButton); 71 CreateOrUpdateTestSettingsButton);
75 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, FormatContextMessageTest); 72 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, FormatContextMessageTest);
(...skipping 14 matching lines...) Expand all
90 87
91 void CreateOrUpdateTitleView(const Notification& notification); 88 void CreateOrUpdateTitleView(const Notification& notification);
92 void CreateOrUpdateMessageView(const Notification& notification); 89 void CreateOrUpdateMessageView(const Notification& notification);
93 void CreateOrUpdateContextMessageView(const Notification& notification); 90 void CreateOrUpdateContextMessageView(const Notification& notification);
94 void CreateOrUpdateSettingsButtonView(const Notification& notification); 91 void CreateOrUpdateSettingsButtonView(const Notification& notification);
95 void CreateOrUpdateProgressBarView(const Notification& notification); 92 void CreateOrUpdateProgressBarView(const Notification& notification);
96 void CreateOrUpdateListItemViews(const Notification& notification); 93 void CreateOrUpdateListItemViews(const Notification& notification);
97 void CreateOrUpdateIconView(const Notification& notification); 94 void CreateOrUpdateIconView(const Notification& notification);
98 void CreateOrUpdateImageView(const Notification& notification); 95 void CreateOrUpdateImageView(const Notification& notification);
99 void CreateOrUpdateActionButtonViews(const Notification& notification); 96 void CreateOrUpdateActionButtonViews(const Notification& notification);
100 void CreateOrUpdateCloseButtonView(const Notification& notification);
101 97
102 int GetMessageLineLimit(int title_lines, int width) const; 98 int GetMessageLineLimit(int title_lines, int width) const;
103 int GetMessageHeight(int width, int limit) const; 99 int GetMessageHeight(int width, int limit) const;
104 100
105 // Formats the context message to be displayed based on |context| 101 // Formats the context message to be displayed based on |context|
106 // so it shows as much information as possible 102 // so it shows as much information as possible
107 // given the space available in the ContextMessage section of the 103 // given the space available in the ContextMessage section of the
108 // notification. 104 // notification.
109 base::string16 FormatContextMessage(const Notification& notification) const; 105 base::string16 FormatContextMessage(const Notification& notification) const;
110 106
111 // Describes whether the view should display a hand pointer or not. 107 // Describes whether the view should display a hand pointer or not.
112 bool clickable_; 108 bool clickable_;
113 109
114 // Weak references to NotificationView descendants owned by their parents. 110 // Weak references to NotificationView descendants owned by their parents.
115 views::View* top_view_; 111 views::View* top_view_ = nullptr;
116 BoundedLabel* title_view_; 112 BoundedLabel* title_view_ = nullptr;
117 BoundedLabel* message_view_; 113 BoundedLabel* message_view_ = nullptr;
118 BoundedLabel* context_message_view_; 114 BoundedLabel* context_message_view_ = nullptr;
119 views::ImageButton* settings_button_view_; 115 views::ImageButton* settings_button_view_ = nullptr;
120 std::vector<views::View*> item_views_; 116 std::vector<views::View*> item_views_;
121 ProportionalImageView* icon_view_; 117 ProportionalImageView* icon_view_ = nullptr;
122 views::View* bottom_view_; 118 views::View* bottom_view_ = nullptr;
123 views::View* image_container_; 119 views::View* image_container_ = nullptr;
124 ProportionalImageView* image_view_; 120 ProportionalImageView* image_view_ = nullptr;
125 NotificationProgressBarBase* progress_bar_view_; 121 NotificationProgressBarBase* progress_bar_view_ = nullptr;
126 std::vector<NotificationButton*> action_buttons_; 122 std::vector<NotificationButton*> action_buttons_;
127 std::unique_ptr<views::ImageButton> close_button_;
128 std::vector<views::View*> separators_; 123 std::vector<views::View*> separators_;
129 124
130 DISALLOW_COPY_AND_ASSIGN(NotificationView); 125 DISALLOW_COPY_AND_ASSIGN(NotificationView);
131 }; 126 };
132 127
133 } // namespace message_center 128 } // namespace message_center
134 129
135 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ 130 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_
OLDNEW
« no previous file with comments | « ui/message_center/views/message_view.cc ('k') | ui/message_center/views/notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698