1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module parent_access_ui.mojom;
import "mojo/public/mojom/base/string16.mojom";
import "url/mojom/url.mojom";
enum GetOauthTokenStatus {
kSuccess,
kError,
kOnlyOneFetchAtATime,
};
// Types of messages sent in the ParentAccessCallback.
enum ParentAccessServerMessageType {
// Indicates that the parent's identity was verified.
// Returned by either verification or consent flow.
// In consent flow it also means that parent provided the consent and
// that consent was recorded.
kParentVerified,
// An internal error occurred in any of the flows.
// The user should be prompted with an unrecoverable error in this case.
kError,
// Indicates that the result type should be ignored. This can happen if the
// server adds a new return type that we don't support.
kIgnore,
};
// Struct returned to the WebUI based on the parsed ParentAccessCallback proto.
struct ParentAccessServerMessage {
// The message type.
ParentAccessServerMessageType type;
};
// Struct containing pertinent information that is used to render the parent
// access dialog.
struct ParentAccessParams {
enum FlowType {
kWebsiteAccess,
kExtensionAccess,
};
// Defines the type of flow to invoke in the dialog.
FlowType flow_type;
FlowTypeParams? flow_type_params;
// Indicates if the Parent Access disabled UI should be shown. This can be
// determined differently depending on the flow type. For example, in the
// extension approval flow, this value is true if the parent has disabled
// the extension permissions setting for the supervised user.
bool is_disabled;
};
// Parameters for local web approvals feature.
struct WebApprovalsParams {
// The URL access is being requested for.
url.mojom.Url url;
// The child's name to be displayed to the parent.
mojo_base.mojom.String16 child_display_name;
// The PNG representation of the URL's favicon.
array<uint8> favicon_png_bytes;
};
// Parameters for the local extension approvals V2 feature.
struct ExtensionApprovalsParams {
// Display name for the extension.
mojo_base.mojom.String16 extension_name;
// Extension icon, stored as an array of bytes.
array<uint8> icon_png_bytes;
// The child's name to be displayed to the parent.
mojo_base.mojom.String16 child_display_name;
// Localized messages indicating the permissions requirements for an
// extension.
array<ExtensionPermission> permissions;
};
// 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.
struct ExtensionPermission {
mojo_base.mojom.String16 permission;
// Permission details. Can be empty.
mojo_base.mojom.String16 details;
};
union FlowTypeParams {
WebApprovalsParams web_approvals_params;
ExtensionApprovalsParams extension_approvals_params;
};
// The result of the parent access request.
enum ParentAccessResult {
kApproved,
kDeclined,
kCanceled,
kDisabled,
kError,
};
// Interface that supports integration between the ParentAccess WebUI and
// ChromeOS.
interface ParentAccessUiHandler {
// Returns the oauth token to be passed to the server.
GetOauthToken() => (GetOauthTokenStatus status, string oauth_token);
// When called, signals that the server widget has provided a result.
// Returns a ParentAccessServerMessage parsed from the encoded proto string.
OnParentAccessCallbackReceived(string encoded_parent_access_callback_proto) =>
(ParentAccessServerMessage message);
// Returns the FlowTypeParams pertinent to the current parent access flow.
GetParentAccessParams() => (ParentAccessParams params);
// Returns the URL for the parent access widget endpoint.
GetParentAccessUrl() => (string url);
// When called, indicates that that the request has completed with the
// specified result, which will cause the Parent Access UI to close.
OnParentAccessDone(ParentAccessResult result) => ();
// Called when the UI has switched from the before screen to the
// ParentAuthentication screen.
OnBeforeScreenDone() => ();
};
|