Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: device/wake_lock/public/interfaces/wake_lock_context.mojom

Issue 2843353003: Move ownership of PowerSaveBlocker from WakeLockServiceContext to WakeLockServiceImpl (Closed)
Patch Set: error fix, non-frame client. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/wake_lock/public/interfaces/wake_lock_context.mojom
diff --git a/device/wake_lock/public/interfaces/wake_lock_context.mojom b/device/wake_lock/public/interfaces/wake_lock_context.mojom
index 24cd02f3bcd27a8841c2cdc7edd14d290596d3f3..42c084687b79a121ade1dd751f78d7835290eebf 100644
--- a/device/wake_lock/public/interfaces/wake_lock_context.mojom
+++ b/device/wake_lock/public/interfaces/wake_lock_context.mojom
@@ -6,10 +6,36 @@ module device.mojom;
import "device/wake_lock/public/interfaces/wake_lock_service.mojom";
+// TODO(heke): Switch PowerSaveBlocker to use WakeLockType and WakeLockReason
+// below once it has no direct consumers.
+enum WakeLockType {
+ // Prevent the application from being suspended. On some platforms, apps may
+ // be suspended when they are not visible to the user. This type of block
+ // requests that the app continue to run in that case, and on all platforms
+ // prevents the system from sleeping.
+ // Example use cases: downloading a file, playing audio.
+ PreventAppSuspension = 0,
+
+ // Prevent the display from going to sleep. This also has the side effect of
+ // preventing the system from sleeping, but does not necessarily prevent the
+ // app from being suspended on some platforms if the user hides it.
+ // Example use case: playing video.
+ PreventDisplaySleep = 1,
+};
+
+enum WakeLockReason {
+ // Audio is being played.
+ ReasonAudioPlayback = 0,
+ // Video is being played.
+ ReasonVideoPlayback = 1,
+ // WakeLock for some other reason.
+ ReasonOther = 2,
+};
+
// Context in which WakeLockService instances operate.
interface WakeLockContext {
// Gets a WakeLockService within this context.
- GetWakeLock(WakeLockService& wake_lock);
+ GetWakeLock(WakeLockType type, WakeLockReason reason, string description, WakeLockService& wake_lock);
// Test-only method that returns whethere a wake lock is currently active
// within this context.

Powered by Google App Engine
This is Rietveld 408576698