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

Unified Diff: ui/message_center/views/notification_view.h

Issue 2547433002: Transfer responsibility for providing a close button for a notification to each implementation of M… (Closed)
Patch Set: WrapUnique -> MakeUnique Created 4 years 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/notification_view.h
diff --git a/ui/message_center/views/notification_view.h b/ui/message_center/views/notification_view.h
index 6d54895ac8e0e439ef2553ec560089c97c5037bb..6ce79c2870ce0922674f78902fe96b75132a3ac4 100644
--- a/ui/message_center/views/notification_view.h
+++ b/ui/message_center/views/notification_view.h
@@ -11,6 +11,8 @@
#include "base/macros.h"
#include "ui/message_center/message_center_export.h"
#include "ui/message_center/views/message_view.h"
+#include "ui/views/controls/button/button.h"
+#include "ui/views/controls/button/image_button.h"
#include "ui/views/view_targeter_delegate.h"
namespace views {
@@ -29,6 +31,7 @@ class ProportionalImageView;
// returned by the Create() factory method below.
class MESSAGE_CENTER_EXPORT NotificationView
: public MessageView,
+ public views::ButtonListener,
public views::ViewTargeterDelegate {
public:
NotificationView(MessageCenterController* controller,
@@ -46,6 +49,12 @@ class MESSAGE_CENTER_EXPORT NotificationView
// Overridden from MessageView:
void UpdateWithNotification(const Notification& notification) override;
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
+ bool IsCloseButtonFocused() const override;
+ void RequestFocusOnCloseButton() override;
+ bool IsPinned() const override;
+
+ protected:
+ views::ImageButton* close_button() { return close_button_.get(); }
private:
FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, CreateOrUpdateTest);
@@ -75,6 +84,7 @@ class MESSAGE_CENTER_EXPORT NotificationView
void CreateOrUpdateIconView(const Notification& notification);
void CreateOrUpdateImageView(const Notification& notification);
void CreateOrUpdateActionButtonViews(const Notification& notification);
+ void CreateOrUpdateCloseButtonView(const Notification& notification);
int GetMessageLineLimit(int title_lines, int width) const;
int GetMessageHeight(int width, int limit) const;
@@ -102,6 +112,7 @@ class MESSAGE_CENTER_EXPORT NotificationView
views::ProgressBar* progress_bar_view_ = nullptr;
std::vector<NotificationButton*> action_buttons_;
std::vector<views::View*> separators_;
+ std::unique_ptr<views::ImageButton> close_button_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(NotificationView);
};
« 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