// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module chrome.mojom;
import "mojo/public/mojom/base/file_path.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/wstring.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
enum SelectFileDialogType {
kNone,
// For opening a folder.
kFolder,
// Like kFolder, but the dialog UI should explicitly show it's
// specifically for "upload".
kUploadFolder,
// Like kFolder, but folder creation is disabled, if possible.
kExistingFolder,
// For saving into a file, allowing a nonexistent file to be selected.
kSaveAsFile,
// For opening a file.
kOpenFile,
// Like kOpenFile, but allowing multiple files to open.
kOpenMultiFile,
};
struct FileFilterSpec {
mojo_base.mojom.String16 description;
mojo_base.mojom.String16 extension_spec;
};
enum CertificateType {
// The module is not signed.
kNoCertificate,
// The module is signed and the certificate is in the module.
kCertificateInFile,
// The module is signed and the certificate is in an external catalog.
kCertificateInCatalog,
};
struct InspectionResult {
// The lowercase module path, not including the basename.
mojo_base.mojom.String16 location;
// The basename of the module.
mojo_base.mojom.String16 basename;
// The name of the product the module belongs to.
mojo_base.mojom.String16 product_name;
// The module file description.
mojo_base.mojom.String16 description;
// The module version. This is usually in the form a.b.c.d (where a, b, c and
// d are integers), but may also have fewer than 4 components.
mojo_base.mojom.String16 version;
// The type of the certificate for this module.
CertificateType certificate_type;
// Path to the file containing the certificate. Empty if |certificate_type| is
// kNoCertificate.
mojo_base.mojom.FilePath certificate_path;
// The "Subject" name of the certificate. This is the signer (e.g.,
// "Google LLC" or "Microsoft Corporation").
mojo_base.mojom.String16 certificate_subject;
};
enum AntiVirusProductState {
// The security product software is turned on and protecting the user.
kOn,
// The security product software is turned off and protection is disabled.
kOff,
// The security product software is in the snoozed state, temporarily off,
// and not actively protecting the computer.
kSnoozed,
// The security product software has expired and is no longer actively
// protecting the computer.
kExpired,
};
struct AntiVirusProduct {
string product_name;
uint32 product_name_hash;
string product_version;
uint32 product_version_hash;
AntiVirusProductState state;
};
struct ClsId {
array<uint8, 16> bytes;
};
struct ShortcutProperties {
// The target to launch from this shortcut. This is mandatory when creating
// a shortcut.
mojo_base.mojom.FilePath target;
// The name of the working directory when launching the shortcut.
mojo_base.mojom.FilePath working_dir;
// The arguments to be applied to |target| when launching from this shortcut.
mojo_base.mojom.WString arguments;
// The localized description of the shortcut.
// The length of this string must be no larger than INFOTIPSIZE.
mojo_base.mojom.WString description;
// The path to the icon (can be a dll or exe, in which case |icon_index| is
// the resource id).
mojo_base.mojom.FilePath icon;
int32 icon_index = -1;
// The app model id for the shortcut.
mojo_base.mojom.WString app_id;
// Whether this is a dual mode shortcut (Win8+).
bool dual_mode;
// The CLSID of the COM object registered with the OS via the shortcut. This
// is for app activation via user interaction with a toast notification in the
// Action Center. (Win10 version 1607, build 14393, and beyond).
ClsId toast_activator_clsid;
// Bitfield made of ShortcutProperties::IndividualProperties. Properties set
// in |options| will be set on the shortcut, others will be ignored.
uint32 options;
};
enum ShortcutOperation {
// Create a new shortcut (overwriting if necessary).
kCreateAlways,
// Overwrite an existing shortcut (fails if the shortcut doesn't exist).
// If the arguments are not specified on the new shortcut, keep the old
// shortcut's arguments.
kReplaceExisting,
// Update specified properties only on an existing shortcut.
kUpdateExisting,
};
// Utility process interface exposed to the browser process on OS_WIN. Used to
// improve stability by executing some tasks out-of-process. This include either
// crashy tasks, or tasks that requires certain DLLs to be loaded into the
// process address space that we don't want to load in the main process.
[ServiceSandbox=sandbox.mojom.Sandbox.kNoSandbox]
interface UtilWin {
// Returns the pinned state of the current executable.
IsPinnedToTaskbar() => (bool succeeded,
bool is_pinned_to_taskbar);
// Unpins all shortcuts in `shortcut_paths`.
UnpinShortcuts(array<mojo_base.mojom.FilePath> shortcut_paths)
=> ();
// Creates or updates shortcuts. Returns true if all operations succeeded,
// false if any failed.
CreateOrUpdateShortcuts(array<mojo_base.mojom.FilePath> shortcut_paths,
array<ShortcutProperties> properties,
ShortcutOperation operation) =>
(bool succeeded);
// Executes a select file operation that can be executed on a utility process.
// |owner|:
// The HWND that owns the file dialog.
// |title|:
// The title of the file dialog.
// |default_path|:
// The path that is selected by default when the dialog is opened.
// |filter|:
// Filters which files are shown based on the file extension. Ignored for
// folder selection dialogs (kFolder, kUploadFolder, kExistingFolder).
// |file_type_index|:
// The index of the file extension filter that should be selected when the
// dialog is first opened. Ignored for folder selection dialogs (kFolder,
// kUploadFolder, kExistingFolder).
// |default_extension|:
// The extension that should automatically be appended to a filename if it
// doesn't have one. This is only used for kSaveAsFile dialogs.
//
// Returns the selected file |paths| and the |file_type_index| of the filter
// selected by the user. The |file_type_index| return value is meaningless on
// folder selection dialogs. On cancelation or failure, |paths| will be empty.
CallExecuteSelectFile(SelectFileDialogType type,
uint32 owner,
mojo_base.mojom.String16 title,
mojo_base.mojom.FilePath default_path,
array<FileFilterSpec> filter,
int32 file_type_index,
mojo_base.mojom.String16 default_extension) =>
(array<mojo_base.mojom.FilePath> paths,
int32 file_type_index);
// Given a module located at |module_path|, returns a populated
// ModuleInspectionResult that contains detailed information about the module
// on disk.
InspectModule(mojo_base.mojom.FilePath module_path) =>
(InspectionResult inspection_result);
// Returns the list of all antivirus software installed on the user's machine.
// |report_full_names| controls whether or not the full name of each software
// is included in the list, in order to preserve privacy.
GetAntiVirusProducts(bool report_full_names) =>
(array<AntiVirusProduct> av_products);
};
// Hosted by a utility service in kNoSandbox (with CET allowed). Called on
// startup by the browser to record metrics. Uses COM to make WMI calls.
[ServiceSandbox=sandbox.mojom.Sandbox.kNoSandbox]
interface ProcessorMetrics {
// Records various metrics about the processor.
// Note: The service process can terminate as soon as it observes that the
// Remote has been destroyed, hence the callback exists so the caller can
// know when it's safe to destroy the Remote.
RecordProcessorMetrics() => ();
};