Index: third_party/WebKit/public/platform/modules/mediasession/media_session.mojom |
diff --git a/third_party/WebKit/public/platform/modules/mediasession/media_session.mojom b/third_party/WebKit/public/platform/modules/mediasession/media_session.mojom |
index dae65f6e339dbc465103e023d64599ffba08892a..0a022cecb493766aaa80c6d5613ee596b55f7aa9 100644 |
--- a/third_party/WebKit/public/platform/modules/mediasession/media_session.mojom |
+++ b/third_party/WebKit/public/platform/modules/mediasession/media_session.mojom |
@@ -8,6 +8,17 @@ import "mojo/common/common_custom_types.mojom"; |
import "ui/gfx/geometry/mojo/geometry.mojom"; |
import "url/mojo/url.mojom"; |
+// Spec: https://wicg.github.io/mediasession/ |
+enum MediaSessionAction { |
+ PLAY, |
+ PAUSE, |
+ PLAY_PAUSE, |
+ PREVIOUS_TRACK, |
+ NEXT_TRACK, |
+ SEEK_FORWARD, |
+ SEEK_BACKWARD, |
+}; |
+ |
// Album art in MediaMetadata |
// Spec: https://wicg.github.io/mediasession/ |
struct MediaImage { |
@@ -25,6 +36,27 @@ struct MediaMetadata { |
array<MediaImage> artwork; |
}; |
+interface MediaSessionClient { |
+ // Notifies the Blink side that a MediaSessionAction has been fired from the |
+ // UI or the platform. |
+ DidReceiveAction(MediaSessionAction action); |
+}; |
+ |
interface MediaSessionService { |
+ // MediaSessionClient interface is used to notify Blink MediaSession of |
+ // media control actions. |
+ SetClient(MediaSessionClient client); |
+ |
+ // Notifies the browser that the metadata is set, |metadata| will be displayed |
+ // on the UI. |
SetMetadata(MediaMetadata? metadata); |
+ |
+ // Notifies the browser that the event handler for |action| has been set, |
+ // browser needs to show a media button in the UI or register listeners to the |
+ // platform. |
+ EnableAction(MediaSessionAction action); |
+ // Notifies the browser that the event handler for |action| has been set, |
+ // browser needs to hide the media button in the UI and unregister listeners |
+ // from the platform. |
+ DisableAction(MediaSessionAction action); |
}; |