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 import "device/wake_lock/public/interfaces/wake_lock_service.mojom"; | 7 import "device/wake_lock/public/interfaces/wake_lock_service.mojom"; |
8 | 8 |
| 9 enum WakeLockType { |
| 10 // Prevent the application from being suspended. On some platforms, apps may |
| 11 // be suspended when they are not visible to the user. This type of block |
| 12 // requests that the app continue to run in that case, and on all platforms |
| 13 // prevents the system from sleeping. |
| 14 // Example use cases: downloading a file, playing audio. |
| 15 PreventAppSuspension = 0, |
| 16 |
| 17 // Prevent the display from going to sleep. This also has the side effect of |
| 18 // preventing the system from sleeping, but does not necessarily prevent the |
| 19 // app from being suspended on some platforms if the user hides it. |
| 20 // Example use case: playing video. |
| 21 PreventDisplaySleep = 1, |
| 22 }; |
| 23 |
| 24 enum WakeLockReason { |
| 25 // Audio is being played. |
| 26 ReasonAudioPlayback = 0, |
| 27 // Video is being played. |
| 28 ReasonVideoPlayback = 1, |
| 29 // WakeLock for some other reason. |
| 30 ReasonOther = 2, |
| 31 }; |
| 32 |
9 // Context in which WakeLockService instances operate. | 33 // Context in which WakeLockService instances operate. |
10 interface WakeLockContext { | 34 interface WakeLockContext { |
11 // Gets a WakeLockService within this context. | 35 // Gets a WakeLockService within this context. |
12 GetWakeLock(WakeLockService& wake_lock); | 36 GetWakeLock(WakeLockType type, WakeLockReason reason, string description, Wake
LockService& wake_lock); |
13 }; | 37 }; |
OLD | NEW |