| // Copyright 2020 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| // |
| // Sync protocol datatype extension for sharing message. |
| |
| // If you change or add any fields in this file, update proto_visitors.h and |
| // potentially proto_enum_conversions.{h, cc}. |
| |
| syntax = "proto2"; |
| |
| option java_multiple_files = true; |
| option java_package = "org.chromium.components.sync.protocol"; |
| |
| option optimize_for = LITE_RUNTIME; |
| |
| import "components/sync/protocol/unencrypted_sharing_message.proto"; |
| |
| package sync_pb; |
| |
| message SharingMessageSpecifics { |
| // Unique identifier of message. |
| optional string message_id = 1; |
| |
| message ChannelConfiguration { |
| 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; |
| |
| // Priority level of a FCM message. 5 = normal, 10 = high. |
| optional int32 priority = 3; |
| } |
| |
| message ChimeChannelConfiguration { |
| // The channels supported for delivery in the notifications pipeline. |
| // Numbering should be kept in sync with |
| // google3/notifications/backend/proto/common/channel_types.proto. |
| enum ChimeChannelType { |
| CHANNEL_TYPE_UNSPECIFIED = 0; |
| // This uses the AppleSelection for selecting targets. |
| APPLE_PUSH = 2; |
| } |
| // The device registration token. For iOS, this should be the |
| // Apple device token. |
| optional bytes device_token = 1; |
| |
| // Channel for delivery. |
| optional ChimeChannelType channel_type = 2; |
| |
| // Identifies the type of this notification within Chime. |
| // The value of this field must correspond to a previously |
| // configured type for the "chrome_chime" client id at |
| // google3/googledata/notifications/config/clients/chrome_chime. |
| optional string type_id = 3; |
| |
| // RTID provided by Chime after user is registered. Required if message |
| // should target specific device, otherwise optional. |
| optional string representative_target_id = 4; |
| } |
| |
| oneof channel_configuration { |
| // FCM channel configuration. Message will be delivered as a FCM message. |
| FCMChannelConfiguration fcm = 1; |
| |
| // Opaque server channel configuration. Message will be delivered through |
| // server channel. |
| bytes server = 2; |
| |
| // Chime channel configuration. Message will be delivered through Chime. |
| ChimeChannelConfiguration chime = 3; |
| } |
| } |
| |
| optional ChannelConfiguration channel_configuration = 2; |
| |
| // Payload encrypted using the target user keys according to WebPush |
| // encryption scheme. The payload has to be a valid |
| // components/sharing_message/proto/sharing_message.proto serialized using |
| // SerializeToString. |
| optional bytes payload = 3; |
| |
| // Payload NOT encrypted. For encrypted payloads, use payload field. |
| optional UnencryptedSharingMessage unencrypted_payload = 4; |
| } |
| |
| // Used for the server to return fine grained commit errors back to the client. |
| message SharingMessageCommitError { |
| // This enum is used in histograms. Entries should not be renumbered and |
| // numeric values should never be reused. Also remember to update in |
| // tools/metrics/histograms/enums.xml SyncSharingMessageCommitErrorCode enum. |
| // LINT.IfChange(SyncSharingMessageCommitErrorCode) |
| enum ErrorCode { |
| NONE = 0; |
| INVALID_ARGUMENT = 1; |
| NOT_FOUND = 2; |
| INTERNAL = 3; |
| UNAVAILABLE = 4; |
| RESOURCE_EXHAUSTED = 5; |
| UNAUTHENTICATED = 6; |
| PERMISSION_DENIED = 7; |
| |
| // Client-specific error codes. |
| SYNC_TURNED_OFF = 8; |
| SYNC_NETWORK_ERROR = 9; |
| // Deprecated UMA bucket, prior to splitting between SYNC_SERVER_ERROR and |
| // SYNC_AUTH_ERROR. |
| DEPRECATED_SYNC_SERVER_OR_AUTH_ERROR = 10; |
| // Message wasn't committed before timeout. |
| SYNC_TIMEOUT = 11; |
| // Error code for server error or unparsable server response. |
| SYNC_SERVER_ERROR = 12; |
| // Auth error when communicating with the server. |
| SYNC_AUTH_ERROR = 13; |
| } |
| // LINT.ThenChange(/tools/metrics/histograms/metadata/sync/enums.xml:SyncSharingMessageCommitErrorCode) |
| |
| optional ErrorCode error_code = 1; |
| } |