// 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 "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/time.mojom";
import "ui/gfx/image/mojom/image.mojom";
import "url/mojom/url.mojom";
// Struct that indicates that the parent approved the request.
[Stable]
struct ParentAccessApprovedResult {
// The parent access token.
string parent_access_token@0;
// The parent access token expiration timestamp, after which the token
// is not considered valid.
mojo_base.mojom.Time parent_access_token_expire_timestamp@1;
};
// Struct that indicates that an unexpected error occurred during the
// request.
[Stable]
struct ParentAccessErrorResult {
// The type of error that occurred
// kNone: no error, the default value.
// kUnknown: an unknown error occurred.
// kNotAChildUser: the user requesting permission
// is not a child.
// kAlreadyVisible: the dialog is already visible and
// handling another permission request.
[Stable, Extensible]
enum Type {
[Default] kNone = 0,
kUnknown = 1,
kNotAChildUser = 2,
kAlreadyVisible = 3,
};
// The type of error which occurred. Only set if status is kError.
Type type@0;
};
// Struct used to indicate that the parent canceled the request.
[Stable, RenamedFrom="crosapi.mojom.ParentAccessCancelledResult"]
struct ParentAccessCanceledResult {};
// Struct used to indicate that the parent declined the request.
[Stable]
struct ParentAccessDeclinedResult {};
// Struct used to indicate that the parent has disabled requests.
[Stable]
struct ParentAccessDisabledResult {};
// The result of the parent access request.
// New members can be added because this union is only passed from Ash to
// Lacros.
// Created for the Local Web Approvals feature that launched in Ash in M110.
// Extended for Local Extension Approvals feature launched in Ash in M115.
// Next field ID: 5
[Stable]
union ParentAccessResult {
// If present, the parent approved the request
ParentAccessApprovedResult approved@0;
// If present, an unexpected error occurred during the request.
ParentAccessErrorResult error@1;
// If present, the parent canceled the request
ParentAccessCanceledResult canceled@2;
// If present, the parent declined the request
ParentAccessDeclinedResult declined@3;
// If present, the parent disabled requests.
[MinVersion=1] ParentAccessDisabledResult disabled@4;
};
// Permission required by an extension.
// Permission messages are generated by the extension component from the set
// of permissions listed in extensions/common/mojom/api_permission_id.mojom.
[Stable]
struct ExtensionPermission {
mojo_base.mojom.String16 permission;
// Permission details. Can be empty.
mojo_base.mojom.String16 details;
};
// Interface that provides access to the Parent Access Widget.
// New use cases that integrate with the Parent Access Widget should add
// a new interface method below, with a different MinVersion.
//
// The caller side of this interface must check the MinVersion of the Lacros
// API using LacrosService::GetInterfaceVersion() to determine whether it
// supports the functionality it requires. It should never send an IPC over
// the interface to an incompatible version.
// Next method ID: 2
[Stable, Uuid="9be7bba2-a67d-4f8a-bf18-e37338dc7c8e"]
interface ParentAccess {
// Request parental approval for website access.
// url: The url being requested
// display_name: The child's display name
// favicon: The favicon for the website requested (can be empty if
// it couldn't be retrieved).
[MinVersion=0]
GetWebsiteParentApproval@0(
url.mojom.Url url,
mojo_base.mojom.String16 child_display_name,
gfx.mojom.ImageSkia favicon) => (ParentAccessResult result);
// Request parental approval for extension access.
// extension_name: The name of the extension being requested.
// child_display_name: The child's display name.
// icon: The icon for the extension.
// permissions: The list of permissions requested by the extension.
// requests_disabled: True if the parent has disabled extension access.
[MinVersion=1]
GetExtensionParentApproval@1(
mojo_base.mojom.String16 extension_name,
mojo_base.mojom.String16 child_display_name,
gfx.mojom.ImageSkia icon,
array<ExtensionPermission> permissions,
bool requests_disabled) => (ParentAccessResult result);
};