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

Unified Diff: Source/modules/mediastream/SourceInfo.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/SourceInfo.h ('k') | Source/modules/mediastream/SourceInfo.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/mediastream/SourceInfo.cpp
diff --git a/Source/modules/mediastream/RTCDTMFToneChangeEvent.cpp b/Source/modules/mediastream/SourceInfo.cpp
similarity index 53%
copy from Source/modules/mediastream/RTCDTMFToneChangeEvent.cpp
copy to Source/modules/mediastream/SourceInfo.cpp
index 5643c851390d7a59efd9cf968b8fa8ce936f9b3c..e57df18d3ff54088c0225e14194ac73f31627e4f 100644
--- a/Source/modules/mediastream/RTCDTMFToneChangeEvent.cpp
+++ b/Source/modules/mediastream/SourceInfo.cpp
@@ -24,60 +24,62 @@
*/
#include "config.h"
-#include "modules/mediastream/RTCDTMFToneChangeEvent.h"
+#include "modules/mediastream/SourceInfo.h"
-#include "core/dom/EventNames.h"
+#include "wtf/text/WTFString.h"
namespace WebCore {
-PassRefPtr<RTCDTMFToneChangeEvent> RTCDTMFToneChangeEvent::create()
+PassRefPtr<SourceInfo> SourceInfo::create(const WebKit::WebSourceInfo& webSourceInfo)
{
- return adoptRef(new RTCDTMFToneChangeEvent);
+ ASSERT(!webSourceInfo.isNull());
+ return adoptRef(new SourceInfo(webSourceInfo));
}
-PassRefPtr<RTCDTMFToneChangeEvent> RTCDTMFToneChangeEvent::create(const String& tone)
-{
- return adoptRef(new RTCDTMFToneChangeEvent(tone));
-}
-
-PassRefPtr<RTCDTMFToneChangeEvent> RTCDTMFToneChangeEvent::create(const AtomicString& type, const RTCDTMFToneChangeEventInit& initializer)
-{
- ASSERT(type == eventNames().tonechangeEvent);
- return adoptRef(new RTCDTMFToneChangeEvent(initializer));
-}
-
-RTCDTMFToneChangeEvent::RTCDTMFToneChangeEvent()
+SourceInfo::SourceInfo(const WebKit::WebSourceInfo& webSourceInfo)
+ : m_webSourceInfo(webSourceInfo)
{
ScriptWrappable::init(this);
}
-RTCDTMFToneChangeEvent::RTCDTMFToneChangeEvent(const String& tone)
- : Event(eventNames().tonechangeEvent, false, false)
- , m_tone(tone)
+String SourceInfo::id() const
{
- ScriptWrappable::init(this);
+ return m_webSourceInfo.id();
}
-RTCDTMFToneChangeEvent::RTCDTMFToneChangeEvent(const RTCDTMFToneChangeEventInit& initializer)
- : Event(eventNames().tonechangeEvent, initializer)
- , m_tone(initializer.tone)
+String SourceInfo::kind() const
{
- ScriptWrappable::init(this);
-}
+ switch (m_webSourceInfo.kind()) {
+ case WebKit::WebSourceInfo::SourceKindAudio:
+ return ASCIILiteral("audio");
+ case WebKit::WebSourceInfo::SourceKindVideo:
+ return ASCIILiteral("video");
+ case WebKit::WebSourceInfo::SourceKindNone:
+ return ASCIILiteral("none");
+ }
-RTCDTMFToneChangeEvent::~RTCDTMFToneChangeEvent()
-{
+ ASSERT_NOT_REACHED();
+ return String();
}
-const String& RTCDTMFToneChangeEvent::tone() const
+String SourceInfo::label() const
{
- return m_tone;
+ return m_webSourceInfo.label();
}
-const AtomicString& RTCDTMFToneChangeEvent::interfaceName() const
+String SourceInfo::facing() const
{
- return eventNames().interfaceForRTCDTMFToneChangeEvent;
+ switch (m_webSourceInfo.facing()) {
+ case WebKit::WebSourceInfo::VideoFacingModeNone:
+ return String();
+ case WebKit::WebSourceInfo::VideoFacingModeUser:
+ return ASCIILiteral("user");
+ case WebKit::WebSourceInfo::VideoFacingModeEnvironment:
+ return ASCIILiteral("environment");
+ }
+
+ ASSERT_NOT_REACHED();
+ return String();
}
} // namespace WebCore
-
« no previous file with comments | « Source/modules/mediastream/SourceInfo.h ('k') | Source/modules/mediastream/SourceInfo.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698