chromium/components/sync/protocol/saved_tab_group_specifics.proto

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// 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/tab_group_attribution_metadata.proto";

// Sync protocol datatype extension for saved tab groups. Saved Tab Groups are
// tab groups which can be recalled between browser sessions, and if sync is
// turned on, cross device. A saved tab group contains tabs which are stored as
// a SavedTabGroupSpecifics separately (SavedTabGroupTab). This is due to
// limitations from the sync service on the size of an individual sync entity.
message SavedTabGroup {
  // These colors map to tab_groups::TabGroupColorId. They DO NOT match the enum
  // integer values due to "kGrey" being in the "Unspecified" field.
  enum SavedTabGroupColor {
    SAVED_TAB_GROUP_COLOR_UNSPECIFIED = 0;
    SAVED_TAB_GROUP_COLOR_GREY = 1;
    SAVED_TAB_GROUP_COLOR_BLUE = 2;
    SAVED_TAB_GROUP_COLOR_RED = 3;
    SAVED_TAB_GROUP_COLOR_YELLOW = 4;
    SAVED_TAB_GROUP_COLOR_GREEN = 5;
    SAVED_TAB_GROUP_COLOR_PINK = 6;
    SAVED_TAB_GROUP_COLOR_PURPLE = 7;
    SAVED_TAB_GROUP_COLOR_CYAN = 8;
    SAVED_TAB_GROUP_COLOR_ORANGE = 9;
  }

  // The position of the SavedTabGroup in any visual display. This also
  // represents the index in the SavedTabGroupModel of the group. This field
  // will be deprecated and replaced by the pinned_position field in tab group
  // V2.
  optional int64 position = 1;

  // The displayed title of the group, shown on the tab group and the saved tab
  // group button.
  optional string title = 2;

  // The color of the group, mapped to tab_groups::TabGroupColorId.
  optional SavedTabGroupColor color = 3;

  // Position of the pinned tab group in bookmark bar on Desktop. This will
  // replace the position field in Tab Group V2.
  optional int64 pinned_position = 4;

  reserved 5;
}

// Sync protocol datatype extension for saved tab group tabs. SavedTabGroupTab
// are the sync representation of a tab in a saved tab group. they are stored as
// separate entities due to size limitations of sync entities.
message SavedTabGroupTab {
  // An id that links the saved tab group tab to it's saved tab group.
  optional string group_guid = 1;

  // The position in the Tab Strip the tab is located relative to the start of
  // the tab group. This is also the index in the saved_tabs_ vector in the
  // SavedTabGroup in the SavedTabGroupModel, which is updated by the
  // TabStripModel.
  optional int64 position = 2;

  // Tab Data used for constructing the tab.
  optional string url = 3;

  // The displayed title of the tab, shown on the saved tab group button's
  // context menu.
  optional string title = 4;
}

message SavedTabGroupSpecifics {
  // An id that refers to the sync saved tab group object.
  optional string guid = 1;

  // Timestamps for CRUD operations.
  optional int64 creation_time_windows_epoch_micros = 2;
  optional int64 update_time_windows_epoch_micros = 3;

  oneof entity {
    SavedTabGroup group = 4;
    SavedTabGroupTab tab = 5;
  }

  // Attribution metadata about the associated tab group or tab.
  optional AttributionMetadata attribution_metadata = 6;
}