OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module device.mojom; | 5 module device.mojom; |
6 | 6 |
7 // WebLockService receives wake lock preferences from its client. | 7 // WebLockService receives wake lock preferences from its client. |
8 interface WakeLockService { | 8 interface WakeLockService { |
| 9 // Requests that a wake lock be applied on behalf of this client. Has no |
| 10 // effect if the client has previously called this method without |
| 11 // subsequently calling CancelWakeLock(). |
9 RequestWakeLock(); | 12 RequestWakeLock(); |
| 13 |
| 14 // Cancels all outstanding wake lock requests from this client. If there are |
| 15 // no more outstanding requests from any clients, the active wake lock (if |
| 16 // there is one) will be turned off. |
10 CancelWakeLock(); | 17 CancelWakeLock(); |
| 18 |
| 19 // Adds a client to this WakeLockService instance. Clients are grouped on a |
| 20 // per-WakeLockService instance basis: that is, a given WakeLockService |
| 21 // instance turns on its wake lock whenever *any* of its clients make a |
| 22 // request to do so and turns off its wake lock only when *all* its clients |
| 23 // that had previously called RequestWakelock() cancel their requests. |
| 24 AddClient(WakeLockService& wake_lock); |
| 25 |
| 26 // Test-only method that returns whether a wake lock is currently active. |
| 27 HasWakeLockForTests() => (bool result); |
11 }; | 28 }; |
OLD | NEW |