// 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.
module crosapi.mojom;
import "components/tab_groups/public/mojom/tab_group_types.mojom";
import "ui/base/mojom/ui_base_types.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "url/mojom/url.mojom";
import "ui/gfx/image/mojom/image.mojom";
// Structure representing the state of a tab group in a browser instance.
[Stable]
struct TabGroup {
// The title of the tab group
string title;
// The background color of the tab group.
tab_groups.mojom.Color color;
// Whether the group is collapsed.
bool is_collapsed;
// The index of the first tab in this group. This index cannot overlap with
// the indexes of other tab groups associated with the window this group
// belongs with. The start index also cannot be less than the value
// associated with the `first_non_pinned_tab_index`.
uint32 start_index;
// Number of tabs in this group. The sum of this and the start index cannot
// result in an index that is greater than the total number of tabs associated
// with the owning window. The sum of this and the start index also cannot
// result in an index that overlaps with another tab group.
uint32 tab_count;
};
// Additional state of the browser in the single Lacros window for saving in the
// desk template.
[Stable]
struct DeskTemplateState {
// URLs in the tab strip.
array<url.mojom.Url> urls@0;
// Index of the active tab.
uint32 active_index@1;
[MinVersion=2] string? browser_app_name@2;
[MinVersion=3] int64 restore_window_id@3;
// Index of the first non-pinned tab. 0 if no tabs are pinned. This index
// cannot be contained within the range of any tab groups and tab group
// indexes cannot overlap with any index less than this value.
[MinVersion=4] uint32 first_non_pinned_index@4;
// List of tab groups associated with this browser.
[MinVersion=4] array<TabGroup>? groups@5;
// The lacros profile ID for this browser.
[MinVersion=5] uint64 lacros_profile_id@6;
};
// Interface for desk template clients. Implemented by lacros-chrome.
// Next version: 5
// Next method id: 3
[Stable]
interface DeskTemplateClient {
// Creates a browser from the desk template data.
[MinVersion=1]
CreateBrowserWithRestoredData@1(gfx.mojom.Rect bounds,
ui.mojom.WindowShowState initial_show_state,
DeskTemplateState state);
// Returns state of the tab strip model in the browser window identified by
// |window_unique_id|.
GetBrowserInformation@0(uint32 serial, string window_unique_id) => (
uint32 serial, string window_unique_id, DeskTemplateState? state);
// Gets the image of the favicon associated with `url`. Returns an empty
// image if the favicon cannot be found. If `profile_id` is specified, then
// that profile is used to load the favicon, otherwise the main profile is
// used.
[MinVersion=3]
GetFaviconImage@2(url.mojom.Url url, [MinVersion=4] uint64? profile_id)
=> (gfx.mojom.ImageSkia? image);
};
// Interface for desk template. Implemented by ash-chrome.
// Next version: 1
// Next method id: 1
[Stable, Uuid="7566edd4-358d-44b6-b71c-9eb87c632271"]
interface DeskTemplate {
// Registers the client that lives in lacros-chrome.
AddDeskTemplateClient@0(pending_remote<DeskTemplateClient> client);
};