| // Copyright 2018 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. |
| |
| // The <code>chrome.system.powerSource</code> API allows Chrome Kiosk Apps to |
| // query the state of connected power sources. |
| [platforms=("chromeos")] |
| namespace system.powerSource { |
| enum PowerSourceType { |
| // Unspecified type. |
| unknown, |
| |
| // Dedicated charger. Typically single-purpose and non-USB (e.g. barrel |
| // jack plugs). |
| mains, |
| |
| // USB charger, including both low-power Type-A chargers and high-power |
| // Type-C chargers using USB Power Delivery. |
| usb |
| }; |
| |
| dictionary PowerSourceInfo { |
| // Type of power source. |
| PowerSourceType type; |
| |
| // Maximum power this source is capable of delivering if known. Reported in |
| // watts, rounded to two significant digits. |
| double? maxPower; |
| |
| // Whether this power source is connected to the device. |
| boolean active; |
| }; |
| |
| callback PowerSourceInfoCallback = |
| void(optional PowerSourceInfo[] powerSourceInfo); |
| |
| interface Functions { |
| // Requests information on attached power sources. |
| // |callback|: The callback to invoke with the results or |
| // undefined if the power source information is not known. |
| static void getPowerSourceInfo(PowerSourceInfoCallback callback); |
| |
| // Requests a power source status update. Resulting power source status |
| // updates are observable using $(ref:onPowerChanged). |
| static void requestStatusUpdate(); |
| }; |
| |
| interface Events { |
| // Event for changes in the set of connected power sources. |
| static void onPowerChanged(PowerSourceInfo[] powerSourceInfo); |
| }; |
| }; |
| |