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