1// Copyright 2017 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 user events.
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
19import "components/sync/protocol/user_consent_types.proto";
20import "components/sync/protocol/gaia_password_reuse.proto";
21
22message UserEventSpecifics {
23  // Time of event, as measured by client in microseconds since Windows epoch.
24  optional int64 event_time_usec = 1;
25
26  // The |global_id| field of the associated navigation, if there is one.
27  optional int64 navigation_id = 2;
28
29  // On startup we generate a new random id to identify which FieldTrialEvents
30  // other events belonged to.
31  optional fixed64 session_id = 3;
32
33  // 4-7 reserved for future scalars.
34
35  // Used for testing and debugging EventLog system.
36  message Test {}
37
38  // Language detection output.
39  message LanguageDetection {
40    option deprecated = true;
41
42    message Language {
43      // ISO 639 language code will be used.
44      optional string language_code = 1;
45      // Whether the detected language is reliable, note this is determined by
46      // the CLD3.
47      optional bool is_reliable = 2;
48    }
49    // Top n languages. Typically we just log the top language, but for page
50    // that we're not confident about, we may log up to 3 top languages in
51    // descending order.
52    repeated Language detected_languages = 1;
53    // Adopted language code is the code of final determined language.
54    // It will be stored only if it's different from the first detected
55    // language.
56    optional string adopted_language_code = 2;
57  }
58
59  // User translated a page or interacted with translate suggestion.
60  message Translation {
61    option deprecated = true;
62
63    // Source language of the translation.
64    optional string from_language_code = 1;
65    // Target language of the translation.
66    optional string to_language_code = 2;
67    enum Interaction {
68      UNKNOWN = 0;
69      ACCEPT = 1;
70      DECLINE = 2;
71      // This happens when user scroll or click outside the UI without
72      // translation.
73      IGNORED = 3;
74      // This happens when user choose to close the translation window without
75      // translation.
76      DISMISSED = 4;
77      // User manually entered either language.
78      // In this case, from_language_code and to_language_code will be user
79      // chosen values.
80      MANUAL = 5;
81      // User choose to revert the translation, in this case, from_language_code
82      // and to_language_code will be previous chosen values.
83      TRANSLATION_REVERTED = 6;
84      // Automatically triggered translation.
85      // User sets always translate in user settings.
86      AUTO_TRANSLATION_BY_PREF = 7;
87      // User navigated through a click from a translated page.
88      AUTO_TRANSLATION_BY_LINK = 8;
89      // Failed to initialize the translate script, this can happen for iOS due
90      // to CSPs.
91      INITIALIZATION_ERROR = 9;
92    }
93    optional Interaction interaction = 3;
94  }
95
96  // User consented to the usage of a feature or denied/revoked a consent.
97  // This is not used anymore; consents were migrated to a separate data type.
98  // The message has to stay though since the server must keep supporting legacy
99  // consent formats like this.
100  // Next id: 14
101  message UserConsent {
102    option deprecated = true;
103
104    // =========================================================================
105    // Fields common to all Chrome User Consents.
106    // =========================================================================
107
108    // The UI language Chrome is using, represented as the IETF language tag
109    // defined in BCP 47. The region subtag is not included when it adds no
110    // distinguishing information to the language tag (e.g. both "en-US"
111    // and "fr" are correct here).
112    optional string locale = 4;
113
114    // The local time on the client when the user consent was recorded. The time
115    // as measured by client is given in microseconds since Windows epoch. This
116    // is needed since user consent recording may happen when a client is
117    // offline.
118    optional int64 client_consent_time_usec = 12;
119
120    // =========================================================================
121    // The specific consent type. Add new User Consent types to
122    // user_consent_types.proto.
123    // =========================================================================
124
125    oneof consent {
126      UserConsentTypes.SyncConsent sync_consent = 7;
127
128      UserConsentTypes.ArcBackupAndRestoreConsent
129          arc_backup_and_restore_consent = 8;
130
131      UserConsentTypes.ArcGoogleLocationServiceConsent
132          arc_location_service_consent = 9;
133
134      UserConsentTypes.ArcPlayTermsOfServiceConsent
135          arc_play_terms_of_service_consent = 10;
136
137      UserConsentTypes.UnifiedConsent unified_consent = 13;
138    }
139    reserved "arc_metrics_and_usage_consent";
140    reserved 11;
141
142    reserved 6;
143    reserved "account_id";
144
145    // =========================================================================
146    // Deprecated fields. Please do not use them !
147    // =========================================================================
148
149    // Which feature does the consent apply to?
150    enum Feature {
151      FEATURE_UNSPECIFIED = 0;
152      CHROME_SYNC = 1;
153      PLAY_STORE = 2;
154      BACKUP_AND_RESTORE = 3;
155      GOOGLE_LOCATION_SERVICE = 4;
156      CHROME_UNIFIED_CONSENT = 5;
157      // TODO(markusheintz): ASSISTANT_ACTIVITY_CONTROL was only added as
158      // emergency fallback. Remove if not needed.
159      ASSISTANT_ACTIVITY_CONTROL = 6;
160    }
161    optional Feature feature = 1 [deprecated = true];
162    // Ids of the strings of the consent text presented to the user.
163    repeated int32 description_grd_ids = 2 [deprecated = true];
164    // Id of the string of the UI element the user clicked when consenting.
165    optional int32 confirmation_grd_id = 3 [deprecated = true];
166    // Was the consent for |feature| given or not given (denied/revoked)?
167    optional UserConsentTypes.ConsentStatus status = 5 [deprecated = true];
168  }
169
170  // Logged when the user logs into Google, and at least once per 28d.
171  message GaiaPasswordCaptured {
172    enum EventTrigger {
173      UNSPECIFIED = 0;
174      // Event added because user logged in.
175      USER_LOGGED_IN = 1;
176      // Event added because 28d timer fired.
177      EXPIRED_28D_TIMER = 2;
178    }
179    optional EventTrigger event_trigger = 1;
180  }
181
182  message FlocIdComputed {
183    enum EventTrigger {
184      UNSPECIFIED = 0;
185      // Event added because the floc id is computed for the 1st floc session.
186      NEW = 1;
187      // Event added because the floc id is re-computed due to a long period of
188      // time has passed since the last computation.
189      REFRESHED = 2;
190      // Event added because the floc id is re-computed due to history deletion.
191      HISTORY_DELETE = 3;
192    }
193    optional EventTrigger event_trigger = 1;
194
195    // If not set, it means that the floc is disabled.
196    optional uint64 floc_id = 2;
197  }
198
199  oneof event {
200    Test test_event = 8;
201    LanguageDetection language_detection_event = 10 [deprecated = true];
202    Translation translation_event = 11 [deprecated = true];
203    UserConsent user_consent = 12 [deprecated = true];
204    // Happens when a user types their Google account password on another site.
205    GaiaPasswordReuse gaia_password_reuse_event = 104;
206    GaiaPasswordCaptured gaia_password_captured_event = 15;
207    FlocIdComputed floc_id_computed_event = 16;
208  }
209  reserved "field_trial_event";
210  reserved 9;
211}
212