| // 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 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.device 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 { |
| // 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. |
| GetManagedConfiguration(array<string> keys) => |
| (map<string, string> configurations); |
| // Allows to subscribe to the managed configuration updates. |
| SubscribeToManagedConfiguration( |
| pending_remote<ManagedConfigurationObserver> observer); |
| |
| // 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 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); |
| }; |
| |
| // Returned by methods that either return a nullable string or an error. |
| union DeviceAttributeResult { |
| // Implies failure. |
| string error_message; |
| |
| // Implies success. |
| string? attribute; |
| }; |