| 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 // WakeLock receives wake lock preferences from its client. |
| 8 interface WakeLockService { | 8 interface WakeLock { |
| 9 // Requests that a wake lock be applied on behalf of this client. Has no | 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 | 10 // effect if the client has previously called this method without |
| 11 // subsequently calling CancelWakeLock(). | 11 // subsequently calling CancelWakeLock(). |
| 12 RequestWakeLock(); | 12 RequestWakeLock(); |
| 13 | 13 |
| 14 // Cancels all outstanding wake lock requests from this client. If there are | 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 | 15 // no more outstanding requests from any clients, the active wake lock (if |
| 16 // there is one) will be turned off. | 16 // there is one) will be turned off. |
| 17 CancelWakeLock(); | 17 CancelWakeLock(); |
| 18 | 18 |
| 19 // Adds a client to this WakeLockService instance. Clients are grouped on a | 19 // Adds a client to this WakeLock instance. Clients are grouped on a |
| 20 // per-WakeLockService instance basis: that is, a given WakeLockService | 20 // per-WakeLock instance basis: that is, a given WakeLock instance turns |
| 21 // instance turns on its wake lock whenever *any* of its clients make a | 21 // on its wake lock whenever *any* of its clients make a request to do so |
| 22 // request to do so and turns off its wake lock only when *all* its clients | 22 // and turns off its wake lock only when *all* its clients that had |
| 23 // that had previously called RequestWakelock() cancel their requests. | 23 // previously called RequestWakelock() cancel their requests. |
| 24 AddClient(WakeLockService& wake_lock); | 24 AddClient(WakeLock& wake_lock); |
| 25 | 25 |
| 26 // Test-only method that returns whether a wake lock is currently active. | 26 // Test-only method that returns whether a wake lock is currently active. |
| 27 HasWakeLockForTests() => (bool result); | 27 HasWakeLockForTests() => (bool result); |
| 28 }; | 28 }; |
| OLD | NEW |