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

Unified Diff: Source/modules/mediastream/MediaStreamTrack.cpp

Issue 15796004: [MediaStream API] Adding MediaStreamTrack::getSourceInfos (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed review comments and merge Created 7 years, 6 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
« no previous file with comments | « Source/modules/mediastream/MediaStreamTrack.h ('k') | Source/modules/mediastream/MediaStreamTrack.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/mediastream/MediaStreamTrack.cpp
diff --git a/Source/modules/mediastream/MediaStreamTrack.cpp b/Source/modules/mediastream/MediaStreamTrack.cpp
index 22251a23c6bb5a66a408e18f4aa504a736584b31..fe6ceafc8095ff6050c78c78de8e9f6de86cda92 100644
--- a/Source/modules/mediastream/MediaStreamTrack.cpp
+++ b/Source/modules/mediastream/MediaStreamTrack.cpp
@@ -27,8 +27,11 @@
#include "modules/mediastream/MediaStreamTrack.h"
#include "core/dom/Event.h"
+#include "core/dom/ScriptExecutionContext.h"
#include "core/platform/mediastream/MediaStreamCenter.h"
#include "core/platform/mediastream/MediaStreamComponent.h"
+#include "public/platform/WebSourceInfo.h"
+#include "weborigin/SecurityOrigin.h"
namespace WebCore {
@@ -115,6 +118,22 @@ String MediaStreamTrack::readyState() const
return String();
}
+SourceInfoVector MediaStreamTrack::getSourceInfos(ScriptExecutionContext* context, ExceptionCode& ec)
+{
+ WebKit::WebVector<WebKit::WebSourceInfo> webSourceInfos;
+ bool ok = MediaStreamCenter::instance().getSourceInfos(context->securityOrigin()->toString(), webSourceInfos);
+ if (!ok) {
+ ec = NOT_SUPPORTED_ERR;
+ return SourceInfoVector();
+ }
+
+ SourceInfoVector sourceInfos;
+ for (size_t i = 0; i < webSourceInfos.size(); ++i)
+ sourceInfos.append(SourceInfo::create(webSourceInfos[i]));
+
+ return sourceInfos;
+}
+
bool MediaStreamTrack::ended() const
{
return m_stopped || (m_component->source()->readyState() == MediaStreamSource::ReadyStateEnded);
« no previous file with comments | « Source/modules/mediastream/MediaStreamTrack.h ('k') | Source/modules/mediastream/MediaStreamTrack.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698