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

Unified Diff: ui/message_center/views/message_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/message_center/views/message_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/message_view.h
diff --git a/ui/message_center/views/message_view.h b/ui/message_center/views/message_view.h
index 1ee9122abb99d261495cd77369565a3d1cf4ef46..07da4e57285798824346c8274645bbab7392861e 100644
--- a/ui/message_center/views/message_view.h
+++ b/ui/message_center/views/message_view.h
@@ -46,10 +46,7 @@ class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView,
public views::ButtonListener {
public:
MessageView(MessageCenterController* controller,
- const std::string& notification_id,
- const NotifierId& notifier_id,
- const gfx::ImageSkia& small_image,
- const base::string16& display_source);
+ const Notification& notification);
~MessageView() override;
// Updates this view with the new data contained in the notification.
@@ -61,9 +58,9 @@ class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView,
// Creates a shadow around the notification.
void CreateShadowBorder();
- virtual bool IsCloseButtonFocused();
- virtual void RequestFocusOnCloseButton();
- virtual bool IsPinned();
+ bool IsCloseButtonFocused();
+ void RequestFocusOnCloseButton();
+ bool IsPinned();
void set_accessible_name(const base::string16& accessible_name) {
accessible_name_ = accessible_name;
@@ -98,17 +95,28 @@ class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView,
// Overridden from views::SlideOutView:
void OnSlideOut() override;
+ // Creates and add close button to view hierarchy when necessary. Derived
+ // classes should call this after its view hierarchy is populated to ensure
+ // it is on top of other views.
+ void CreateOrUpdateCloseButtonView(const Notification& notification);
+
views::ImageView* small_image() { return small_image_view_.get(); }
+ views::ImageButton* close_button() { return close_button_.get(); }
views::ScrollView* scroller() { return scroller_; }
MessageCenterController* controller() { return controller_; }
private:
+ // Changes the background color being used by |background_view_| and schedules
+ // a paint.
+ void SetDrawBackgroundAsActive(bool active);
+
MessageCenterController* controller_; // Weak, lives longer then views.
std::string notification_id_;
NotifierId notifier_id_;
- views::View* background_view_; // Owned by views hierarchy.
+ views::View* background_view_ = nullptr; // Owned by views hierarchy.
std::unique_ptr<views::ImageView> small_image_view_;
- views::ScrollView* scroller_;
+ std::unique_ptr<views::ImageButton> close_button_;
+ views::ScrollView* scroller_ = nullptr;
base::string16 accessible_name_;
@@ -116,10 +124,6 @@ class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView,
std::unique_ptr<views::Painter> focus_painter_;
- // Changes the background color being used by |background_view_| and schedules
- // a paint.
- void SetDrawBackgroundAsActive(bool active);
-
DISALLOW_COPY_AND_ASSIGN(MessageView);
};
« no previous file with comments | « no previous file | ui/message_center/views/message_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698