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

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

Issue 2867303003: Generalize the API of WakeLockContext mojo interface. (Closed)
Patch Set: Created 3 years, 7 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 bb01e64b8bfd1839eac0726b374020babdce49e8..178994b46cfc87bf7c3d64254fdc63fff04d39dc 100644
--- a/device/wake_lock/public/interfaces/wake_lock_context.mojom
+++ b/device/wake_lock/public/interfaces/wake_lock_context.mojom
@@ -6,8 +6,34 @@ module device.mojom;
import "device/wake_lock/public/interfaces/wake_lock_service.mojom";
+// TODO(heke): Switch PowerSaveBlocker to use WakeLockType and WakeLockReason
blundell 2017/05/09 15:53:24 I think that we could just do the mapping from moj
ke.he 2017/05/10 07:00:20 Good idea, in this way we don't need the typemap e
+// 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);
};

Powered by Google App Engine
This is Rietveld 408576698