chromium/components/sync/protocol/sync_enums.proto

// Copyright 2012 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 for communication between sync client and server.

// If you change or add any enums in this file, update
// proto_enum_conversions.{h, cc}.
// If you deprecate enum or enum values, mark any corresponding entry in
// tools/metrics/histograms/enums.xml as <obsolete>.

syntax = "proto2";

option java_multiple_files = true;
option java_package = "org.chromium.components.sync.protocol";

option optimize_for = LITE_RUNTIME;

package sync_pb;

message SyncEnums {
  // These events are sent by the DebugInfo class for singleton events.
  enum SingletonDebugEventType {
    // Connection status change. Note this gets generated even during a
    // successful connection.
    CONNECTION_STATUS_CHANGE = 1;
    // Client received an updated token.
    UPDATED_TOKEN = 2;
    // Cryptographer needs passphrase.
    PASSPHRASE_REQUIRED = 3;
    // Passphrase was accepted by cryptographer.
    PASSPHRASE_ACCEPTED = 4;
    // Sync Initialization is complete.
    INITIALIZATION_COMPLETE = 5;
    // Server sent stop syncing permanently. This event should never be seen by
    // the server in the absence of bugs.
    STOP_SYNCING_PERMANENTLY = 6;
    // Client has finished encrypting all data.
    // DEPRECATED_ENCRYPTION_COMPLETE = 7;
    // Client received an actionable error.
    ACTIONABLE_ERROR = 8;
    // Set of encrypted types has changed.
    ENCRYPTED_TYPES_CHANGED = 9;
    // The encryption passphrase state changed.
    PASSPHRASE_TYPE_CHANGED = 10;
    // A new keystore encryption token was persisted. Deprecated 11/2021.
    DEPRECATED_KEYSTORE_TOKEN_UPDATED = 11;
    // The datatype manager has finished an at least partially successful
    // configuration and is once again syncing with the server.
    CONFIGURE_COMPLETE = 12;
    // A new cryptographer bootstrap token was generated.
    DEPRECATED_BOOTSTRAP_TOKEN_UPDATED = 13;
    // Cryptographer needs trusted vault decryption keys.
    TRUSTED_VAULT_KEY_REQUIRED = 14;
    // Cryptographer no longer needs trusted vault decryption keys.
    TRUSTED_VAULT_KEY_ACCEPTED = 15;
  }

  // See ui/base/page_transition_types.h for detailed information on the
  // values of PageTransition and PageTransitionRedirectType below.

  // Types of transitions between pages.
  enum PageTransition {
    LINK = 0;
    TYPED = 1;
    AUTO_BOOKMARK = 2;
    AUTO_SUBFRAME = 3;
    MANUAL_SUBFRAME = 4;
    GENERATED = 5;
    AUTO_TOPLEVEL = 6;
    FORM_SUBMIT = 7;
    RELOAD = 8;
    KEYWORD = 9;
    KEYWORD_GENERATED = 10;
    // The below two were mistakenly added but never properly used. They are
    // actually transition qualifiers, and are set independently of other
    // qualifiers and of the main transitions. See session_specifics.proto for
    // the list of synced transition qualifiers.
    // DEPRECATED_CHAIN_START = 12;
    // DEPRECATED_CHAIN_END = 13;
  }

  // Types of redirects that triggered a transition.
  enum PageTransitionRedirectType {
    CLIENT_REDIRECT = 1;
    SERVER_REDIRECT = 2;
  }

  enum ErrorType {
    SUCCESS = 0;
    // DEPRECATED_ACCESS_DENIED = 1;
    // Returned when the server and client disagree on the store birthday. This
    // should be interpreted as all local sync metadata requiring cleanup,
    // obviously including the locally-cached store birthday.
    NOT_MY_BIRTHDAY = 2;
    // Returned when the store has exceeded the allowed bandwidth utilization.
    THROTTLED = 3;
    // DEPRECATED_AUTH_EXPIRED = 4;
    // DEPRECATED_USER_NOT_ACTIVATED = 5;
    // DEPRECATED_AUTH_INVALID = 6;
    // DEPRECATED_CLEAR_PENDING = 7;
    // A transient error occurred (e.g. a backend timeout). The client should
    // try again later.
    TRANSIENT_ERROR = 8;
    // A server-side migration has taken place for one or more data types. The
    // client should clear the cache for these data types only and then re-sync
    // with a server.
    MIGRATION_DONE = 9;
    // An administrator disabled sync for this domain.
    DISABLED_BY_ADMIN = 10;
    // Deprecated in M50.
    // DEPRECATED_USER_ROLLBACK = 11;
    // Returned when the client wants to update several data types, but some of
    // them failed (e.g. throttled).
    PARTIAL_FAILURE = 12;
    // Returned when the server detects that this client's sync metadata is
    // obsolete. The client should reset local sync metadata and restart
    // syncing.
    CLIENT_DATA_OBSOLETE = 13;
    // Returned when the server detects that the encryption state (Nigori,
    // keystore keys) has been reset/overridden, which means the local
    // Nigori-related state is obsolete and should be cleared.
    // Introduced in M84.
    ENCRYPTION_OBSOLETE = 14;
    // Unknown value. This should never be explicitly used; it is the default
    // value when an out-of-date client parses a value it doesn't recognize.
    UNKNOWN = 100;
  }

  enum Action {
    UPGRADE_CLIENT = 0;  // Upgrade the client to latest version.
    // DEPRECATED_CLEAR_USER_DATA_AND_RESYNC = 1;
    // DEPRECATED_ENABLE_SYNC_ON_ACCOUNT = 2;
    // DEPRECATED_STOP_AND_RESTART_SYNC = 3;
    // DEPRECATED_DISABLE_SYNC_ON_CLIENT = 4;
    UNKNOWN_ACTION = 5;  // This is the default.
  }

  // New enums to describe the device type were introduced; OsType and
  // FormFactor. Deprecated 12/2022.
  // TODO(crbug.com/40882073): Remove deprecated values from DeviceType enum.
  enum DeviceType {
    TYPE_UNSET = 0 [deprecated = true];
    TYPE_WIN = 1 [deprecated = true];
    TYPE_MAC = 2 [deprecated = true];
    TYPE_LINUX = 3 [deprecated = true];
    TYPE_CROS = 4 [deprecated = true];
    TYPE_OTHER = 5 [deprecated = true];
    TYPE_PHONE = 6 [deprecated = true];
    TYPE_TABLET = 7 [deprecated = true];
  }

  // Types of device OS.
  enum OsType {
    OS_TYPE_UNSPECIFIED = 0;
    OS_TYPE_WINDOWS = 1;
    OS_TYPE_MAC = 2;
    OS_TYPE_LINUX = 3;
    OS_TYPE_CHROME_OS_ASH = 4;
    OS_TYPE_ANDROID = 5;
    OS_TYPE_IOS = 6;
    OS_TYPE_CHROME_OS_LACROS = 7;
    OS_TYPE_FUCHSIA = 8;
  }

  // Types of device form factors.
  enum DeviceFormFactor {
    DEVICE_FORM_FACTOR_UNSPECIFIED = 0;
    DEVICE_FORM_FACTOR_DESKTOP = 1;
    DEVICE_FORM_FACTOR_PHONE = 2;
    DEVICE_FORM_FACTOR_TABLET = 3;
    DEVICE_FORM_FACTOR_AUTOMOTIVE = 4;
    DEVICE_FORM_FACTOR_WEARABLE = 5;
    DEVICE_FORM_FACTOR_TV = 6;
  }

  // Types of browsers; used for history-related data types.
  enum BrowserType {
    BROWSER_TYPE_UNKNOWN = 0;
    TYPE_TABBED = 1;      // A normal tabbed window.
    TYPE_POPUP = 2;       // A popup window.
    TYPE_CUSTOM_TAB = 3;  // A custom tab within an app.
    TYPE_AUTH_TAB = 4;    // A auth-dedicated custom tab within an app.
  }

  // The "password state" is the presence/absence of a password field on a
  // website; used for history-related data types.
  enum PasswordState {
    PASSWORD_STATE_UNKNOWN = 0;
    NO_PASSWORD_FIELD = 1;
    HAS_PASSWORD_FIELD = 2;
  }

  // This is the successor to GetUpdatesSource.  It merges the "normal mode"
  // values (LOCAL, NOTIFICATION and DATATYPE_REFRESH), which were never really
  // mutually exclusive to being with, into the GU_TRIGGER value.  It also
  // drops support for some old values that are not supported by newer clients.
  //
  // Mind the gaps: Some values are intentionally unused because we want to
  // keep the values in sync with GetUpdatesSource as much as possible.  Please
  // don't add any values < 12 unless there's a good reason for it.
  //
  // Introduced in M28.
  // LINT.IfChange(SyncGetUpdatesOrigin)
  enum GetUpdatesOrigin {
    UNKNOWN_ORIGIN = 0;  // The source was not set by the caller.
    PERIODIC = 4;        // The source of the update was periodic polling.
    NEWLY_SUPPORTED_DATATYPE = 7;  // The client is in configuration mode
                                   // because it's syncing all datatypes, and
                                   // support for a new datatype was recently
                                   // released via a software auto-update.
    MIGRATION = 8;         // The client is in configuration mode because a
                           // MIGRATION_DONE error previously returned by the
                           // server necessitated resynchronization.
    NEW_CLIENT = 9;        // The client is in configuration mode because the
                           // user enabled sync for the first time.  Not to be
                           // confused with FIRST_UPDATE.
    RECONFIGURATION = 10;  // The client is in configuration mode because the
                           // user opted to sync a different set of datatypes.
    GU_TRIGGER = 12;  // The client is in 'normal' mode.  It may have several
                      // reasons for requesting an update.  See the per-type
                      // GetUpdateTriggers message for more details.
    RETRY = 13;       // A retry GU to pick up updates missed by last GU due to
                      // replication delay, missing hints, etc.
    PROGRAMMATIC = 14;  // A GU to programmatically enable/disable a
                        // datatype, often due to error handling.
  }
  // LINT.ThenChange(/tools/metrics/histograms/metadata/sync/enums.xml:SyncGetUpdatesOrigin)

  // Type of message sent to the receiving device for the send tab to self
  // feature.
  enum SendTabReceivingType {
    // Send tab notification can be received as an in-app message. This is the
    // default value.
    SEND_TAB_RECEIVING_TYPE_CHROME_OR_UNSPECIFIED = 0;
    // Send tab notification can be received as a push notification and/or
    // in-app message.
    SEND_TAB_RECEIVING_TYPE_CHROME_AND_PUSH_NOTIFICATION = 1;
  }
}