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 |
- |