| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/message_center/message_view_factory.h" | |
| 6 | |
| 7 #include "ui/message_center/base_format_view.h" | |
| 8 #include "ui/message_center/message_simple_view.h" | |
| 9 #include "ui/message_center/message_view.h" | |
| 10 #include "ui/message_center/notification_list.h" | |
| 11 #include "ui/message_center/notification_view.h" | |
| 12 #include "ui/notifications/notification_types.h" | |
| 13 | |
| 14 namespace message_center { | |
| 15 | |
| 16 // static | |
| 17 MessageView* MessageViewFactory::ViewForNotification( | |
| 18 const NotificationList::Notification& notification, | |
| 19 NotificationList::Delegate* list_delegate) { | |
| 20 switch (notification.type) { | |
| 21 case ui::notifications::NOTIFICATION_TYPE_BASE_FORMAT: | |
| 22 return new BaseFormatView(list_delegate, notification); | |
| 23 case ui::notifications::NOTIFICATION_TYPE_IMAGE: | |
| 24 return new NotificationView(list_delegate, notification); | |
| 25 case ui::notifications::NOTIFICATION_TYPE_MULTIPLE: | |
| 26 return new NotificationView(list_delegate, notification); | |
| 27 case ui::notifications::NOTIFICATION_TYPE_SIMPLE: | |
| 28 return new MessageSimpleView(list_delegate, notification); | |
| 29 | |
| 30 default: | |
| 31 // If the caller asks for an unrecognized kind of view (entirely possible | |
| 32 // if an application is running on an older version of this code that | |
| 33 // doesn't have the requested kind of notification template), we'll fall | |
| 34 // back to the simplest kind of notification. | |
| 35 LOG(WARNING) << "Unable to fulfill request for unrecognized " | |
| 36 << "notification type " << notification.type << ". " | |
| 37 << "Falling back to simple notification type."; | |
| 38 return new MessageSimpleView(list_delegate, notification); | |
| 39 } | |
| 40 NOTREACHED(); | |
| 41 } | |
| 42 | |
| 43 } // namespace message_center | |
| OLD | NEW |