chromium/components/sync/protocol/user_consent_specifics.proto

// Copyright 2018 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 user consents.

// 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;

package sync_pb;

import "components/sync/protocol/user_consent_types.proto";

// Next id: 18
message UserConsentSpecifics {
  // ===========================================================================
  // Fields common to all Chrome User Consents.
  // ===========================================================================

  // The UI language Chrome is using, represented as the IETF language tag
  // defined in BCP 47. The region subtag is not included when it adds no
  // distinguishing information to the language tag (e.g. both "en-US"
  // and "fr" are correct here).
  optional string locale = 4;

  // The local time on the client when the user consent was recorded. The time
  // as measured by client is given in microseconds since Windows epoch. This
  // is needed since user consent recording may happen when a client is
  // offline.
  optional int64 client_consent_time_usec = 12;

  // ===========================================================================
  // The specific consent type. Add new User Consent types to
  // user_consent_types.proto.
  // ===========================================================================

  oneof consent {
    UserConsentTypes.SyncConsent sync_consent = 7;

    UserConsentTypes.ArcBackupAndRestoreConsent arc_backup_and_restore_consent =
        8;

    UserConsentTypes.ArcGoogleLocationServiceConsent
        arc_location_service_consent = 9;

    UserConsentTypes.ArcPlayTermsOfServiceConsent
        arc_play_terms_of_service_consent = 10;

    UserConsentTypes.UnifiedConsent unified_consent = 13 [deprecated = true];

    UserConsentTypes.AssistantActivityControlConsent
        assistant_activity_control_consent = 14;

    UserConsentTypes.AccountPasswordsConsent account_passwords_consent = 15;

    UserConsentTypes.RecorderSpeakerLabelConsent
        recorder_speaker_label_consent = 17;
  }
  reserved "arc_metrics_and_usage_consent";
  reserved 11;
  reserved "autofill_assistant_consent";
  reserved 16;

  // ===========================================================================
  // Client only fields.
  // ===========================================================================
  // TODO(markusheintz): Refactor the code so that these fields can be moved out
  // of this message.

  // The account ID of the user who gave the consent. This field is used
  // by UserEventService to distinguish consents from different users,
  // as UserConsent does not get deleted when a user signs out. However,
  // it should be cleared before being sent over the wire, as the UserEvent
  // is sent over an authenticated channel, so this information would be
  // redundant.
  //
  // For semantics and usage of the |account_id| in the signin codebase,
  // see IdentityManager::GetPrimaryAccountId() or CoreAccountId.
  optional string account_id = 6;

  // ===========================================================================
  // Deprecated fields. Please do not use them!
  // They have to remain in the proto because the server must continue
  // supporting legacy consent formats like this.
  // ===========================================================================

  // Which feature does the consent apply to?
  enum Feature {
    FEATURE_UNSPECIFIED = 0;
    CHROME_SYNC = 1;
    PLAY_STORE = 2;
    BACKUP_AND_RESTORE = 3;
    GOOGLE_LOCATION_SERVICE = 4;
    CHROME_UNIFIED_CONSENT = 5;
    // TODO(markusheintz): ASSISTANT_ACTIVITY_CONTROL was only added for
    // compatibility with the Feature enum in UserEventSpecifics.UserConsent.
    // Delete this value once the value is deleted from the other proto.
    ASSISTANT_ACTIVITY_CONTROL = 6;
  }
  optional Feature feature = 1 [deprecated = true];
  // Ids of the strings of the consent text presented to the user.
  repeated int32 description_grd_ids = 2 [deprecated = true];
  // Id of the string of the UI element the user clicked when consenting.
  optional int32 confirmation_grd_id = 3 [deprecated = true];
  // Was the consent for |feature| given or not given (denied/revoked)?
  optional UserConsentTypes.ConsentStatus status = 5 [deprecated = true];
}