summaryrefslogtreecommitdiffstats
path: root/ui/notifications
diff options
context:
space:
mode:
authormiket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-15 03:56:48 +0000
committermiket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-15 03:56:48 +0000
commit357b2331eee05e9f5e13c832c3ef5814bbf0d0ee (patch)
treea08aa0b609132f4e662173d342ea96596295be28 /ui/notifications
parent6ca243e5421486d5103338a2ba51e7df7ddc6a09 (diff)
downloadchromium_src-357b2331eee05e9f5e13c832c3ef5814bbf0d0ee.zip
chromium_src-357b2331eee05e9f5e13c832c3ef5814bbf0d0ee.tar.gz
chromium_src-357b2331eee05e9f5e13c832c3ef5814bbf0d0ee.tar.bz2
Reland 11358144 (Switch fields over to base format fields).
Continuing TODO items from a previous CL, remove the "extra_field" and "second_extra_field" keys from the API and replace with real keys from the Base Format View spec. Implement a rough layout that resembles the expanded mode of the view. (Broke win_aura on original landing, now adds dependency on base.gyp:base_i18n.) Outstanding items: - As stated above, the layout is still ugly. - We don't gracefully handle empty buttons. We don't crash, either, but it looks even uglier when the buttons are missing. - The buttons don't do anything when the user clicks on them. - The second icon is just a redraw of the first. TBR=mukai@chromium.org BUG=161038 Review URL: https://chromiumcodereview.appspot.com/11312241 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167851 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/notifications')
-rw-r--r--ui/notifications/notification_types.cc26
-rw-r--r--ui/notifications/notification_types.h22
2 files changed, 40 insertions, 8 deletions
diff --git a/ui/notifications/notification_types.cc b/ui/notifications/notification_types.cc
index b4f0c83..9ec43c8 100644
--- a/ui/notifications/notification_types.cc
+++ b/ui/notifications/notification_types.cc
@@ -8,8 +8,30 @@ namespace ui {
namespace notifications {
-const char kExtraFieldKey[] = "extra_field";
-const char kSecondExtraFieldKey[] = "second_extra_field";
+const char kMessageIntentKey[] = "message_intent";
+const char kPriorityKey[] = "priority";
+const char kTimestampKey[] = "timestamp";
+const char kSecondIconUrlKey[] = "second_icon_url";
+const char kUnreadCountKey[] = "unread_count";
+const char kButtonOneTitleKey[] = "button_one_title";
+const char kButtonOneIntentKey[] = "button_one_intent";
+const char kButtonTwoTitleKey[] = "button_two_title";
+const char kButtonTwoIntentKey[] = "button_two_intent";
+const char kExpandedMessageKey[] = "expanded_message";
+const char kImageUrlKey[] = "image_url";
+
+const char kSimpleType[] = "simple";
+const char kBaseFormatType[] = "base";
+
+NotificationType StringToNotificationType(std::string& string_type) {
+ if (string_type == kSimpleType)
+ return NOTIFICATION_TYPE_SIMPLE;
+ if (string_type == kBaseFormatType)
+ return NOTIFICATION_TYPE_BASE_FORMAT;
+
+ // In case of unrecognized string, fall back to most common type.
+ return NOTIFICATION_TYPE_SIMPLE;
+}
} // namespace notifications
diff --git a/ui/notifications/notification_types.h b/ui/notifications/notification_types.h
index d1c9725..049628f 100644
--- a/ui/notifications/notification_types.h
+++ b/ui/notifications/notification_types.h
@@ -5,24 +5,34 @@
#ifndef UI_NOTIFICATIONS_NOTIFICATION_TYPES_H_
#define UI_NOTIFICATIONS_NOTIFICATION_TYPES_H_
+#include <string>
+
#include "ui/base/ui_export.h"
namespace ui {
namespace notifications {
-// TODO(miket): these are temporary field names that will be replaced very
-// shortly with real names. See
-// chrome/browser/extensions/api/notification/notification_api.cc for more
-// context.
-UI_EXPORT extern const char kExtraFieldKey[];
-UI_EXPORT extern const char kSecondExtraFieldKey[];
+// Keys for optional fields in Notification.
+UI_EXPORT extern const char kMessageIntentKey[];
+UI_EXPORT extern const char kPriorityKey[];
+UI_EXPORT extern const char kTimestampKey[];
+UI_EXPORT extern const char kSecondIconUrlKey[];
+UI_EXPORT extern const char kUnreadCountKey[];
+UI_EXPORT extern const char kButtonOneTitleKey[];
+UI_EXPORT extern const char kButtonOneIntentKey[];
+UI_EXPORT extern const char kButtonTwoTitleKey[];
+UI_EXPORT extern const char kButtonTwoIntentKey[];
+UI_EXPORT extern const char kExpandedMessageKey[];
+UI_EXPORT extern const char kImageUrlKey[];
enum NotificationType {
NOTIFICATION_TYPE_SIMPLE,
NOTIFICATION_TYPE_BASE_FORMAT,
};
+UI_EXPORT NotificationType StringToNotificationType(std::string& string_type);
+
} // namespace notifications
} // namespace ui