| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 blink.mojom; | 5 module blink.mojom; |
| 6 | 6 |
| 7 import "mojo/common/string16.mojom"; | 7 import "mojo/common/string16.mojom"; |
| 8 import "ui/gfx/geometry/mojo/geometry.mojom"; | 8 import "ui/gfx/geometry/mojo/geometry.mojom"; |
| 9 import "url/mojo/url.mojom"; | 9 import "url/mojo/url.mojom"; |
| 10 | 10 |
| 11 // Spec: https://wicg.github.io/mediasession/ | 11 // Spec: https://wicg.github.io/mediasession/ |
| 12 enum MediaSessionAction { | 12 enum MediaSessionAction { |
| 13 PLAY, | 13 PLAY, |
| 14 PAUSE, | 14 PAUSE, |
| 15 PLAY_PAUSE, | |
| 16 PREVIOUS_TRACK, | 15 PREVIOUS_TRACK, |
| 17 NEXT_TRACK, | 16 NEXT_TRACK, |
| 18 SEEK_BACKWARD, | 17 SEEK_BACKWARD, |
| 19 SEEK_FORWARD, | 18 SEEK_FORWARD, |
| 20 | 19 |
| 21 LAST = SEEK_FORWARD, | 20 LAST = SEEK_FORWARD, |
| 22 }; | 21 }; |
| 23 | 22 |
| 23 enum MediaSessionPlaybackState { |
| 24 NONE, |
| 25 PAUSED, |
| 26 PLAYING, |
| 27 }; |
| 28 |
| 24 // Album art in MediaMetadata | 29 // Album art in MediaMetadata |
| 25 // Spec: https://wicg.github.io/mediasession/ | 30 // Spec: https://wicg.github.io/mediasession/ |
| 26 struct MediaImage { | 31 struct MediaImage { |
| 27 url.mojom.Url src; | 32 url.mojom.Url src; |
| 28 mojo.common.mojom.String16 type; | 33 mojo.common.mojom.String16 type; |
| 29 array<gfx.mojom.Size> sizes; | 34 array<gfx.mojom.Size> sizes; |
| 30 }; | 35 }; |
| 31 | 36 |
| 32 // MediaMetadata | 37 // MediaMetadata |
| 33 // Spec: https://wicg.github.io/mediasession/ | 38 // Spec: https://wicg.github.io/mediasession/ |
| 34 struct MediaMetadata { | 39 struct MediaMetadata { |
| 35 mojo.common.mojom.String16 title; | 40 mojo.common.mojom.String16 title; |
| 36 mojo.common.mojom.String16 artist; | 41 mojo.common.mojom.String16 artist; |
| 37 mojo.common.mojom.String16 album; | 42 mojo.common.mojom.String16 album; |
| 38 array<MediaImage> artwork; | 43 array<MediaImage> artwork; |
| 39 }; | 44 }; |
| 40 | 45 |
| 41 interface MediaSessionClient { | 46 interface MediaSessionClient { |
| 42 // Notifies the Blink side that a MediaSessionAction has been fired from the | 47 // Notifies the Blink side that a MediaSessionAction has been fired from the |
| 43 // UI or the platform. | 48 // UI or the platform. |
| 44 DidReceiveAction(MediaSessionAction action); | 49 DidReceiveAction(MediaSessionAction action); |
| 45 }; | 50 }; |
| 46 | 51 |
| 47 interface MediaSessionService { | 52 interface MediaSessionService { |
| 48 // MediaSessionClient interface is used to notify Blink MediaSession of | 53 // MediaSessionClient interface is used to notify Blink MediaSession of |
| 49 // media control actions. | 54 // media control actions. |
| 50 SetClient(MediaSessionClient client); | 55 SetClient(MediaSessionClient client); |
| 51 | 56 |
| 57 // Notifies the browser that the page specified its current playback state. |
| 58 SetPlaybackState(MediaSessionPlaybackState state); |
| 59 |
| 52 // Notifies the browser that the metadata is set, |metadata| will be displayed | 60 // Notifies the browser that the metadata is set, |metadata| will be displayed |
| 53 // on the UI. | 61 // on the UI. |
| 54 SetMetadata(MediaMetadata? metadata); | 62 SetMetadata(MediaMetadata? metadata); |
| 55 | 63 |
| 56 // Notifies the browser that the event handler for |action| has been set, | 64 // Notifies the browser that the event handler for |action| has been set, |
| 57 // browser needs to show a media button in the UI or register listeners to the | 65 // browser needs to show a media button in the UI or register listeners to the |
| 58 // platform. | 66 // platform. |
| 59 EnableAction(MediaSessionAction action); | 67 EnableAction(MediaSessionAction action); |
| 60 // Notifies the browser that the event handler for |action| has been set, | 68 // Notifies the browser that the event handler for |action| has been set, |
| 61 // browser needs to hide the media button in the UI and unregister listeners | 69 // browser needs to hide the media button in the UI and unregister listeners |
| 62 // from the platform. | 70 // from the platform. |
| 63 DisableAction(MediaSessionAction action); | 71 DisableAction(MediaSessionAction action); |
| 64 }; | 72 }; |
| OLD | NEW |