chromium/chromeos/crosapi/mojom/suggestion_service.mojom

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

module crosapi.mojom;

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

// Enum representing the device form factor from which the suggestion item
// originates.
[Stable, Extensible]
enum SuggestionDeviceFormFactor {
  [Default] kDesktop,
  kPhone,
  kTablet,
};

// Structure representing a suggestion tab item.
[Stable]
struct TabSuggestionItem {
  // The title of the tab item.
  string title@0;

  // The url for the tab item.
  url.mojom.Url url@1;

  // The timestamp for the last time the tab was loaded.
  mojo_base.mojom.Time timestamp@2;

  // The url of the tab's favicon image.
  url.mojom.Url favicon_url@3;

  // The name of the session which this tab belongs to.
  string session_name@4;

  // The device form factor which the tab item belongs to.
  SuggestionDeviceFormFactor form_factor@5;
};

// Provides suggestions data to consumers.
// Implemented by lacros-chrome.
[Stable]
interface SuggestionServiceProvider {
  // Gets a list of suggestion tab items from the lacros browser. Returns an
  // empty list of tab items if no data is available.
  GetTabSuggestionItems@0() => (array<TabSuggestionItem> items);
};

// This interface lets ash query lacros for suggestion items.
// Implemented by ash-chrome.
[Stable, Uuid="85f05a2b-f9bb-48af-8cf2-624379d237d1"]
interface SuggestionService {
  // Registers the provider that live in lacros-chrome.
  AddSuggestionServiceProvider@0(
      pending_remote<SuggestionServiceProvider> service);
};