From 040050d8067e0a6b8290b444584df649fd8f9a13 Mon Sep 17 00:00:00 2001
From: "miket@chromium.org"
 <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 14 Nov 2012 04:10:29 +0000
Subject: 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.

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.
  - The timestamp is hardcoded to "10:43 AM" for layout purposes. I need to do more research on the appropriate date-formatting facilities available to us, and from that back out the timestamp field format in the API itself.

Review URL: https://chromiumcodereview.appspot.com/11358144

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167589 0039d316-1c4b-4281-b951-d872f2087c98
---
 ui/notifications/notification_types.cc | 26 ++++++++++++++++++++++++--
 ui/notifications/notification_types.h  | 22 ++++++++++++++++------
 2 files changed, 40 insertions(+), 8 deletions(-)

(limited to 'ui/notifications')

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
-- 
cgit v1.1