// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module blink.mojom;
// Managed configuration is JSON configuration that is set by device
// administrator and is provided by policy.
// Observes changes to the managed configuration.
interface ManagedConfigurationObserver {
// Is called whenever the managed configuration changes.
OnConfigurationChanged();
};
// This interface is used to handle the information / status passed by the
// navigator.managed interface. It is exposed to trusted origins only.
// The connection is hosted in the browser process and is used from the
// renderer process.
// The connection is terminated when the origin trustness status changes.
interface DeviceAPIService {
// Fetches the value of the device identifier of the directory API, that is
// generated by the server and identifies the cloud record of the device for
// querying in the cloud directory API. If the current user is not affiliated,
// returns nullopt as |attribute|.
GetDirectoryId() => (DeviceAttributeResult result);
// Fetches the device's hostname as set by DeviceHostnameTemplate policy.
// If the current user is not affiliated or no hostname has been set by the the
// enterprise policy, returns nullopt as |attribute|.
GetHostname() => (DeviceAttributeResult result);
// Fetches the device's serial number. Please note the purpose of this API is
// to administrate the device (e.g. generating Certificate Sign Requests for
// device-wide certificates). If the current user is not affiliated, returns nullopt
// as |attribute|.
GetSerialNumber() => (DeviceAttributeResult result);
// Fetches the administrator-annotated Asset Id. If the current user is not
// affiliated or no Asset Id has been set by the administrator, returns nullopt
// as |attribute|.
GetAnnotatedAssetId() => (DeviceAttributeResult result);
// Fetches the administrator-annotated location. If the current user is not
// affiliated or no Annotated Location has been set by the administrator,
// returns nullopt as |attribute|.
GetAnnotatedLocation() => (DeviceAttributeResult result);
};
// Per-frame interface to provide managed configuration information
// to the renderer. Available to all frames, regardless of whether or
// not the frame is hosting a page that's managed by enterprise policy.
interface ManagedConfigurationService {
// Requests from browser the managed configuration mapped by |keys| provided
// by the device administrator. Returns a dictionary, containing JSON
// serialized value of the keys that were found in that configuration, or
// null if there is no managed configuration for the active document's
// origin.
GetManagedConfiguration(array<string> keys) =>
(map<string, string>? configurations);
// Allows to subscribe to the managed configuration updates.
SubscribeToManagedConfiguration(
pending_remote<ManagedConfigurationObserver> observer);
};
// Returned by methods that either return a nullable string or an error.
union DeviceAttributeResult {
// Implies failure.
string error_message;
// Implies success.
string? attribute;
};