Commit 4486e79b authored by vitaliii's avatar vitaliii Committed by Commit Bot

[Sync:Sharing] Wrap channels one-of into message.

This way it can be later extended easier (e.g. tag number space is
separate from outer SharingMessageSpecifics) and also passed as an
argument in C++ code.

This is the first step to start building SharingMessageSpecifics in
the bridge instead of doing this in Sharing code.

Changing tag numbers in the proto is fine, because
a) it is not used anywhere yet
b) it is not persisted anywhere anyway.

Bug: 1044537
Change-Id: I4201680cfd8149888efbc35da6fbb5a7969f436a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2013246
Auto-Submit: vitaliii <vitaliii@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733965}
parent 1c5fbefb
......@@ -795,24 +795,30 @@ VISIT_PROTO_FIELDS(const sync_pb::SessionWindow& proto) {
}
VISIT_PROTO_FIELDS(const sync_pb::SharingMessageSpecifics& proto) {
VISIT(fcm_channel_configuration);
VISIT(server_channel_configuration);
VISIT(channel_configuration);
VISIT_BYTES(payload);
}
VISIT_PROTO_FIELDS(
const sync_pb::SharingMessageSpecifics::ServerChannelConfiguration& proto) {
const sync_pb::SharingMessageSpecifics::ChannelConfiguration::
ServerChannelConfiguration& proto) {
VISIT(channel_id);
VISIT_BYTES(session_cookie);
}
VISIT_PROTO_FIELDS(
const sync_pb::SharingMessageSpecifics::FCMChannelConfiguration& proto) {
VISIT_PROTO_FIELDS(const sync_pb::SharingMessageSpecifics::
ChannelConfiguration::FCMChannelConfiguration& proto) {
VISIT(token);
VISIT(ttl);
VISIT(priority);
}
VISIT_PROTO_FIELDS(
const sync_pb::SharingMessageSpecifics::ChannelConfiguration& proto) {
VISIT(fcm);
VISIT(server);
}
VISIT_PROTO_FIELDS(const sync_pb::SyncCycleCompletedEventInfo& proto) {
VISIT(num_encryption_conflicts);
VISIT(num_hierarchy_conflicts);
......
......@@ -17,39 +17,43 @@ option optimize_for = LITE_RUNTIME;
package sync_pb;
message SharingMessageSpecifics {
message ServerChannelConfiguration {
// Where to send the message to.
optional string channel_id = 1;
// Optional cookie set on the original request.
optional bytes session_cookie = 2;
}
message ChannelConfiguration {
message ServerChannelConfiguration {
// Where to send the message to.
optional string channel_id = 1;
// Optional cookie set on the original request.
optional bytes session_cookie = 2;
}
message FCMChannelConfiguration {
// FCM registration token of target device.
optional string token = 1;
message FCMChannelConfiguration {
// FCM registration token of target device.
optional string token = 1;
// Time to live for a FCM message (in seconds) - if specified, the message
// will expire based on the TTL.
optional int32 ttl = 2;
// Time to live for a FCM message (in seconds) - if specified, the message
// will expire based on the TTL.
optional int32 ttl = 2;
// Priority level of a FCM message. 5 = normal, 10 = high.
optional int32 priority = 3;
}
// Priority level of a FCM message. 5 = normal, 10 = high.
optional int32 priority = 3;
}
oneof channel_configuration {
// FCM channel configuration. Message will be delivered as a FCM message.
FCMChannelConfiguration fcm_channel_configuration = 1;
oneof channel_configuration {
// FCM channel configuration. Message will be delivered as a FCM message.
FCMChannelConfiguration fcm = 1;
// Server channel configuration. Message will be delivered through server
// channel.
ServerChannelConfiguration server_channel_configuration = 2;
// Server channel configuration. Message will be delivered through server
// channel.
ServerChannelConfiguration server = 2;
}
}
optional ChannelConfiguration channel_configuration = 1;
// Payload encrypted using the target user keys according to WebPush
// encryption scheme. The payload has to be a valid
// chrome/browser/sharing/proto/sharing_message.proto serialized using
// SerializeToString.
optional bytes payload = 3;
optional bytes payload = 2;
}
// Used for the server to return fine grained commit errors back to the client.
......
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