Chromium Code Reviews| Index: third_party/WebKit/Source/modules/mediasession/MediaMetadata.h |
| diff --git a/third_party/WebKit/Source/modules/mediasession/MediaMetadata.h b/third_party/WebKit/Source/modules/mediasession/MediaMetadata.h |
| index 00927feac1af369fe1ea7afb6ab41c1f0fa3d389..4db79beb865d673dbfb8178a457d7d97d5b0b6a0 100644 |
| --- a/third_party/WebKit/Source/modules/mediasession/MediaMetadata.h |
| +++ b/third_party/WebKit/Source/modules/mediasession/MediaMetadata.h |
| @@ -7,6 +7,7 @@ |
| #include "bindings/core/v8/ScriptWrappable.h" |
| #include "modules/ModulesExport.h" |
| +#include "platform/Timer.h" |
| #include "platform/heap/Handle.h" |
| #include "wtf/text/WTFString.h" |
| @@ -15,8 +16,14 @@ namespace blink { |
| class ExecutionContext; |
| class MediaImage; |
| class MediaMetadataInit; |
| +class MediaSession; |
| // Implementation of MediaMetadata interface from the Media Session API. |
| +// The MediaMetadata object is linked to a MediaSession that owns it. When one |
| +// of its properties are updated, the object will notify its MediaSession if |
| +// any. The notification will be made asynchronously in order to combine changes |
| +// made inside the same event loop. When a MediaMetadata is created and assigned |
| +// to a MediaSession, the MediaSession will automatically update. |
| class MODULES_EXPORT MediaMetadata final |
| : public GarbageCollectedFinalized<MediaMetadata>, |
| public ScriptWrappable { |
| @@ -30,15 +37,35 @@ class MODULES_EXPORT MediaMetadata final |
| String album() const; |
| const HeapVector<Member<MediaImage>>& artwork() const; |
| + void setTitle(const String&); |
| + void setArtist(const String&); |
| + void setAlbum(const String&); |
| + void setArtwork(const HeapVector<Member<MediaImage>>&); |
| + |
| + // Called by MediaSession to associate or de-associate itself. |
| + void setSession(MediaSession*); |
| + |
| DECLARE_VIRTUAL_TRACE(); |
| private: |
| MediaMetadata(ExecutionContext*, const MediaMetadataInit&); |
| + // Called when one of the metadata fields is updated from script. It will |
| + // notify the session asynchronously in order to bundle multiple call in one |
| + // notification. |
| + void notifySessionAsync(); |
| + |
| + // Called asynchronously after at least one field of MediaMetadata has been |
| + // modified. |
| + void notifySessionFired(TimerBase*); |
|
Zhiqiang Zhang (Slow)
2016/12/16 16:01:47
nit: s/notifySessionFired/notifySessionTimerFired
mlamouri (slow - plz ping)
2016/12/16 18:43:40
Done.
|
| + |
| String m_title; |
| String m_artist; |
| String m_album; |
| HeapVector<Member<MediaImage>> m_artwork; |
| + |
| + Member<MediaSession> m_session; |
| + Timer<MediaMetadata> m_notifySessionTimer; |
| }; |
| } // namespace blink |