blob: e3e6e11ee3c1fa87a79d3dfadd98c58f01378381 [file] [log] [blame]
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Next MinVersion: 3
module crosapi.mojom;
import "mojo/public/mojom/base/unguessable_token.mojom";
// Represents an update to an instance of a tabbed Chrome browser window.
[Stable]
struct BrowserWindowInstanceUpdate {
// Instance ID generated in lacros-chrome.
mojo_base.mojom.UnguessableToken id@0;
// Wayland ID of the browser's Aura window.
string window_id@1;
// Browser window is currently activated.
bool is_active@2;
// Unique session id for the browser's window from the current browser
// session.
[MinVersion=2]
uint32 browser_session_id@3;
// Unique restored session id for the browser's window from the restored
// browser session.
[MinVersion=2]
uint32 restored_browser_session_id@4;
};
[Stable, Extensible]
enum BrowserAppInstanceType {
kAppTab,
kAppWindow,
};
// Represents an update to an instance of an app running in WebContents (either
// an app window or a tab).
[Stable]
struct BrowserAppInstanceUpdate {
// Instance ID generated in lacros-chrome.
mojo_base.mojom.UnguessableToken id@0;
// Indicates if it's a tab in a browser or a standalone window.
BrowserAppInstanceType type@1;
// App ID.
string app_id@2;
// Wayland ID of the browser's Aura window. It may change for apps of type
// kAppTab, and stays the same for instances of type kAppWindow.
string window_id@3;
// Current title of this instance's WebContents.
string title@4;
// The browser hosting this instance's WebContents is currently activated.
bool is_browser_active@5;
// The instance's WebContents is the active tab in the browser's tab strip.
// May change for apps of type kAppTab, stays the same (true) for instances
// of type kAppWindow.
bool is_web_contents_active@6;
// Unique session id for the browser's window from the current browser
// session.
[MinVersion=2]
uint32 browser_session_id@7;
// Unique restored session id for the browser's window from the restored
// browser session.
[MinVersion=2]
uint32 restored_browser_session_id@8;
};
// Implemented in ash-chrome, and is used to receive browser app instance
// events from lacros-chrome.
[Stable, Uuid="c29f078d-8d82-4f65-bce0-18f047b1ea31"]
interface BrowserAppInstanceRegistry {
// Called by lacros-chrome when when a new browser window is created.
OnBrowserWindowAdded@0(BrowserWindowInstanceUpdate update);
// Called when a browser window is updated.
OnBrowserWindowUpdated@1(BrowserWindowInstanceUpdate update);
// Called when a browser window is closed.
OnBrowserWindowRemoved@2(BrowserWindowInstanceUpdate update);
// Called by lacros-chrome when a new browser-based app instance is created
// in Lacros.
OnBrowserAppAdded@3(BrowserAppInstanceUpdate update);
// Called by lacros-chrome when any attributes in a Lacros browser-based app
// instance are updated.
OnBrowserAppUpdated@4(BrowserAppInstanceUpdate update);
// Called by lacros-chrome browser-based app instance is terminated.
OnBrowserAppRemoved@5(BrowserAppInstanceUpdate update);
// Binds the BrowserAppInstanceController interface, which allows the
// BrowserAppInstanceRegistry implemented in ash-chrome to communicate with
// its controller which is implemented in lacros-chrome.
[MinVersion=1]
RegisterController@6(
pending_remote<BrowserAppInstanceController> controller);
};
// Implemented in lacros-chrome, and is used to perform actions on instances
// that live in lacros-chrome from ash-chrome.
[Stable, Uuid="5058756a-9826-4276-abff-f2a84b9386b9"]
interface BrowserAppInstanceController {
// Activate the tab for the given instance ID in lacros-chrome. If the
// instance being referenced is not a tab instance, does nothing.
[MinVersion=1]
ActivateTabInstance@0(mojo_base.mojom.UnguessableToken id);
};