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