summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorpetewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-23 21:24:08 +0000
committerpetewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-23 21:24:08 +0000
commitd2cb1fde3883bd2aa4603b8ab4ea3a48f082aa9c (patch)
tree2384377746f2ee36bf8b916667e805e489e9898a /sync
parent87ed1b6a2f88506a7982386f3ba2bc679312fd8b (diff)
downloadchromium_src-d2cb1fde3883bd2aa4603b8ab4ea3a48f082aa9c.zip
chromium_src-d2cb1fde3883bd2aa4603b8ab4ea3a48f082aa9c.tar.gz
chromium_src-d2cb1fde3883bd2aa4603b8ab4ea3a48f082aa9c.tar.bz2
Make the protobuf data format for SyncedNotifications more useful, and change the code that depends on the protobuf format.
This change adapts to the new protobuffers, and renames the "coalescing_key" to "key". It changes the "READ" state to "Dismissed" to correspond to the new protobufs. It adds support for some new data, a header and a description. BUG=197114 Review URL: https://chromiumcodereview.appspot.com/12574010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/protocol/synced_notification_data.proto62
-rw-r--r--sync/protocol/synced_notification_render.proto143
2 files changed, 149 insertions, 56 deletions
diff --git a/sync/protocol/synced_notification_data.proto b/sync/protocol/synced_notification_data.proto
index 1b8112e..fed7ee7 100644
--- a/sync/protocol/synced_notification_data.proto
+++ b/sync/protocol/synced_notification_data.proto
@@ -26,31 +26,59 @@ message SyncedNotificationIdentifier {
optional string coalescing_key = 2;
}
-message SyncedNotification {
- // The unique identifier of the notification.
- optional SyncedNotificationIdentifier id = 1;
+message SyncedNotificationCreator {
+ // The gaia id of the creator. If a notification does not have a clear
+ // creator, skip this and follow the directions below to use a system creator.
+ optional int64 gaia_id = 1;
+
+ // Indicates that the creator is a "system" creator. Example of these are
+ // notifications sent to the user where the addressee is "Google", such as the
+ // "You have violated our TOS, and have 3 days to fix it or you'll lose your
+ // account" notifications. If is_system is set, gaia_id must not be set and
+ // instead the app_id field must be set.
+ optional bool is_system = 2;
+
+ // Only set this in the system-creator case.
+ optional string app_id = 3;
+}
+
+message SyncedNotificationRecipients {
+ repeated int64 gaia_id = 1;
+
+ // For now, only support gaia id recipients. Add more recipient types via
+ // 'repeated Type other_type = X' when necessary.
+}
+message SyncedNotification {
// A secondary type that is isolated within the same app_id.
//
// NOTE: For ASBE support purposes this must be in the format [A-Za-z_]+.
- optional string type = 2;
+ optional string type = 1;
// Whatever string the client entered during creation. If no external_id is
// specified, the notification can no longer be identified individually for
// fetching/deleting, etc...
- optional string external_id = 3;
+ optional string external_id = 2;
+
+ // The creator of the notification.
+ optional SyncedNotificationCreator creator = 3;
+
+ // TODO(petewil): This won't build. Import the relevant protobuf.
+ // optional MapData client_data = 4;
}
message CoalescedSyncedNotification {
- // The identifier used to identify individual coalesced notifications.
- optional SyncedNotificationIdentifier id = 1;
+ // An opaque string key used to identify individual coalesced notifications.
+ optional string key = 1;
+
+ optional string app_id = 2;
// All the notifications that are grouped together.
- repeated SyncedNotification notification = 2;
+ repeated SyncedNotification notification = 3;
// Data that is used directly by endpoints to render notifications in the case
// where no "native" app can handle the notification.
- optional SyncedNotificationRenderInfo render_info = 3;
+ optional SyncedNotificationRenderInfo render_info = 4;
// Read state will be per coalesced notification.
enum ReadState {
@@ -58,9 +86,21 @@ message CoalescedSyncedNotification {
READ = 2;
DISMISSED = 3;
}
- optional ReadState read_state = 4;
+ optional ReadState read_state = 5;
// The time when the LATEST notification of the coalesced notification is
// created (in milliseconds since the linux epoch).
- optional uint64 creation_time_msec = 5;
+ optional uint64 creation_time_msec = 6;
+
+ enum Priority {
+ LOW = 1;
+ STANDARD = 2;
+ HIGH = 3;
+ // We will most likely add at least one more priority in the near future.
+ };
+ optional Priority priority = 7;
}
+
+message SyncedNotificationList {
+ repeated CoalescedSyncedNotification coalesced_notification = 1;
+} \ No newline at end of file
diff --git a/sync/protocol/synced_notification_render.proto b/sync/protocol/synced_notification_render.proto
index 47dd6c8..ce5a721 100644
--- a/sync/protocol/synced_notification_render.proto
+++ b/sync/protocol/synced_notification_render.proto
@@ -16,68 +16,121 @@ package sync_pb;
// Data that is used directly by endpoints to render notifications in the case
// where no "native" app can handle the notification.
message SyncedNotificationRenderInfo {
- message Layout {
- enum LayoutType {
- TITLE_AND_SUBTEXT = 1;
- TITLE_AND_IMAGE = 2;
+
+ // Render information for the collapsed (summary) view of a coalesced
+ // notification.
+ message CollapsedInfo {
+ message SimpleCollapsedLayout {
+ // Application icon.
+ optional SyncedNotificationImage app_icon = 1;
+
+ // Profile image(s) of the notification creator(s) to show in the
+ // collapsed UI.
+ repeated SyncedNotificationProfileImage profile_image = 2;
+
+ // Heading - often the name(s) of the notification creator(s).
+ optional string heading = 3;
+
+ // Description - often the action that generated the notification.
+ optional string description = 4;
}
- optional LayoutType layout_type = 1;
+ optional SimpleCollapsedLayout simple_collapsed_layout = 1;
- message TitleAndSubtextData {
- optional string title = 1;
- // The icon to show on the left of the notification.
- optional SyncedNotificationIcon icon = 2;
- // Multiple lines of the sub-text.
- repeated string subtext = 3;
+ // The creation time of the notification in microseconds since the UNIX
+ // epoch.
+ optional uint64 creation_timestamp_usec = 2;
+
+ // The default destination target.
+ optional SyncedNotificationDestination default_destination = 3;
+
+ // Secondary destinations and actions grouped into a message to account for
+ // ordering.
+ message Target {
+ optional SyncedNotificationDestination destination = 1;
+ optional SyncedNotificationAction action = 2;
}
- optional TitleAndSubtextData title_and_subtext_data = 3;
+ repeated Target target = 4;
+ }
+ optional CollapsedInfo collapsed_info = 1;
- message TitleAndImageData {
+ // Render information for the expanded (detail) view of a coalesced
+ // notification.
+ message ExpandedInfo {
+ message SimpleExpandedLayout {
+ // Title - often the title of the underlying entity referred to by the
+ // notification(s).
optional string title = 1;
- optional SyncedNotificationImage image = 2;
+
+ // Text content - often a snippet of text from the underlying entity
+ // reference or the notification.
+ optional string text = 2;
+
+ // Media.
+ message Media {
+ // TOOD(jro): Do we need other media types?
+ optional SyncedNotificationImage image = 1;
+ }
+ repeated Media media = 3;
}
- optional TitleAndImageData title_and_image_data = 4;
- }
- optional Layout layout = 1;
+ optional SimpleExpandedLayout simple_expanded_layout = 1;
- // An Action encapsulates an UI component that trigger certain programmable
- // actions. Depending on the endpoint, this may show up as a html button,
- // "quick actions" in the Android notification drawer, a link, or even the
- // notification card itself (the "default" action case).
- message Action {
- // The description for the Action.
- optional string text = 1;
+ // Collapsed information for each notification in the coalesced group.
+ repeated CollapsedInfo collapsed_info = 2;
+ }
+ optional ExpandedInfo expanded_info = 2;
+}
- // The icon to use for the Action.
- optional SyncedNotificationIcon icon = 2;
+// A Destination is a target URL that the user can be taken to by clicking on or
+// selecting the notification or part thereof.
+message SyncedNotificationDestination {
+ // The description for the link to the destination.
+ optional string text = 1;
- // Specify whether the action should be a background action or
- // should open up a web page with the specified URL.
- optional bool is_background = 3;
+ // The icon to use for the link to the destination.
+ optional SyncedNotificationImage icon = 2;
- // The url to send users to when they trigger the action.
- optional string action_url = 4;
+ // The destination URL.
+ optional string url = 3;
- // If post_data is populated, this indicates that action_url should be
- // contacted via a POST rather than a GET.
- optional string post_data = 5;
- }
- // All the actions that can be triggered from this (coalesced) notification.
- // This is sorted by importance so depending on the end point, the first N
- // actions should be used (and the first action is the "default" action).
- // For default actions, the icon and text params are ignored.
- repeated Action action = 2;
+ // Optional label to aid accessibility.
+ optional string accessibility_label = 4;
+}
+
+// An Action encapsulates an UI component that trigger certain programmable
+// actions. Depending on the endpoint, this may show up as a HTML button, an
+// action button associated with the notification on native mobile, a link, or
+// even the notification card itself.
+message SyncedNotificationAction {
+ // The description for the Action.
+ optional string text = 1;
+
+ // The icon to use for the Action.
+ optional SyncedNotificationImage icon = 2;
+
+ // The URL that performs the action.
+ optional string url = 3;
+
+ // Additional request data.
+ optional string request_data = 4;
+
+ // Optional label to aid accessibility.
+ optional string accessibility_label= 5;
}
message SyncedNotificationImage {
+ // Note that the image may be from any source. Clients wishing to resize the
+ // image should ensure the image is proxied appropriately.
optional string url = 1;
- // This is somewhat made up - not sure what else apart from url do we need
- // about an image.
optional string alt_text = 2;
optional int32 preferred_width = 3;
optional int32 preferred_height = 4;
}
-message SyncedNotificationIcon {
- optional string url = 1;
-}
+message SyncedNotificationProfileImage {
+ // Url for the image.
+ optional string image_url = 1;
+ // Object id for the image.
+ optional string oid = 2;
+ // Name to display for this image.
+ optional string display_name = 3;
+} \ No newline at end of file