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

Side by Side Diff: third_party/WebKit/Source/modules/mediasession/MediaMetadata.h

Issue 2584703002: Media Session API: make MediaMetadata mutable. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef MediaMetadata_h 5 #ifndef MediaMetadata_h
6 #define MediaMetadata_h 6 #define MediaMetadata_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "modules/ModulesExport.h" 9 #include "modules/ModulesExport.h"
10 #include "platform/Timer.h"
10 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
11 #include "wtf/text/WTFString.h" 12 #include "wtf/text/WTFString.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class ExecutionContext; 16 class ExecutionContext;
16 class MediaImage; 17 class MediaImage;
17 class MediaMetadataInit; 18 class MediaMetadataInit;
19 class MediaSession;
18 20
19 // Implementation of MediaMetadata interface from the Media Session API. 21 // Implementation of MediaMetadata interface from the Media Session API.
22 // The MediaMetadata object is linked to a MediaSession that owns it. When one
23 // of its properties are updated, the object will notify its MediaSession if
24 // any. The notification will be made asynchronously in order to combine changes
25 // made inside the same event loop. When a MediaMetadata is created and assigned
26 // to a MediaSession, the MediaSession will automatically update.
20 class MODULES_EXPORT MediaMetadata final 27 class MODULES_EXPORT MediaMetadata final
21 : public GarbageCollectedFinalized<MediaMetadata>, 28 : public GarbageCollectedFinalized<MediaMetadata>,
22 public ScriptWrappable { 29 public ScriptWrappable {
23 DEFINE_WRAPPERTYPEINFO(); 30 DEFINE_WRAPPERTYPEINFO();
24 31
25 public: 32 public:
26 static MediaMetadata* create(ExecutionContext*, const MediaMetadataInit&); 33 static MediaMetadata* create(ExecutionContext*, const MediaMetadataInit&);
27 34
28 String title() const; 35 String title() const;
29 String artist() const; 36 String artist() const;
30 String album() const; 37 String album() const;
31 const HeapVector<Member<MediaImage>>& artwork() const; 38 const HeapVector<Member<MediaImage>>& artwork() const;
32 39
40 void setTitle(const String&);
41 void setArtist(const String&);
42 void setAlbum(const String&);
43 void setArtwork(const HeapVector<Member<MediaImage>>&);
44
45 // Called by MediaSession to associate or de-associate itself.
46 void setSession(MediaSession*);
47
33 DECLARE_VIRTUAL_TRACE(); 48 DECLARE_VIRTUAL_TRACE();
34 49
35 private: 50 private:
36 MediaMetadata(ExecutionContext*, const MediaMetadataInit&); 51 MediaMetadata(ExecutionContext*, const MediaMetadataInit&);
37 52
53 // Called when one of the metadata fields is updated from script. It will
54 // notify the session asynchronously in order to bundle multiple call in one
55 // notification.
56 void notifySessionAsync();
57
58 // Called asynchronously after at least one field of MediaMetadata has been
59 // modified.
60 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.
61
38 String m_title; 62 String m_title;
39 String m_artist; 63 String m_artist;
40 String m_album; 64 String m_album;
41 HeapVector<Member<MediaImage>> m_artwork; 65 HeapVector<Member<MediaImage>> m_artwork;
66
67 Member<MediaSession> m_session;
68 Timer<MediaMetadata> m_notifySessionTimer;
42 }; 69 };
43 70
44 } // namespace blink 71 } // namespace blink
45 72
46 #endif // MediaMetadata_h 73 #endif // MediaMetadata_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698