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

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

Issue 1979553003: Consolidate to use MessageView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: ui/message_center/views/notification_view.cc
diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc
index 3c20438a211aa61fff44a293142c75e29905e934..c128cc1a7d438f45ac657518972637ffd3f6e0ac 100644
--- a/ui/message_center/views/notification_view.cc
+++ b/ui/message_center/views/notification_view.cc
@@ -150,9 +150,9 @@ namespace message_center {
// NotificationView ////////////////////////////////////////////////////////////
// static
-NotificationView* NotificationView::Create(MessageCenterController* controller,
- const Notification& notification,
- bool top_level) {
+MessageView* NotificationView::Create(MessageCenterController* controller,
+ const Notification& notification,
+ bool top_level) {
switch (notification.type()) {
case NOTIFICATION_TYPE_BASE_FORMAT:
case NOTIFICATION_TYPE_IMAGE:
@@ -249,12 +249,11 @@ void NotificationView::SetAccessibleName(const Notification& notification) {
NotificationView::NotificationView(MessageCenterController* controller,
const Notification& notification)
- : MessageView(this,
+ : MessageView(controller,
notification.id(),
notification.notifier_id(),
notification.small_image().AsImageSkia(),
notification.display_source()),
- controller_(controller),
clickable_(notification.clickable()),
top_view_(NULL),
title_view_(NULL),
@@ -403,7 +402,7 @@ void NotificationView::ScrollRectToVisible(const gfx::Rect& rect) {
}
gfx::NativeCursor NotificationView::GetCursor(const ui::MouseEvent& event) {
- if (!clickable_ || !controller_->HasClickedListener(notification_id()))
+ if (!clickable_ || !controller()->HasClickedListener(notification_id()))
return views::View::GetCursor(event);
return views::GetNativeHandCursor();
@@ -427,20 +426,20 @@ void NotificationView::ButtonPressed(views::Button* sender,
std::string id(notification_id());
if (sender == settings_button_view_) {
- controller_->ClickOnSettingsButton(id);
+ controller()->ClickOnSettingsButton(id);
return;
}
// See if the button pressed was an action button.
for (size_t i = 0; i < action_buttons_.size(); ++i) {
if (sender == action_buttons_[i]) {
- controller_->ClickOnNotificationButton(id, i);
+ controller()->ClickOnNotificationButton(id, i);
return;
}
}
if (close_button_ && sender == close_button_.get()) {
- controller_->RemoveNotification(notification_id(), true); // By user.
+ controller()->RemoveNotification(notification_id(), true); // By user.
}
// Let the superclass handle everything else.
@@ -449,15 +448,6 @@ void NotificationView::ButtonPressed(views::Button* sender,
MessageView::ButtonPressed(sender, event);
}
-void NotificationView::ClickOnNotification(const std::string& notification_id) {
- controller_->ClickOnNotification(notification_id);
-}
-
-void NotificationView::RemoveNotification(const std::string& notification_id,
- bool by_user) {
- controller_->RemoveNotification(notification_id, by_user);
-}
-
void NotificationView::CreateOrUpdateTitleView(
const Notification& notification) {
if (notification.title().empty()) {

Powered by Google App Engine
This is Rietveld 408576698