Commit 2bb71073 authored by petewil@chromium.org's avatar petewil@chromium.org

Update to latest protobufs to match the server side.

To unlock features with seen/unseen state, hidpi screens, and locale awareness,
update to the latest version of the protobuf used by the server side.

BUG=305901

Review URL: https://codereview.chromium.org/217203003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261499 0039d316-1c4b-4281-b951-d872f2087c98
parent 66117a66
...@@ -82,7 +82,7 @@ extern const char kContainedMessage2[]; ...@@ -82,7 +82,7 @@ extern const char kContainedMessage2[];
extern const char kContainedMessage3[]; extern const char kContainedMessage3[];
const uint64 kFakeCreationTime = 42; const uint64 kFakeCreationTime = 42;
const int kProtobufPriority = static_cast<int>( const int kProtobufPriority = static_cast<int>(
sync_pb::CoalescedSyncedNotification_Priority_LOW); sync_pb::CoalescedSyncedNotification_Priority_INVISIBLE);
const sync_pb::CoalescedSyncedNotification_ReadState kRead = const sync_pb::CoalescedSyncedNotification_ReadState kRead =
sync_pb::CoalescedSyncedNotification_ReadState_READ; sync_pb::CoalescedSyncedNotification_ReadState_READ;
......
...@@ -505,10 +505,10 @@ int SyncedNotification::GetPriority() const { ...@@ -505,10 +505,10 @@ int SyncedNotification::GetPriority() const {
// Convert the prioroty to the scheme used by the notification center. // Convert the prioroty to the scheme used by the notification center.
if (protobuf_priority == if (protobuf_priority ==
sync_pb::CoalescedSyncedNotification_Priority_LOW) { sync_pb::CoalescedSyncedNotification_Priority_INVISIBLE) {
return message_center::LOW_PRIORITY; return message_center::LOW_PRIORITY;
} else if (protobuf_priority == } else if (protobuf_priority ==
sync_pb::CoalescedSyncedNotification_Priority_STANDARD) { sync_pb::CoalescedSyncedNotification_Priority_LOW) {
return message_center::DEFAULT_PRIORITY; return message_center::DEFAULT_PRIORITY;
} else if (protobuf_priority == } else if (protobuf_priority ==
sync_pb::CoalescedSyncedNotification_Priority_HIGH) { sync_pb::CoalescedSyncedNotification_Priority_HIGH) {
...@@ -516,7 +516,7 @@ int SyncedNotification::GetPriority() const { ...@@ -516,7 +516,7 @@ int SyncedNotification::GetPriority() const {
} else { } else {
// Complain if this is a new priority we have not seen before. // Complain if this is a new priority we have not seen before.
DCHECK(protobuf_priority < DCHECK(protobuf_priority <
sync_pb::CoalescedSyncedNotification_Priority_LOW || sync_pb::CoalescedSyncedNotification_Priority_INVISIBLE ||
sync_pb::CoalescedSyncedNotification_Priority_HIGH < sync_pb::CoalescedSyncedNotification_Priority_HIGH <
protobuf_priority); protobuf_priority);
return kUndefinedPriority; return kUndefinedPriority;
......
...@@ -21,14 +21,36 @@ message SyncedNotificationAppInfoSpecifics { ...@@ -21,14 +21,36 @@ message SyncedNotificationAppInfoSpecifics {
} }
message SyncedNotificationAppInfo { message SyncedNotificationAppInfo {
// The application ID of a subservice within the notification sending service. // The application ID (the subservice within the sending service).
repeated string app_id = 1; repeated string app_id = 1;
// The name to use in the settings screen for this app. // The name to use in the settings screen for this app.
optional string settings_display_name = 2; // Use app_name field instead.
optional string settings_display_name = 2 [deprecated = true];
// The icon to use. The URL of the icon may point to a // This field is deprecated. Use the app_icon field instead.
// hi-res image, so clients should always size the image to the optional SyncedNotificationImage icon = 3 [deprecated = true];
// preferred width and height specified in the Image proto.
optional SyncedNotificationImage icon = 3; optional string app_name = 4;
optional string settings_url = 5;
optional string info_url = 6;
message Icon {
enum Type {
GRAYSCALE_FAVICON_1X = 1; // Grayscale 16x16 px icon.
GRAYSCALE_FAVICON_2X = 2; // Grayscale 32x32 px icon.
COLOR_FAVICON_1X = 3; // Color 16x16 px icon.
COLOR_FAVICON_2X = 4; // Color 32x32 px icon.
COLOR_APPICON_1X = 5; // Color 80x80 px icon.
COLOR_APPICON_2X = 6; // Color 160x160 px icon.
};
optional Type type = 1;
optional string url = 2;
};
// A repeated set of icons of different resolutions and types.
repeated Icon app_icon = 7;
} }
\ No newline at end of file
...@@ -85,20 +85,36 @@ message CoalescedSyncedNotification { ...@@ -85,20 +85,36 @@ message CoalescedSyncedNotification {
UNREAD = 1; UNREAD = 1;
READ = 2; READ = 2;
DISMISSED = 3; DISMISSED = 3;
SEEN = 4;
} }
optional ReadState read_state = 5; optional ReadState read_state = 5;
// The time when the LATEST notification of the coalesced notification is // The time when the LATEST notification of the coalesced notification is
// created (in milliseconds since the linux epoch). // created (in milliseconds since the linux epoch).
// This is called updated_version in the server side protobuf.
optional uint64 creation_time_msec = 6; optional uint64 creation_time_msec = 6;
enum Priority { enum Priority {
LOW = 1; INVISIBLE = 1;
STANDARD = 2; LOW = 2;
HIGH = 3; HIGH = 3;
// We will most likely add at least one more priority in the near future. // We will most likely add at least one more priority in the near future.
}; };
optional Priority priority = 7; optional Priority priority = 7;
// Security token that is to be used when making a PerformUserAction request
// when any user action within this coalesced notification is triggered.
optional string user_action_token = 8;
// This field corresponds to catchup_version in entity, which represents the
// version entity was last modified. Note that the
// Entity.last_modified_version will be actually the last creation version.
// See comments in updated_version.
optional uint64 last_modified_version = 9;
// Clients should use this field to order the notifications. Currently this is
// calculated from (priority, updated_version) pair.
optional uint64 sort_version = 10;
} }
message SyncedNotificationList { message SyncedNotificationList {
...@@ -127,4 +143,65 @@ message Data { ...@@ -127,4 +143,65 @@ message Data {
message ListData { message ListData {
repeated Data value = 1; repeated Data value = 1;
};
// The RenderContext encapsulates data about the device that is displaying the
// notification. In the future, RenderContext might include data like the
// location of the user.
message RenderContext {
// The type of the device. This will be used to decide the resolution as well
// as the size of the image returned with the response.
// The server will try to find the closest matching resource to use.
// The android densities are from
// http://developer.android.com/guide/practices/screens_support.html
enum DeviceType {
UNKNOWN = 0;
IOS_NON_RETINA = 1;
IOS_RETINA = 2;
ANDROID_MDPI = 3;
ANDROID_HDPI = 4;
ANDROID_XHDPI = 5;
ANDROID_TVDPI = 6;
DESKTOP_NON_RETINA = 7;
DESKTOP_RETINA = 8;
ANDROID_XXHDPI = 9;
CHROME_1X = 10;
CHROME_2X = 11;
}
optional DeviceType device_type = 1;
// The locale to render the notifications in.
optional string language_code = 2;
};
// List of AppIds and whether to treat the list as a Whitelist or Blacklist.
message AppList {
enum Type {
// Specified app_ids are supported.
WHITELIST = 1;
// Specified app_ids are not supported.
BLACKLIST = 2;
}
// Whether to treat the app_id list as a Whitelist or Blacklist.
optional Type type = 1 [default = WHITELIST];
// List of AppIds.
repeated string app_id = 2;
};
message ServerContext {
// render_context encapsulates data about the device that is displaying the
// notifications.
optional RenderContext render_context = 1;
// List of AppIds and whether it is a blacklist or whitelist.
// This field needs to be set only when the set of apps enabled on a client
// changes. In the server response, this field will get cleared.
optional AppList app_list = 2;
// The view that the device has registered with. It is obtained from guns
// based on the app_list specified above.
optional string view_id = 3;
}; };
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment