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/notifications/notification_types.h" | 5 #include "ui/notifications/notification_types.h" |
6 | 6 |
7 namespace ui { | 7 namespace ui { |
8 | 8 |
9 namespace notifications { | 9 namespace notifications { |
10 | 10 |
11 const char kMessageIntentKey[] = "message_intent"; | 11 const char kMessageIntentKey[] = "message_intent"; |
12 const char kPriorityKey[] = "priority"; | 12 const char kPriorityKey[] = "priority"; |
13 const char kTimestampKey[] = "timestamp"; | 13 const char kTimestampKey[] = "timestamp"; |
14 const char kSecondIconUrlKey[] = "second_icon_url"; | 14 const char kSecondIconUrlKey[] = "second_icon_url"; |
15 const char kUnreadCountKey[] = "unread_count"; | 15 const char kUnreadCountKey[] = "unread_count"; |
16 const char kButtonOneTitleKey[] = "button_one_title"; | 16 const char kButtonOneTitleKey[] = "button_one_title"; |
17 const char kButtonOneIntentKey[] = "button_one_intent"; | 17 const char kButtonOneIntentKey[] = "button_one_intent"; |
18 const char kButtonTwoTitleKey[] = "button_two_title"; | 18 const char kButtonTwoTitleKey[] = "button_two_title"; |
19 const char kButtonTwoIntentKey[] = "button_two_intent"; | 19 const char kButtonTwoIntentKey[] = "button_two_intent"; |
20 const char kExpandedMessageKey[] = "expanded_message"; | 20 const char kExpandedMessageKey[] = "expanded_message"; |
21 const char kImageUrlKey[] = "image_url"; | 21 const char kImageUrlKey[] = "image_url"; |
22 const char kItemsKey[] = "items"; | 22 const char kItemsKey[] = "items"; |
23 const char kItemTitleKey[] = "title"; | 23 const char kItemTitleKey[] = "title"; |
24 const char kItemMessageKey[] = "message"; | 24 const char kItemMessageKey[] = "message"; |
25 | 25 |
26 const char kSimpleType[] = "simple"; | 26 const char kSimpleType[] = "simple"; |
27 const char kBaseFormatType[] = "base"; | 27 const char kBaseFormatType[] = "base"; |
| 28 const char kImageType[] = "image"; |
28 const char kMultipleType[] = "multiple"; | 29 const char kMultipleType[] = "multiple"; |
29 | 30 |
30 NotificationType StringToNotificationType(std::string& string_type) { | 31 NotificationType StringToNotificationType(std::string& string_type) { |
31 if (string_type == kSimpleType) | |
32 return NOTIFICATION_TYPE_SIMPLE; | |
33 if (string_type == kBaseFormatType) | |
34 return NOTIFICATION_TYPE_BASE_FORMAT; | |
35 if (string_type == kMultipleType) | |
36 return NOTIFICATION_TYPE_MULTIPLE; | |
37 | |
38 // In case of unrecognized string, fall back to most common type. | 32 // In case of unrecognized string, fall back to most common type. |
39 return NOTIFICATION_TYPE_SIMPLE; | 33 return (string_type == kSimpleType) ? NOTIFICATION_TYPE_SIMPLE : |
| 34 (string_type == kBaseFormatType) ? NOTIFICATION_TYPE_BASE_FORMAT : |
| 35 (string_type == kImageType) ? NOTIFICATION_TYPE_IMAGE : |
| 36 (string_type == kMultipleType) ? NOTIFICATION_TYPE_MULTIPLE : |
| 37 NOTIFICATION_TYPE_SIMPLE; |
40 } | 38 } |
41 | 39 |
42 } // namespace notifications | 40 } // namespace notifications |
43 | 41 |
44 } // namespace ui | 42 } // namespace ui |
OLD | NEW |