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

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

Issue 2970953002: Revert of Use shared NotificationControlButtonsView for non-arc notification buttons (Closed)
Patch Set: Created 3 years, 5 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
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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "ui/message_center/message_center_export.h" 12 #include "ui/message_center/message_center_export.h"
13 #include "ui/message_center/views/message_view.h" 13 #include "ui/message_center/views/message_view.h"
14 #include "ui/views/controls/button/button.h" 14 #include "ui/views/controls/button/button.h"
15 #include "ui/views/controls/button/image_button.h" 15 #include "ui/views/controls/button/image_button.h"
16 #include "ui/views/view_targeter_delegate.h" 16 #include "ui/views/view_targeter_delegate.h"
17 17
18 namespace views { 18 namespace views {
19 class ImageView; 19 class ImageView;
20 class ProgressBar; 20 class ProgressBar;
21 } 21 }
22 22
23 namespace message_center { 23 namespace message_center {
24 24
25 class BoundedLabel; 25 class BoundedLabel;
26 class NotificationButton; 26 class NotificationButton;
27 class NotificationControlButtonsView;
28 class ProportionalImageView; 27 class ProportionalImageView;
29 28
30 // View that displays all current types of notification (web, basic, image, and 29 // View that displays all current types of notification (web, basic, image, and
31 // list) except the custom notification. Future notification types may be 30 // list) except the custom notification. Future notification types may be
32 // handled by other classes, in which case instances of those classes would be 31 // handled by other classes, in which case instances of those classes would be
33 // returned by the Create() factory method below. 32 // returned by the Create() factory method below.
34 class MESSAGE_CENTER_EXPORT NotificationView 33 class MESSAGE_CENTER_EXPORT NotificationView
35 : public MessageView, 34 : public MessageView,
36 public views::ButtonListener, 35 public views::ButtonListener,
37 public views::ViewTargeterDelegate { 36 public views::ViewTargeterDelegate {
(...skipping 13 matching lines...) Expand all
51 void OnMouseEntered(const ui::MouseEvent& event) override; 50 void OnMouseEntered(const ui::MouseEvent& event) override;
52 void OnMouseExited(const ui::MouseEvent& event) override; 51 void OnMouseExited(const ui::MouseEvent& event) override;
53 52
54 // Overridden from MessageView: 53 // Overridden from MessageView:
55 void UpdateWithNotification(const Notification& notification) override; 54 void UpdateWithNotification(const Notification& notification) override;
56 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 55 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
57 bool IsCloseButtonFocused() const override; 56 bool IsCloseButtonFocused() const override;
58 void RequestFocusOnCloseButton() override; 57 void RequestFocusOnCloseButton() override;
59 void UpdateControlButtonsVisibility() override; 58 void UpdateControlButtonsVisibility() override;
60 59
60 protected:
61 views::ImageButton* close_button() { return close_button_.get(); }
62
61 private: 63 private:
62 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, CreateOrUpdateTest); 64 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, CreateOrUpdateTest);
63 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, 65 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest,
64 CreateOrUpdateTestSettingsButton); 66 CreateOrUpdateTestSettingsButton);
65 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, FormatContextMessageTest); 67 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, FormatContextMessageTest);
66 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, SettingsButtonTest); 68 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, SettingsButtonTest);
67 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, TestLineLimits); 69 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, TestLineLimits);
68 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, TestIconSizing); 70 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, TestIconSizing);
69 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, TestImageSizing); 71 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, TestImageSizing);
70 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, UpdateButtonsStateTest); 72 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, UpdateButtonsStateTest);
71 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, UpdateButtonCountTest); 73 FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, UpdateButtonCountTest);
72 74
73 friend class NotificationViewTest; 75 friend class NotificationViewTest;
74 76
77 // views::ViewTargeterDelegate:
78 views::View* TargetForRect(views::View* root, const gfx::Rect& rect) override;
79
75 void CreateOrUpdateViews(const Notification& notification); 80 void CreateOrUpdateViews(const Notification& notification);
76 81
77 void CreateOrUpdateTitleView(const Notification& notification); 82 void CreateOrUpdateTitleView(const Notification& notification);
78 void CreateOrUpdateMessageView(const Notification& notification); 83 void CreateOrUpdateMessageView(const Notification& notification);
79 void CreateOrUpdateContextMessageView(const Notification& notification); 84 void CreateOrUpdateContextMessageView(const Notification& notification);
85 void CreateOrUpdateSettingsButtonView(const Notification& notification);
80 void CreateOrUpdateProgressBarView(const Notification& notification); 86 void CreateOrUpdateProgressBarView(const Notification& notification);
81 void CreateOrUpdateListItemViews(const Notification& notification); 87 void CreateOrUpdateListItemViews(const Notification& notification);
82 void CreateOrUpdateIconView(const Notification& notification); 88 void CreateOrUpdateIconView(const Notification& notification);
83 void CreateOrUpdateSmallIconView(const Notification& notification); 89 void CreateOrUpdateSmallIconView(const Notification& notification);
84 void CreateOrUpdateImageView(const Notification& notification); 90 void CreateOrUpdateImageView(const Notification& notification);
85 void CreateOrUpdateActionButtonViews(const Notification& notification); 91 void CreateOrUpdateActionButtonViews(const Notification& notification);
86 void UpdateControlButtonsVisibilityWithNotification( 92 void CreateOrUpdateCloseButtonView(const Notification& notification);
87 const Notification& notification);
88 93
89 int GetMessageLineLimit(int title_lines, int width) const; 94 int GetMessageLineLimit(int title_lines, int width) const;
90 int GetMessageHeight(int width, int limit) const; 95 int GetMessageHeight(int width, int limit) const;
91 96
92 // Formats the context message to be displayed based on |context| 97 // Formats the context message to be displayed based on |context|
93 // so it shows as much information as possible 98 // so it shows as much information as possible
94 // given the space available in the ContextMessage section of the 99 // given the space available in the ContextMessage section of the
95 // notification. 100 // notification.
96 base::string16 FormatContextMessage(const Notification& notification) const; 101 base::string16 FormatContextMessage(const Notification& notification) const;
97 102
98 // Describes whether the view should display a hand pointer or not. 103 // Describes whether the view should display a hand pointer or not.
99 bool clickable_; 104 bool clickable_;
100 105
101 // Weak references to NotificationView descendants owned by their parents. 106 // Weak references to NotificationView descendants owned by their parents.
102 views::View* top_view_ = nullptr; 107 views::View* top_view_ = nullptr;
103 BoundedLabel* title_view_ = nullptr; 108 BoundedLabel* title_view_ = nullptr;
104 BoundedLabel* message_view_ = nullptr; 109 BoundedLabel* message_view_ = nullptr;
105 BoundedLabel* context_message_view_ = nullptr; 110 BoundedLabel* context_message_view_ = nullptr;
111 views::ImageButton* settings_button_view_ = nullptr;
106 std::vector<views::View*> item_views_; 112 std::vector<views::View*> item_views_;
107 ProportionalImageView* icon_view_ = nullptr; 113 ProportionalImageView* icon_view_ = nullptr;
108 views::View* bottom_view_ = nullptr; 114 views::View* bottom_view_ = nullptr;
109 views::View* image_container_ = nullptr; 115 views::View* image_container_ = nullptr;
110 ProportionalImageView* image_view_ = nullptr; 116 ProportionalImageView* image_view_ = nullptr;
111 views::ProgressBar* progress_bar_view_ = nullptr; 117 views::ProgressBar* progress_bar_view_ = nullptr;
112 std::vector<NotificationButton*> action_buttons_; 118 std::vector<NotificationButton*> action_buttons_;
113 std::vector<views::View*> separators_; 119 std::vector<views::View*> separators_;
120 std::unique_ptr<views::ImageButton> close_button_ = nullptr;
114 std::unique_ptr<views::ImageView> small_image_view_; 121 std::unique_ptr<views::ImageView> small_image_view_;
115 NotificationControlButtonsView* control_buttons_view_;
116 122
117 DISALLOW_COPY_AND_ASSIGN(NotificationView); 123 DISALLOW_COPY_AND_ASSIGN(NotificationView);
118 }; 124 };
119 125
120 } // namespace message_center 126 } // namespace message_center
121 127
122 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_ 128 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_
OLDNEW
« no previous file with comments | « ui/message_center/views/notification_control_buttons_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