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/message_view_multiple.h" | |
11 #include "ui/message_center/notification_list.h" | 10 #include "ui/message_center/notification_list.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_MULTIPLE: | 23 case ui::notifications::NOTIFICATION_TYPE_MULTIPLE: |
24 return new MessageViewMultiple(list_delegate, notification); | 24 return new NotificationView(list_delegate, notification); |
25 case ui::notifications::NOTIFICATION_TYPE_SIMPLE: | 25 case ui::notifications::NOTIFICATION_TYPE_SIMPLE: |
26 return new MessageSimpleView(list_delegate, notification); | 26 return new MessageSimpleView(list_delegate, notification); |
27 | 27 |
28 default: | 28 default: |
29 // If the caller asks for an unrecognized kind of view (entirely possible | 29 // 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 | 30 // 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 | 31 // doesn't have the requested kind of notification template), we'll fall |
32 // back to the simplest kind of notification. | 32 // back to the simplest kind of notification. |
33 LOG(WARNING) << "Unable to fulfill request for unrecognized " | 33 LOG(WARNING) << "Unable to fulfill request for unrecognized " |
34 << "notification type " << notification.type << ". " | 34 << "notification type " << notification.type << ". " |
35 << "Falling back to simple notification type."; | 35 << "Falling back to simple notification type."; |
36 return new MessageSimpleView(list_delegate, notification); | 36 return new MessageSimpleView(list_delegate, notification); |
37 } | 37 } |
38 NOTREACHED(); | 38 NOTREACHED(); |
39 } | 39 } |
40 | 40 |
41 } // namespace message_center | 41 } // namespace message_center |
OLD | NEW |