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