chromium/components/saved_tab_groups/types.h

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

#ifndef COMPONENTS_SAVED_TAB_GROUPS_TYPES_H_
#define COMPONENTS_SAVED_TAB_GROUPS_TYPES_H_

#include <optional>

#include "base/logging.h"
#include "base/token.h"
#include "base/uuid.h"
#include "build/build_config.h"
#include "components/tab_groups/tab_group_id.h"

namespace tab_groups {

// Types for tab and tab group IDs.
#if BUILDFLAG(IS_ANDROID)
using LocalTabID = int;
using LocalTabGroupID = base::Token;
#elif BUILDFLAG(IS_IOS)
using LocalTabID = int;
using LocalTabGroupID = tab_groups::TabGroupId;
#else
LocalTabID;
LocalTabGroupID;
#endif

// Base context for tab group actions. Platforms can subclass this to pass
// additional context such as a browser window.
struct TabGroupActionContext {};

// Whether the update was originated by a change in the local or remote
// client.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.tab_group_sync
enum class TriggerSource {};

// LINT.IfChange(OpeningSource)
// Specifies the source of an action that opened a tab group.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.tab_group_sync
enum class OpeningSource {};
// LINT.ThenChange(//tools/metrics/histograms/metadata/tab/enums.xml:GroupOpenReason)

// LINT.IfChange(ClosingSource)
// Specifies the source of an action that closed a tab group.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.tab_group_sync
enum class ClosingSource {};
// LINT.ThenChange(//tools/metrics/histograms/metadata/tab/enums.xml:GroupCloseReason)

// LINT.IfChange(TabGroupEvent)
// Various types of mutation events associated with tab groups and tabs.
// Used for metrics only. These values are persisted to logs. Entries should not
// be renumbered and numeric values should never be reused.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.tab_group_sync
enum class TabGroupEvent {};
// LINT.ThenChange(//tools/metrics/histograms/metadata/tab/enums.xml:TabGroupEvent)

// Helper struct to pass around information about tab group
// events for recording metrics.
struct EventDetails {};

}  // namespace tab_groups

#endif  // COMPONENTS_SAVED_TAB_GROUPS_TYPES_H_