blob: ebdb1166a219152e08e249d9ab5413a5f396acf6 [file] [log] [blame]
// Copyright 2020 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.
module crosapi.mojom;
import "chromeos/crosapi/mojom/account_manager.mojom";
import "chromeos/crosapi/mojom/cert_database.mojom";
import "chromeos/crosapi/mojom/clipboard.mojom";
import "chromeos/crosapi/mojom/feedback.mojom";
import "chromeos/crosapi/mojom/file_manager.mojom";
import "chromeos/crosapi/mojom/keystore_service.mojom";
import "chromeos/crosapi/mojom/message_center.mojom";
import "chromeos/crosapi/mojom/metrics_reporting.mojom";
import "chromeos/crosapi/mojom/prefs.mojom";
import "chromeos/crosapi/mojom/screen_manager.mojom";
import "chromeos/crosapi/mojom/select_file.mojom";
import "chromeos/crosapi/mojom/test_controller.mojom";
import "mojo/public/mojom/base/big_string.mojom";
import "mojo/public/mojom/base/file_path.mojom";
import "mojo/public/mojom/base/token.mojom";
import "mojo/public/mojom/base/values.mojom";
import "services/device/public/mojom/hid.mojom";
import "services/media_session/public/mojom/audio_focus.mojom";
import "services/media_session/public/mojom/media_controller.mojom";
import "url/mojom/url.mojom";
// LacrosInfo is a set of parameters passed to ash from lacros-chrome
// upon lacros startup, which contains the lacros information such as version,
// etc.
[Stable]
struct LacrosInfo {
// Version of lacros-chrome displayed to user in feedback report, etc.
// It includes both browser version and channel in the format of:
// {browser version} {channel}
// For example, "87.0.0.1 dev", "86.0.4240.38 beta".
string lacros_version@0;
// TODO(crbug.com/1119925): Add more parameters later.
};
// AshChromeService defines the APIs that live in ash-chrome and are
// accessed from lacros-chrome. When adding a major new API please note the
// milestone when you added it, to help us reason about compatibility between
// lacros-chrome and older ash-chrome binaries.
//
// Next version: 12
// Next method id: 17
[Stable, Uuid="8b79c34f-2bf8-4499-979a-b17cac522c1e"]
interface AshChromeService {
// Binds Chrome OS Account Manager for Identity management.
// Added in M87.
[MinVersion=4]
BindAccountManager@7(pending_receiver<AccountManager> receiver);
// Binds the CertDatabase interface for initializing certificate database in
// Lacros-Chrome.
// Added in M89.
[MinVersion=7] BindCertDatabase@12(pending_receiver<CertDatabase> receiver);
// Bind the clipboard interface to allow lacros-chrome to interact with the
// system clipboard.
[MinVersion=10] BindClipboard@15(pending_receiver<Clipboard> receiver);
// Binds the FileManager interface for showing files, folders, etc.
// Added in M88.
[MinVersion=5]
BindFileManager@8(pending_receiver<FileManager> receiver);
// Binds the KeystoreService interface for challenging keys.
// Added in M87.
BindKeystoreService@2(pending_receiver<KeystoreService> receiver);
// Binds the MessageCenter interface for showing notification messages.
// Added in M86.
BindMessageCenter@3(pending_receiver<MessageCenter> receiver);
// Binds the MetricsReporting interface for metrics reporting consent.
// Added in M89.
[MinVersion=8]
BindMetricsReporting@13(pending_receiver<MetricsReporting> receiver);
// Binds the prefs service which allows get, set, and notify update of prefs.
// Added in M89.
[MinVersion=11] BindPrefs@16(pending_receiver<Prefs> receiver);
// Binds the ScreenManager interface for interacting with windows, screens and
// displays.
// Added in M86.
BindScreenManager@1(pending_receiver<ScreenManager> receiver);
// Binds the SelectFile interface for open/save dialogs.
// Added in M86.
BindSelectFile@0(pending_receiver<SelectFile> receiver);
// Binds the HidManager interface for support HID devices.
// Added in M87.
BindHidManager@4(pending_receiver<device.mojom.HidManager> receiver);
// Binds the Feedback interface for showing feedback UI.
// Added in M87.
[MinVersion=3] BindFeedback@5(pending_receiver<Feedback> receiver);
// Binds the Media Session service (controller) for enabling media playback
// control.
// Added in M88.
[MinVersion=6] BindMediaSessionController@9(
pending_receiver<media_session.mojom.MediaControllerManager> receiver);
// Binds the Media Session service (audio focus) for enabling media sessions
// to register with the service so they can be controlled.
// Added in M88.
[MinVersion=6] BindMediaSessionAudioFocus@10(
pending_receiver<media_session.mojom.AudioFocusManager> receiver);
// Binds the Media Session service (audio focus debug) for enabling debugging
// of media playback sessions.
// Added in M88.
[MinVersion=6] BindMediaSessionAudioFocusDebug@11(
pending_receiver<media_session.mojom.AudioFocusManagerDebug> receiver);
// Binds the test controller service, which tests can use to mutate ash. This
// is not available on production devices.
[MinVersion=9] BindTestController@14(
pending_receiver<TestController> receiver);
// Passes generic lacros information such as lacros version, etc into ash
// in |lacros_info| during startup.
// Added in M87.
[MinVersion=3] OnLacrosStartup@6(LacrosInfo lacros_info);
};
[Stable, Extensible]
enum SessionType {
kUnknown,
kRegularSession,
kGuestSession,
kPublicSession
};
// Device mode (e.g. enterprise enrollment state). See policy::DeviceMode.
[Stable, Extensible]
enum DeviceMode {
kUnknown = 0,
// Not yet set.
kNotSet,
// Locally owned as consumer device.
kConsumer,
// Enrolled as an enterprise device.
kEnterprise,
// Joined Active Directory.
kEnterpriseActiveDirectory,
// Retail kiosk device.
kLegacyRetailMode,
// Locally owned as consumer kiosk and can auto-launch a kiosk webapp.
kConsumerKioskAutolaunch,
// Demo mode, either enrolled online or setup in offline demo mode.
kDemo,
};
// Whether or not metrics reporting in ash is managed by policy.
[Stable, Extensible]
enum MetricsReportingManaged {
// Default value for backwards compatibility with old versions of ash.
kUnknown = 0,
kNotManaged = 1,
kManaged = 2,
};
// Default directories on the system.
[Stable]
struct DefaultPaths {
// The default (non-configurable) directory for documents. For example,
// /home/chronos/u-<hash>/MyFiles. We send the full path for future
// compatibility, to avoid assumptions about where on disk the directory is
// located.
mojo_base.mojom.FilePath documents@0;
// The default (non-configurable) directory for downloads. For example,
// /home/chronos/u-<hash>/MyFiles/Downloads. We send the full path for future
// compatibility, to avoid assumptions about where on disk the directory is
// located.
mojo_base.mojom.FilePath downloads@1;
};
[Stable, Extensible]
enum ExoImeSupport {
kUnsupported = 0,
// To work with the client IME implementation, exo has short term workaround
// to filter some wayland key/keysym events by using ConsumedByIme().
// Note that this is an approach consistent with ARC's behavior.
kConsumedByImeWorkaround = 1,
// TODO(crbug.com/1093194): For long term, we're looking at a way to remove
// the above workaround. It will be exclusive state, so on implementing
// ash-chrome's fix, it is necessary to add a new value here, too, atomically.
};
// LacrosInitParams is a set of parameters for initialization of lacros-chrome,
// which is passed from ash-chrome to lacros-chrome. Since ash-chrome and
// lacros-chrome may have different versions, lacros-chrome must handle this
// struct carefully.
//
// If ash-chrome is older than lacros-chrome, then some fields may not be
// present in the serialized IPC message. This manifests as the newer (missing)
// fields taking on default values in lacros-chrome. This means
// that the default value for each field must always be interpreted to mean:
// this field was not sent because ash-chrome was too old. If the default value
// needs to have a different meaning, then we must also add a bool field
// describing the validity of this field. Mojo currently does not support
// optional primitives.
//
// If ash-chrome is newer than lacros-chrome, then some fields may not be
// processed by lacros-chrome.
//
// Next version: 11
[Stable]
struct LacrosInitParams {
// This is ash-chrome's version of the AshChromeService interface. This is
// used by lacros-chrome to determine which interface methods are safe to
// call.
[MinVersion=1]
uint32 ash_chrome_service_version@0;
// Deprecated in M88. |ash_metrics_enabled| always has a value.
[MinVersion=2]
bool deprecated_ash_metrics_enabled_has_value@1;
// Whether metrics are enabled in ash-chrome. On lacros first run we inherit
// metrics consent from ash, because on Chrome OS metrics consent is chosen
// during the out-of-box experience. After first run lacros handles metrics
// consent via settings.
[MinVersion=2]
bool ash_metrics_enabled@2;
// Type of the ash-chrome session at lacros startup time.
[MinVersion=3]
SessionType session_type@3;
// Device mode at lacros startup time. If lacros is running during the
// out-of-box experience, the device mode might change later (e.g. if the
// user chooses to enroll the device).
[MinVersion=4]
DeviceMode device_mode@4;
// Ash sends all known crosapi interfaces and their versions at startup so
// that Lacros can synchronously query version info. Interfaces are identified
// by a UUID, which is manually generated and assigned via the UUID mojom
// qualifier.
// Added in M88.
[MinVersion=5]
map<mojo_base.mojom.Token, uint32>? interface_versions@5;
// Default directories on the system.
// Added in M89.
[MinVersion=6]
DefaultPaths? default_paths@6;
// Device Account's obfuscated Gaia id, if present.
// This is null for older versions of ash, for Active Directory sessions,
// Guest sessions, Managed Guest sessions, Demo mode, and Kiosks.
// Added in M89.
[MinVersion=7]
string? device_account_gaia_id@7;
// Whether or not metrics reporting in ash is managed by policy. This is
// passed independently because the metrics reporting state is controlled by
// ash-level device policy, but we want to show the "managed" icon in the
// browser preferences UI as if it was controlled by user policy.
// Added in M89.
[MinVersion=8]
MetricsReportingManaged ash_metrics_managed@8;
// How exo supports IME on Lacros. Lacros can control IME handling
// depending on the ash-chrome's support status via this flag.
[MinVersion=9]
ExoImeSupport exo_ime_support@9;
// Primary user ID hash. Used to set CROS_USER_ID_HASH env var in crosh.
// Do not use this to construct paths, use DefaultPaths for that purpose.
[MinVersion=10]
string? cros_user_id_hash@10;
};
// LacrosChromeService defines the APIs that live in lacros-chrome and
// are accessed from ash-chrome.
[Stable, Uuid="4e04dc16-b34c-40fd-9e3f-3c55c2c6cf91"]
interface LacrosChromeService {
// DEPRECATED: in M89. In new versions, memory backed file based
// initialization data passing is used.
//
// Ash-chrome can pass initialize parameters via this method.
// The parameters are available on lacros-chrome startup.
InitDeprecated@2(LacrosInitParams params);
// Returns the pending_receiver of AshChromeService.
// Ash-chrome is expected to call this method on initialization.
// Lacros-chrome may call AshChromeService APIs earlier than this
// invocation. In the case, the calls are queued, and processed
// sequentially, when ash-chrome binds the receiver to the service.
RequestAshChromeServiceReceiver@0() => (
pending_receiver<AshChromeService> receiver);
// Opens a new window in lacros-chrome with, currently, the last used profile.
// The callback is called on the command execution.
NewWindow@1() => ();
// Returns lacros feedback data used for generating feedback report in
// a dictionary object, each entry representing a log entry in the feedback
// report, for example, "Lacros crash_report_ids: xxx",
// "Lacros extensions: xxx", "Lacros mem_usage: xxx", etc.
[MinVersion=6]
GetFeedbackData@3() => (
mojo_base.mojom.DictionaryValue feedback_info);
// Returns the lacros histograms used for generating feedback report.
// The histograms returned is zip compressed and is typically around 100KB.
[MinVersion=7]
GetHistograms@4() => (mojo_base.mojom.BigString compressed_histograms);
// Returns Url of the active tab from lacros if there is any.
[MinVersion=8]
GetActiveTabUrl@5() => (url.mojom.Url? url);
};