| // Copyright 2022 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module device.mojom; |
| |
| import "services/device/public/mojom/pressure_update.mojom"; |
| |
| // Result of PressureManager.AddClient(). |
| enum PressureStatus { |
| kOk, |
| |
| // The underlying platform does not report compute pressure information or |
| // the renderer is not allowed access to the feature. |
| kNotSupported, |
| }; |
| |
| // This interface is used to subscribe to notification about OnPressureUpdated. |
| // |
| // This interface is implemented by PressureManagerImpl in services/device. |
| // PressureObserverManager in Blink uses this interface to make a |
| // PressureClient subscribe to notification about OnPressureUpdated. |
| interface PressureManager { |
| // Add a client that will be notified when a new PressureUpdate for `source` |
| // is obtained. |
| AddClient(pending_remote<PressureClient> client, PressureSource source) |
| => (PressureStatus status); |
| }; |
| |
| // Interface that client of the PressureManager interface must |
| // implement to receive PressureUpdate. |
| // |
| // This interface is implemented by PressureObserverManager in Blink. |
| // PressureManagerImpl uses this interface to deliver PressureUpdate to |
| // its client. |
| interface PressureClient { |
| // Interface used to deliver PressureUpdate. |
| OnPressureUpdated(PressureUpdate update); |
| }; |