chromium/components/history/core/browser/mojom/history_types.mojom

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

module history.mojom;

import "mojo/public/mojom/base/time.mojom";
import "url/mojom/url.mojom";

// Device Types.
enum DeviceType {
  kUnknown,
  kDesktop,
  kPhone,
  kTablet,
};

// Reasons for showing tab in Tab Resumption module.
enum Decorator {
  kVisitedXAgo,
  kMostRecent,
  kFrequentlyVisitedAtTime,
};

// Represents a tab generated from synced sessions.
struct Tab {
  // Type of device for displaying device icon
  // See components/sync_device_info/device_info.h
  DeviceType device_type;

  // Name of session to be displayed on surfaces such as NTP.
  string? session_name;

  // URL of tab for display.
  url.mojom.Url url;

  // String to display.
  string title;

  // Info about the reason this tab is being shown.
  Decorator? decorator;

  // Time since tab was last active.
  mojo_base.mojom.TimeDelta relative_time;

  // Relative time to display on UI (i.e. 2 hours ago).
  string relative_time_text;

  // Timestamp to be sent back to handler.
  mojo_base.mojom.Time? timestamp;

  // URL Key to distinguish visits with similar URLs. It may or may not be a
  // valid URL. It is derived from a URL however.
  string url_key;

  // ID to be passed to handler to collect training data.
  int64 training_request_id;
};