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

Unified Diff: third_party/WebKit/Source/modules/mediasession/MediaSession.cpp

Issue 2252783004: Implement MediaSession (metadata) per frame [NOT READY, HAS DEPENDENCY] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Anton's comments Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/mediasession/MediaSession.cpp
diff --git a/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp b/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp
index 5f47c82ef3f575561dc51bb84d86787eb00be185..7e89c1f367c6b97ac2a61e4ebcfc25e085ef937d 100644
--- a/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp
+++ b/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp
@@ -28,6 +28,11 @@ MediaSession* MediaSession::create(ExecutionContext* context, ExceptionState& ex
{
Document* document = toDocument(context);
LocalFrame* frame = document->frame();
+ return create(frame, exceptionState);
+}
+
+MediaSession* MediaSession::create(LocalFrame* frame, ExceptionState& exceptionState)
+{
FrameLoaderClient* client = frame->loader().client();
std::unique_ptr<WebMediaSession> webMediaSession = client->createWebMediaSession();
if (!webMediaSession) {
@@ -43,6 +48,7 @@ ScriptPromise MediaSession::activate(ScriptState* scriptState)
ScriptPromise promise = resolver->promise();
m_webMediaSession->activate(new CallbackPromiseAdapter<void, MediaSessionError>(resolver));
+
return promise;
}
@@ -58,6 +64,7 @@ ScriptPromise MediaSession::deactivate(ScriptState* scriptState)
void MediaSession::setMetadata(MediaMetadata* metadata)
{
m_metadata = metadata;
+
if (metadata) {
WebMediaMetadata webMetadata = (WebMediaMetadata) *metadata;
m_webMediaSession->setMetadata(&webMetadata);

Powered by Google App Engine
This is Rietveld 408576698