1// Copyright 2020 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4//
5// Sync protocol datatype extension for sharing message.
6
7// If you change or add any fields in this file, update proto_visitors.h and
8// potentially proto_enum_conversions.{h, cc}.
9
10syntax = "proto2";
11
12option java_multiple_files = true;
13option java_package = "org.chromium.components.sync.protocol";
14
15option optimize_for = LITE_RUNTIME;
16
17package sync_pb;
18
19message SharingMessageSpecifics {
20  // Unique identifier of message.
21  optional string message_id = 1;
22
23  message ChannelConfiguration {
24    message FCMChannelConfiguration {
25      // FCM registration token of target device.
26      optional string token = 1;
27
28      // Time to live for a FCM message (in seconds) - if specified, the message
29      // will expire based on the TTL.
30      optional int32 ttl = 2;
31
32      // Priority level of a FCM message. 5 = normal, 10 = high.
33      optional int32 priority = 3;
34    }
35
36    oneof channel_configuration {
37      // FCM channel configuration. Message will be delivered as a FCM message.
38      FCMChannelConfiguration fcm = 1;
39
40      // Opaque server channel configuration. Message will be delivered through
41      // server channel.
42      bytes server = 2;
43    }
44  }
45
46  optional ChannelConfiguration channel_configuration = 2;
47
48  // Payload encrypted using the target user keys according to WebPush
49  // encryption scheme. The payload has to be a valid
50  // chrome/browser/sharing/proto/sharing_message.proto serialized using
51  // SerializeToString.
52  optional bytes payload = 3;
53}
54
55// Used for the server to return fine grained commit errors back to the client.
56message SharingMessageCommitError {
57  // This enum is used in histograms. Entries should not be renumbered and
58  // numeric values should never be reused. Also remember to update in
59  // tools/metrics/histograms/enums.xml SyncSharingMessageCommitErrorCode enum.
60  enum ErrorCode {
61    NONE = 0;
62    INVALID_ARGUMENT = 1;
63    NOT_FOUND = 2;
64    INTERNAL = 3;
65    UNAVAILABLE = 4;
66    RESOURCE_EXHAUSTED = 5;
67    UNAUTHENTICATED = 6;
68    PERMISSION_DENIED = 7;
69
70    // Client-specific error codes.
71    SYNC_TURNED_OFF = 8;
72    SYNC_NETWORK_ERROR = 9;
73    // Deprecated UMA bucket, prior to splitting between SYNC_SERVER_ERROR and
74    // SYNC_AUTH_ERROR.
75    DEPRECATED_SYNC_SERVER_OR_AUTH_ERROR = 10;
76    // Message wasn't committed before timeout.
77    SYNC_TIMEOUT = 11;
78    // Error code for server error or unparsable server response.
79    SYNC_SERVER_ERROR = 12;
80    // Auth error when communicating with the server.
81    SYNC_AUTH_ERROR = 13;
82  }
83
84  optional ErrorCode error_code = 1;
85}
86