| // 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. |
| // |
| // Next MinVersion: 2 |
| |
| module crosapi.mojom; |
| |
| // Returned by methods that either return a string or an error. |
| [Stable] |
| union DeviceAttributesStringResult { |
| // Implies failure. |
| string error_message; |
| |
| // Implies success. |
| string contents; |
| }; |
| |
| // This API provides Lacros with access to device attributes. These methods will |
| // all return an error if the user is not affiliated with the device, which is |
| // an enterprise policy concept. |
| [Stable, Uuid="117591ac-5d9e-481c-936f-842b64e790c0"] |
| interface DeviceAttributes { |
| // 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. See |
| // https://developers.google.com/admin-sdk/directory/v1/guides/manage-chrome-devices. |
| GetDirectoryDeviceId@0() => (DeviceAttributesStringResult result); |
| |
| // Fetches the device's serial number. |
| GetDeviceSerialNumber@1() => (DeviceAttributesStringResult result); |
| |
| // Fetches the administrator-annotated Asset Id. |
| GetDeviceAssetId@2() => (DeviceAttributesStringResult result); |
| |
| // Fetches the administrator-annotated Location. |
| GetDeviceAnnotatedLocation@3() => (DeviceAttributesStringResult result); |
| |
| // Fetches the device's hostname as set by DeviceHostnameTemplate policy. |
| GetDeviceHostname@4() => (DeviceAttributesStringResult result); |
| |
| // Fetches the user type by device type segment for metrics. The user type |
| // and the device type are combined to construct device type segment for |
| // metrics via UserTypeByDeviceTypeMetricsProvider::ConstructUmaValue from |
| // the ash side. Though this value is not an enum it's version-skew stable |
| // as it's used by UKM(ChromeOS.WebsiteUsageTime) which already depends on |
| // version stability. |
| [MinVersion=1] |
| GetDeviceTypeForMetrics@5() => (int32 device_type); |
| }; |