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

Unified Diff: Source/modules/mediasession/HTMLMediaElementMediaSession.cpp

Issue 1325493002: NOT FOR LANDING Introduce and use WebMediaSession (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add missing files Created 5 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: Source/modules/mediasession/HTMLMediaElementMediaSession.cpp
diff --git a/Source/modules/mediasession/HTMLMediaElementMediaSession.cpp b/Source/modules/mediasession/HTMLMediaElementMediaSession.cpp
index ddcde17601ffe90911027ed7909630e6e3bda4cf..3226b4f908a48f5bb1b60c633987209627b941ed 100644
--- a/Source/modules/mediasession/HTMLMediaElementMediaSession.cpp
+++ b/Source/modules/mediasession/HTMLMediaElementMediaSession.cpp
@@ -5,6 +5,8 @@
#include "config.h"
#include "modules/mediasession/HTMLMediaElementMediaSession.h"
+#include "Source/core/dom/ExceptionCode.h"
+
namespace blink {
MediaSession* HTMLMediaElementMediaSession::session(HTMLMediaElement& mediaElement)
@@ -14,8 +16,14 @@ MediaSession* HTMLMediaElementMediaSession::session(HTMLMediaElement& mediaEleme
return nullptr;
}
-void HTMLMediaElementMediaSession::setSession(HTMLMediaElement& mediaElement, MediaSession* session)
+void HTMLMediaElementMediaSession::setSession(HTMLMediaElement& mediaElement, MediaSession* session, ExceptionState& exceptionState)
{
+ if (mediaElement.networkState() != HTMLMediaElement::NETWORK_EMPTY
+ && mediaElement.networkState() != HTMLMediaElement::NETWORK_NO_SOURCE) {
+ exceptionState.throwDOMException(InvalidStateError, "A media session must be set when before a resource is selected");
+ return;
+ }
+
from(mediaElement).m_session = session;
}

Powered by Google App Engine
This is Rietveld 408576698