Title: [200925] trunk/Source/WebCore
- Revision
- 200925
- Author
- [email protected]
- Date
- 2016-05-14 16:52:01 -0700 (Sat, 14 May 2016)
Log Message
Use new Web IDL dictionary support for MediaSession.setMetadata()
https://bugs.webkit.org/show_bug.cgi?id=157711
Reviewed by Eric Carlson.
Use new Web IDL dictionary support for MediaSession.setMetadata().
No new tests, no intended Web-exposed behavior change.
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::setMetadata):
(WebCore::MediaSession::deactivate): Deleted.
* Modules/mediasession/MediaSession.h:
* Modules/mediasession/MediaSession.idl:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (200924 => 200925)
--- trunk/Source/WebCore/ChangeLog 2016-05-14 22:17:13 UTC (rev 200924)
+++ trunk/Source/WebCore/ChangeLog 2016-05-14 23:52:01 UTC (rev 200925)
@@ -1,3 +1,20 @@
+2016-05-14 Chris Dumez <[email protected]>
+
+ Use new Web IDL dictionary support for MediaSession.setMetadata()
+ https://bugs.webkit.org/show_bug.cgi?id=157711
+
+ Reviewed by Eric Carlson.
+
+ Use new Web IDL dictionary support for MediaSession.setMetadata().
+
+ No new tests, no intended Web-exposed behavior change.
+
+ * Modules/mediasession/MediaSession.cpp:
+ (WebCore::MediaSession::setMetadata):
+ (WebCore::MediaSession::deactivate): Deleted.
+ * Modules/mediasession/MediaSession.h:
+ * Modules/mediasession/MediaSession.idl:
+
2016-05-14 Joseph Pecoraro <[email protected]>
Remove LegacyProfiler
Modified: trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp (200924 => 200925)
--- trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp 2016-05-14 22:17:13 UTC (rev 200924)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp 2016-05-14 23:52:01 UTC (rev 200925)
@@ -30,7 +30,6 @@
#include "Chrome.h"
#include "ChromeClient.h"
-#include "Dictionary.h"
#include "Event.h"
#include "HTMLMediaElement.h"
#include "MediaSessionManager.h"
@@ -113,31 +112,15 @@
return !m_activeParticipatingElements.isEmpty();
}
-void MediaSession::setMetadata(const Dictionary& metadata)
+void MediaSession::setMetadata(const MediaMetadataInit& metadata)
{
- // 5.1.3
- // 1. Let media session be the current media session.
- // 2. Let baseURL be the API base URL specified by the entry settings object.
- // 3. Set media session's title to metadata's title.
- String title;
- metadata.get("title", title);
-
- // 4. Set media session's artist name to metadata's artist.
- String artist;
- metadata.get("artist", artist);
-
- // 5. Set media session's album name to metadata's album.
- String album;
- metadata.get("album", album);
-
- // 6. If metadata's artwork is present, parse it using baseURL, and if that does not return failure, set media
- // session's artwork URL to the return value.
+ // If metadata's artwork is present, parse it using baseURL, and if that does not return failure, set media
+ // session's artwork URL to the return value.
URL artworkURL;
- String artworkPath;
- if (metadata.get("artwork", artworkPath))
- artworkURL = m_document.completeURL(artworkPath);
+ if (!metadata.artwork.isNull())
+ artworkURL = m_document.completeURL(metadata.artwork);
- m_metadata = MediaSessionMetadata(title, artist, album, artworkURL);
+ m_metadata = MediaSessionMetadata(metadata.title, metadata.artist, metadata.album, artworkURL);
if (Page *page = m_document.page())
page->chrome().client().mediaSessionMetadataDidChange(m_metadata);
Modified: trunk/Source/WebCore/Modules/mediasession/MediaSession.h (200924 => 200925)
--- trunk/Source/WebCore/Modules/mediasession/MediaSession.h 2016-05-14 22:17:13 UTC (rev 200924)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.h 2016-05-14 23:52:01 UTC (rev 200925)
@@ -32,7 +32,6 @@
namespace WebCore {
-class Dictionary;
class Document;
class HTMLMediaElement;
@@ -54,8 +53,15 @@
WEBCORE_EXPORT State currentState() const { return m_currentState; }
bool hasActiveMediaElements() const;
- void setMetadata(const Dictionary&);
+ struct MediaMetadataInit {
+ String title;
+ String artist;
+ String album;
+ String artwork;
+ };
+ void setMetadata(const MediaMetadataInit&);
+
void deactivate();
// Runs the media session invocation algorithm and returns true on success.
Modified: trunk/Source/WebCore/Modules/mediasession/MediaSession.idl (200924 => 200925)
--- trunk/Source/WebCore/Modules/mediasession/MediaSession.idl 2016-05-14 22:17:13 UTC (rev 200924)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.idl 2016-05-14 23:52:01 UTC (rev 200925)
@@ -33,7 +33,9 @@
readonly attribute MediaSessionKind kind;
readonly attribute MediaRemoteControls? controls;
- void setMetadata(Dictionary metadata);
+ // FIXME: The latest specification says this should be:
+ // attribute MediaMetadata? metadata;
+ void setMetadata(MediaMetadataInit metadata);
void deactivate();
};
@@ -44,3 +46,10 @@
"transient-solo",
"ambient"
};
+
+dictionary MediaMetadataInit {
+ DOMString title;
+ DOMString artist;
+ DOMString album;
+ DOMString artwork;
+};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes