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

Unified Diff: Source/core/platform/chromium/support/WebSourceInfo.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/core/core.gypi ('k') | Source/core/platform/mediastream/MediaStreamCenter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/chromium/support/WebSourceInfo.cpp
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/MockWebRTCDTMFSenderHandler.cpp b/Source/core/platform/chromium/support/WebSourceInfo.cpp
similarity index 38%
copy from Tools/DumpRenderTree/chromium/TestRunner/src/MockWebRTCDTMFSenderHandler.cpp
copy to Source/core/platform/chromium/support/WebSourceInfo.cpp
index 72895dc07ac8d972a1c370b2f96a70adbd3c79a4..449e6d9eaf3d9e988a0f8dad023e56d12dd7355e 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/MockWebRTCDTMFSenderHandler.cpp
+++ b/Source/core/platform/chromium/support/WebSourceInfo.cpp
@@ -25,71 +25,88 @@
#include "config.h"
-#include "MockWebRTCDTMFSenderHandler.h"
+#include "public/platform/WebSourceInfo.h"
-#include "WebTestDelegate.h"
-#include <assert.h>
-#include "public/platform/WebMediaStreamSource.h"
-#include "public/platform/WebRTCDTMFSenderHandlerClient.h"
+#include "public/platform/WebString.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
-using namespace WebKit;
+namespace WebKit {
-namespace WebTestRunner {
-
-class DTMFSenderToneTask : public WebMethodTask<MockWebRTCDTMFSenderHandler> {
+class WebSourceInfoPrivate : public RefCounted<WebSourceInfoPrivate> {
public:
- DTMFSenderToneTask(MockWebRTCDTMFSenderHandler* object, WebRTCDTMFSenderHandlerClient* client)
- : WebMethodTask<MockWebRTCDTMFSenderHandler>(object)
- , m_client(client)
- {
- }
-
- virtual void runIfValid() OVERRIDE
- {
- WebString tones = m_object->currentToneBuffer();
- m_object->clearToneBuffer();
- m_client->didPlayTone(tones);
- }
+ static PassRefPtr<WebSourceInfoPrivate> create(const WebString& id, WebSourceInfo::SourceKind, const WebString& label, WebSourceInfo::VideoFacingMode);
+ virtual ~WebSourceInfoPrivate();
+
+ const WebString& id() const { return m_id; }
+ WebSourceInfo::SourceKind kind() const { return m_kind; }
+ const WebString& label() const { return m_label; }
+ WebSourceInfo::VideoFacingMode facing() const { return m_facing; }
private:
- WebRTCDTMFSenderHandlerClient* m_client;
+ WebSourceInfoPrivate(const WebString& id, WebSourceInfo::SourceKind, const WebString& label, WebSourceInfo::VideoFacingMode);
+
+ WebString m_id;
+ WebSourceInfo::SourceKind m_kind;
+ WebString m_label;
+ WebSourceInfo::VideoFacingMode m_facing;
};
-/////////////////////
+PassRefPtr<WebSourceInfoPrivate> WebSourceInfoPrivate::create(const WebString& id, WebSourceInfo::SourceKind kind, const WebString& label, WebSourceInfo::VideoFacingMode facing)
+{
+ return adoptRef(new WebSourceInfoPrivate(id, kind, label, facing));
+}
-MockWebRTCDTMFSenderHandler::MockWebRTCDTMFSenderHandler(const WebMediaStreamTrack& track, WebTestDelegate* delegate)
- : m_client(0)
- , m_track(track)
- , m_delegate(delegate)
+WebSourceInfoPrivate::WebSourceInfoPrivate(const WebString& id, WebSourceInfo::SourceKind kind, const WebString& label, WebSourceInfo::VideoFacingMode facing)
+ : m_id(id)
+ , m_kind(kind)
+ , m_label(label)
+ , m_facing(facing)
{
}
-void MockWebRTCDTMFSenderHandler::setClient(WebRTCDTMFSenderHandlerClient* client)
+WebSourceInfoPrivate::~WebSourceInfoPrivate()
{
- m_client = client;
}
-WebString MockWebRTCDTMFSenderHandler::currentToneBuffer()
+void WebSourceInfo::assign(const WebSourceInfo& other)
{
- return m_toneBuffer;
+ m_private = other.m_private;
}
-bool MockWebRTCDTMFSenderHandler::canInsertDTMF()
+void WebSourceInfo::reset()
{
- assert(m_client && !m_track.isNull());
- return m_track.source().type() == WebMediaStreamSource::TypeAudio && m_track.isEnabled() && m_track.source().readyState() == WebMediaStreamSource::ReadyStateLive;
+ m_private.reset();
}
-bool MockWebRTCDTMFSenderHandler::insertDTMF(const WebString& tones, long duration, long interToneGap)
+void WebSourceInfo::initialize(const WebString& id, WebSourceInfo::SourceKind kind, const WebString& label, WebSourceInfo::VideoFacingMode facing)
{
- assert(m_client);
- if (!canInsertDTMF())
- return false;
-
- m_toneBuffer = tones;
- m_delegate->postTask(new DTMFSenderToneTask(this, m_client));
- m_delegate->postTask(new DTMFSenderToneTask(this, m_client));
- return true;
+ m_private = WebSourceInfoPrivate::create(id, kind, label, facing);
}
+WebString WebSourceInfo::id() const
+{
+ ASSERT(!m_private.isNull());
+ return m_private->id();
+}
+
+WebSourceInfo::SourceKind WebSourceInfo::kind() const
+{
+ ASSERT(!m_private.isNull());
+ return m_private->kind();
}
+
+WebString WebSourceInfo::label() const
+{
+ ASSERT(!m_private.isNull());
+ return m_private->label();
+}
+
+WebSourceInfo::VideoFacingMode WebSourceInfo::facing() const
+{
+ ASSERT(!m_private.isNull());
+ return m_private->facing();
+}
+
+} // namespace WebKit
+
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/platform/mediastream/MediaStreamCenter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698