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

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

Issue 1979583003: Support notifications with custom content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@messageview-close-button
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 d5ab98a08e1563eef9a8135f28fffff3c8890c33..8502965b5acfbe8445ce45c026cbf4bbfdfc50ec 100644
--- a/ui/message_center/views/notification_view.cc
+++ b/ui/message_center/views/notification_view.cc
@@ -28,6 +28,7 @@
#include "ui/message_center/notification_types.h"
#include "ui/message_center/views/bounded_label.h"
#include "ui/message_center/views/constants.h"
+#include "ui/message_center/views/custom_notification_view.h"
#include "ui/message_center/views/message_center_controller.h"
#include "ui/message_center/views/notification_button.h"
#include "ui/message_center/views/notification_progress_bar.h"
@@ -150,12 +151,18 @@ namespace message_center {
MessageView* NotificationView::Create(MessageCenterController* controller,
dewittj 2016/05/16 16:19:28 Seems weird that this function might return a Cust
xiyuan 2016/05/16 16:31:05 Makes sense. How about bring back MessageViewFacto
const Notification& notification,
bool top_level) {
+ MessageView* notification_view = nullptr;
switch (notification.type()) {
case NOTIFICATION_TYPE_BASE_FORMAT:
case NOTIFICATION_TYPE_IMAGE:
case NOTIFICATION_TYPE_MULTIPLE:
case NOTIFICATION_TYPE_SIMPLE:
case NOTIFICATION_TYPE_PROGRESS:
+ // All above roads lead to the generic NotificationView.
+ notification_view = new NotificationView(controller, notification);
+ break;
+ case NOTIFICATION_TYPE_CUSTOM:
+ notification_view = new CustomNotificationView(controller, notification);
break;
default:
// If the caller asks for an unrecognized kind of view (entirely possible
@@ -166,12 +173,9 @@ MessageView* NotificationView::Create(MessageCenterController* controller,
LOG(WARNING) << "Unable to fulfill request for unrecognized "
<< "notification type " << notification.type() << ". "
<< "Falling back to simple notification type.";
+ notification_view = new NotificationView(controller, notification);
}
- // Currently all roads lead to the generic NotificationView.
- NotificationView* notification_view =
- new NotificationView(controller, notification);
-
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
// Don't create shadows for notification toasts on linux wih aura.
if (top_level)

Powered by Google App Engine
This is Rietveld 408576698