[chromium] MediaStream API: Adding the embedding code for MediaStreamCenter
authortommyw@google.com <tommyw@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 20:53:58 +0000 (20:53 +0000)
committertommyw@google.com <tommyw@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 20:53:58 +0000 (20:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=73130

Reviewed by Darin Fisher.

Source/WebCore:

Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code.

* mediastream/UserMediaClient.h:
(UserMediaClient):
* mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::didCompleteQuery):
* mediastream/UserMediaRequest.h:
(UserMediaRequest):
(WebCore::UserMediaRequest::audio):
(WebCore::UserMediaRequest::video):
(WebCore::UserMediaRequest::cameraPreferenceUser):
(WebCore::UserMediaRequest::cameraPreferenceEnvironment):
* platform/mediastream/MediaStreamCenter.cpp:
(WebCore):
(WebCore::MediaStreamCenter::queryMediaStreamSources):
* platform/mediastream/MediaStreamCenter.h:
(WebCore):
(MediaStreamSourcesQueryClient):
(MediaStreamCenter):

Source/WebKit/chromium:

* WebKit.gyp:
* bridge/MediaStreamCenter.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebCore):
(WebCore::MediaStreamCenter::MediaStreamCenter):
(WebCore::MediaStreamCenter::~MediaStreamCenter):
(WebCore::MediaStreamCenter::queryMediaStreamSources):
(WebCore::MediaStreamCenter::didSetMediaStreamTrackEnabled):
(WebCore::MediaStreamCenter::didStopLocalMediaStream):
(WebCore::MediaStreamCenter::didConstructMediaStream):
* bridge/MediaStreamCenterInternal.cpp: Added.
(WebCore):
(WebCore::MediaStreamCenterInternal::MediaStreamCenterInternal):
(WebCore::MediaStreamCenterInternal::~MediaStreamCenterInternal):
(WebCore::MediaStreamCenterInternal::queryMediaStreamSources):
(WebCore::MediaStreamCenterInternal::didSetMediaStreamTrackEnabled):
(WebCore::MediaStreamCenterInternal::didStopLocalMediaStream):
(WebCore::MediaStreamCenterInternal::didConstructMediaStream):
(WebCore::MediaStreamCenterInternal::stopLocalMediaStream):
* bridge/MediaStreamCenterInternal.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebKit):
(WebCore):
(MediaStreamCenterInternal):
* public/platform/WebKitPlatformSupport.h:
(WebKit):
(WebKit::WebKitPlatformSupport::createMediaStreamCenter):
* public/platform/WebMediaStreamCenter.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebKit):
(WebMediaStreamCenter):
(WebKit::WebMediaStreamCenter::~WebMediaStreamCenter):
* public/platform/WebMediaStreamCenterClient.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebKit):
(WebMediaStreamCenterClient):
(WebKit::WebMediaStreamCenterClient::~WebMediaStreamCenterClient):
* public/platform/WebMediaStreamComponent.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebCore):
(WebKit):
(WebMediaStreamComponent):
(WebKit::WebMediaStreamComponent::WebMediaStreamComponent):
(WebKit::WebMediaStreamComponent::~WebMediaStreamComponent):
(WebKit::WebMediaStreamComponent::isNull):
* public/platform/WebMediaStreamDescriptor.h:
(WebKit):
(WebMediaStreamDescriptor):
* public/platform/WebMediaStreamSourcesRequest.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebCore):
(WebKit):
(WebMediaStreamSourcesRequest):
(WebKit::WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest):
(WebKit::WebMediaStreamSourcesRequest::~WebMediaStreamSourcesRequest):
(WebKit::WebMediaStreamSourcesRequest::isNull):
* src/UserMediaClientImpl.h:
(UserMediaClientImpl):
* src/WebMediaStreamComponent.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebKit):
(WebKit::WebMediaStreamComponent::WebMediaStreamComponent):
(WebKit::WebMediaStreamComponent::operator=):
(WebKit::WebMediaStreamComponent::reset):
(WebKit::WebMediaStreamComponent::operator PassRefPtr<MediaStreamComponent>):
(WebKit::WebMediaStreamComponent::operator MediaStreamComponent*):
(WebKit::WebMediaStreamComponent::isEnabled):
(WebKit::WebMediaStreamComponent::source):
* src/WebMediaStreamDescriptor.cpp:
(WebKit::WebMediaStreamDescriptor::WebMediaStreamDescriptor):
(WebKit):
(WebKit::WebMediaStreamDescriptor::audioSources):
(WebKit::WebMediaStreamDescriptor::videoSources):
* src/WebMediaStreamSourcesRequest.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebKit):
(WebKit::WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest):
(WebKit::WebMediaStreamSourcesRequest::reset):
(WebKit::WebMediaStreamSourcesRequest::audio):
(WebKit::WebMediaStreamSourcesRequest::video):
(WebKit::WebMediaStreamSourcesRequest::didCompleteQuery):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106581 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/mediastream/UserMediaClient.h
Source/WebCore/mediastream/UserMediaRequest.cpp
Source/WebCore/mediastream/UserMediaRequest.h
Source/WebCore/platform/mediastream/MediaStreamCenter.cpp
Source/WebCore/platform/mediastream/MediaStreamCenter.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gyp
Source/WebKit/chromium/bridge/MediaStreamCenter.cpp [new file with mode: 0644]
Source/WebKit/chromium/bridge/MediaStreamCenterInternal.cpp [new file with mode: 0644]
Source/WebKit/chromium/bridge/MediaStreamCenterInternal.h [new file with mode: 0644]
Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h
Source/WebKit/chromium/public/platform/WebMediaStreamCenter.h [new file with mode: 0644]
Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h [new file with mode: 0644]
Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h [new file with mode: 0644]
Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h
Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h [new file with mode: 0644]
Source/WebKit/chromium/src/UserMediaClientImpl.h
Source/WebKit/chromium/src/WebMediaStreamComponent.cpp [new file with mode: 0644]
Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp
Source/WebKit/chromium/src/WebMediaStreamSourcesRequest.cpp [new file with mode: 0644]

index a92efb1..a7f420e 100644 (file)
@@ -1,3 +1,30 @@
+2012-02-02  Tommy Widenflycht  <tommyw@google.com>
+
+        [chromium] MediaStream API: Adding the embedding code for MediaStreamCenter
+        https://bugs.webkit.org/show_bug.cgi?id=73130
+
+        Reviewed by Darin Fisher.
+
+        Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code.
+
+        * mediastream/UserMediaClient.h:
+        (UserMediaClient):
+        * mediastream/UserMediaRequest.cpp:
+        (WebCore::UserMediaRequest::didCompleteQuery):
+        * mediastream/UserMediaRequest.h:
+        (UserMediaRequest):
+        (WebCore::UserMediaRequest::audio):
+        (WebCore::UserMediaRequest::video):
+        (WebCore::UserMediaRequest::cameraPreferenceUser):
+        (WebCore::UserMediaRequest::cameraPreferenceEnvironment):
+        * platform/mediastream/MediaStreamCenter.cpp:
+        (WebCore):
+        (WebCore::MediaStreamCenter::queryMediaStreamSources):
+        * platform/mediastream/MediaStreamCenter.h:
+        (WebCore):
+        (MediaStreamSourcesQueryClient):
+        (MediaStreamCenter):
+
 2012-02-02  Raymond Toy  <rtoy@google.com>
 
         Constant values to set "distanceModel" are undefined
index ce67433..c8e2952 100644 (file)
@@ -42,7 +42,7 @@ class UserMediaClient {
 public:
     virtual void pageDestroyed() = 0;
 
-    virtual void requestUserMedia(PassRefPtr<UserMediaRequest>, const MediaStreamSourceVector&,  const MediaStreamSourceVector&) = 0;
+    virtual void requestUserMedia(PassRefPtr<UserMediaRequest>, const MediaStreamSourceVector& audioSources,  const MediaStreamSourceVector& videoSources) = 0;
     virtual void cancelUserMediaRequest(UserMediaRequest*) = 0;
 
 protected:
index f875d37..faf3d4d 100644 (file)
@@ -71,7 +71,7 @@ void UserMediaRequest::start()
     MediaStreamCenter::instance().queryMediaStreamSources(this);
 }
 
-void UserMediaRequest::mediaStreamSourcesQueryCompleted(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
+void UserMediaRequest::didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
 {
     if (m_client)
         m_client->requestUserMedia(this, audioSources, videoSources);
index 90d5527..a71b5e9 100644 (file)
@@ -51,21 +51,21 @@ public:
     static PassRefPtr<UserMediaRequest> create(ScriptExecutionContext*, UserMediaClient*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>);
     ~UserMediaRequest();
 
-    bool audio() const { return m_audio; }
-    bool video() const { return m_video; }
-
-    bool cameraPreferenceUser() const { return m_cameraPreferenceUser; }
-    bool cameraPreferenceEnvironment() const { return m_cameraPreferenceEnvironment; }
-
     NavigatorUserMediaSuccessCallback* successCallback() const { return m_successCallback.get(); }
     NavigatorUserMediaErrorCallback* errorCallback() const { return m_errorCallback.get(); }
 
     void start();
-    void mediaStreamSourcesQueryCompleted(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
 
     void succeed(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
     void fail();
 
+    // MediaStreamSourcesQueryClient
+    virtual bool audio() const { return m_audio; }
+    virtual bool video() const { return m_video; }
+    virtual bool cameraPreferenceUser() const { return m_cameraPreferenceUser; }
+    virtual bool cameraPreferenceEnvironment() const { return m_cameraPreferenceEnvironment; }
+    virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
+
     // ContextDestructionObserver
     virtual void contextDestroyed();
 
index 9203ce3..abccf5b 100644 (file)
@@ -55,8 +55,9 @@ void MediaStreamCenter::endLocalMediaStream(MediaStreamDescriptor* streamDescrip
         streamDescriptor->setEnded();
 }
 
-// FIXME: remove when real implementations are available
-// Empty implementations for ports that build with MEDIA_STREAM enabled by default.
+#if !PLATFORM(CHROMIUM)
+
+// Empty implementations for ports that build with MEDIA_STREAM enabled by default, but haven't yet implemented MediaStreamCenter.
 
 MediaStreamCenter::MediaStreamCenter()
 {
@@ -69,7 +70,7 @@ MediaStreamCenter::~MediaStreamCenter()
 void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
 {
     MediaStreamSourceVector audioSources, videoSources;
-    client->mediaStreamSourcesQueryCompleted(audioSources, videoSources);
+    client->didCompleteQuery(audioSources, videoSources);
 }
 
 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*)
@@ -84,6 +85,8 @@ void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor*)
 {
 }
 
+#endif // !PLATFORM(CHROMIUM)
+
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)
index 7d98fc5..a37d66a 100644 (file)
 
 namespace WebCore {
 
+#if PLATFORM(CHROMIUM)
+class MediaStreamCenterInternal;
+#endif
+
 class MediaStreamComponent;
 class MediaStreamDescriptor;
 
@@ -47,8 +51,10 @@ public:
 
     virtual bool audio() const = 0;
     virtual bool video() const = 0;
+    virtual bool cameraPreferenceUser() const = 0;
+    virtual bool cameraPreferenceEnvironment() const = 0;
 
-    virtual void mediaStreamSourcesQueryCompleted(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0;
+    virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0;
 };
 
 class MediaStreamCenter {
@@ -73,6 +79,10 @@ public:
 
 private:
     MediaStreamCenter();
+
+#if PLATFORM(CHROMIUM)
+    OwnPtr<MediaStreamCenterInternal> m_private;
+#endif
 };
 
 } // namespace WebCore
index e7b53c7..6b2f63d 100644 (file)
@@ -1,3 +1,84 @@
+2012-02-02  Tommy Widenflycht  <tommyw@google.com>
+
+        [chromium] MediaStream API: Adding the embedding code for MediaStreamCenter
+        https://bugs.webkit.org/show_bug.cgi?id=73130
+
+        Reviewed by Darin Fisher.
+
+        * WebKit.gyp:
+        * bridge/MediaStreamCenter.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+        (WebCore):
+        (WebCore::MediaStreamCenter::MediaStreamCenter):
+        (WebCore::MediaStreamCenter::~MediaStreamCenter):
+        (WebCore::MediaStreamCenter::queryMediaStreamSources):
+        (WebCore::MediaStreamCenter::didSetMediaStreamTrackEnabled):
+        (WebCore::MediaStreamCenter::didStopLocalMediaStream):
+        (WebCore::MediaStreamCenter::didConstructMediaStream):
+        * bridge/MediaStreamCenterInternal.cpp: Added.
+        (WebCore):
+        (WebCore::MediaStreamCenterInternal::MediaStreamCenterInternal):
+        (WebCore::MediaStreamCenterInternal::~MediaStreamCenterInternal):
+        (WebCore::MediaStreamCenterInternal::queryMediaStreamSources):
+        (WebCore::MediaStreamCenterInternal::didSetMediaStreamTrackEnabled):
+        (WebCore::MediaStreamCenterInternal::didStopLocalMediaStream):
+        (WebCore::MediaStreamCenterInternal::didConstructMediaStream):
+        (WebCore::MediaStreamCenterInternal::stopLocalMediaStream):
+        * bridge/MediaStreamCenterInternal.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+        (WebKit):
+        (WebCore):
+        (MediaStreamCenterInternal):
+        * public/platform/WebKitPlatformSupport.h:
+        (WebKit):
+        (WebKit::WebKitPlatformSupport::createMediaStreamCenter):
+        * public/platform/WebMediaStreamCenter.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+        (WebKit):
+        (WebMediaStreamCenter):
+        (WebKit::WebMediaStreamCenter::~WebMediaStreamCenter):
+        * public/platform/WebMediaStreamCenterClient.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+        (WebKit):
+        (WebMediaStreamCenterClient):
+        (WebKit::WebMediaStreamCenterClient::~WebMediaStreamCenterClient):
+        * public/platform/WebMediaStreamComponent.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+        (WebCore):
+        (WebKit):
+        (WebMediaStreamComponent):
+        (WebKit::WebMediaStreamComponent::WebMediaStreamComponent):
+        (WebKit::WebMediaStreamComponent::~WebMediaStreamComponent):
+        (WebKit::WebMediaStreamComponent::isNull):
+        * public/platform/WebMediaStreamDescriptor.h:
+        (WebKit):
+        (WebMediaStreamDescriptor):
+        * public/platform/WebMediaStreamSourcesRequest.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+        (WebCore):
+        (WebKit):
+        (WebMediaStreamSourcesRequest):
+        (WebKit::WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest):
+        (WebKit::WebMediaStreamSourcesRequest::~WebMediaStreamSourcesRequest):
+        (WebKit::WebMediaStreamSourcesRequest::isNull):
+        * src/UserMediaClientImpl.h:
+        (UserMediaClientImpl):
+        * src/WebMediaStreamComponent.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+        (WebKit):
+        (WebKit::WebMediaStreamComponent::WebMediaStreamComponent):
+        (WebKit::WebMediaStreamComponent::operator=):
+        (WebKit::WebMediaStreamComponent::reset):
+        (WebKit::WebMediaStreamComponent::operator PassRefPtr<MediaStreamComponent>):
+        (WebKit::WebMediaStreamComponent::operator MediaStreamComponent*):
+        (WebKit::WebMediaStreamComponent::isEnabled):
+        (WebKit::WebMediaStreamComponent::source):
+        * src/WebMediaStreamDescriptor.cpp:
+        (WebKit::WebMediaStreamDescriptor::WebMediaStreamDescriptor):
+        (WebKit):
+        (WebKit::WebMediaStreamDescriptor::audioSources):
+        (WebKit::WebMediaStreamDescriptor::videoSources):
+        * src/WebMediaStreamSourcesRequest.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+        (WebKit):
+        (WebKit::WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest):
+        (WebKit::WebMediaStreamSourcesRequest::reset):
+        (WebKit::WebMediaStreamSourcesRequest::audio):
+        (WebKit::WebMediaStreamSourcesRequest::video):
+        (WebKit::WebMediaStreamSourcesRequest::didCompleteQuery):
+
 2012-02-02  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed.  Rolled DEPS.
index 1dc2957..68c9bb2 100644 (file)
@@ -91,6 +91,9 @@
                 'WEBKIT_IMPLEMENTATION=1',
             ],
             'sources': [
+                'bridge/MediaStreamCenter.cpp',
+                'bridge/MediaStreamCenterInternal.cpp',
+                'bridge/MediaStreamCenterInternal.h',
                 'bridge/PeerConnectionHandler.cpp',
                 'bridge/PeerConnectionHandlerInternal.cpp',
                 'bridge/PeerConnectionHandlerInternal.h',
                 'public/platform/WebLayerTreeView.h',
                 'public/platform/WebLayerTreeViewClient.h',
                 'public/platform/WebLocalizedString.h',
+                'public/platform/WebMediaStreamCenter.h',
+                'public/platform/WebMediaStreamComponent.h',
                 'public/platform/WebMediaStreamDescriptor.h',
                 'public/platform/WebMediaStreamSource.h',
+                'public/platform/WebMediaStreamSourcesRequest.h',
                 'public/platform/WebNonCopyable.h',
                 'public/platform/WebPeerConnectionHandler.h',
                 'public/platform/WebPeerConnectionHandlerClient.h',
                 'src/WebMediaElement.cpp',
                 'src/WebMediaPlayerClientImpl.cpp',
                 'src/WebMediaPlayerClientImpl.h',
+                'src/WebMediaStreamComponent.cpp',
                 'src/WebMediaStreamDescriptor.cpp',
                 'src/WebMediaStreamRegistry.cpp',
                 'src/WebMediaStreamSource.cpp',
+                'src/WebMediaStreamSourcesRequest.cpp',
                 'src/WebNamedNodeMap.cpp',
                 'src/WebNetworkStateNotifier.cpp',
                 'src/WebNode.cpp',
diff --git a/Source/WebKit/chromium/bridge/MediaStreamCenter.cpp b/Source/WebKit/chromium/bridge/MediaStreamCenter.cpp
new file mode 100644 (file)
index 0000000..99f636d
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "MediaStreamCenter.h"
+
+#include "MediaStreamCenterInternal.h"
+#include "MediaStreamDescriptor.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+MediaStreamCenter::MediaStreamCenter()
+    : m_private(adoptPtr(new MediaStreamCenterInternal(this)))
+{
+}
+
+MediaStreamCenter::~MediaStreamCenter()
+{
+}
+
+void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
+{
+    m_private->queryMediaStreamSources(client);
+}
+
+void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream,  MediaStreamComponent* component)
+{
+    m_private->didSetMediaStreamTrackEnabled(stream, component);
+}
+
+void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor* stream)
+{
+    m_private->didStopLocalMediaStream(stream);
+}
+
+void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor* stream)
+{
+    m_private->didConstructMediaStream(stream);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
diff --git a/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.cpp b/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.cpp
new file mode 100644 (file)
index 0000000..a8693b4
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "MediaStreamCenterInternal.h"
+
+#include "MediaStreamCenter.h"
+#include "MediaStreamComponent.h"
+#include "MediaStreamSource.h"
+#include "WebKit.h"
+#include "platform/WebKitPlatformSupport.h"
+#include "platform/WebMediaStreamCenter.h"
+#include "platform/WebMediaStreamComponent.h"
+#include "platform/WebMediaStreamDescriptor.h"
+#include "platform/WebMediaStreamSourcesRequest.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+MediaStreamCenterInternal::MediaStreamCenterInternal(MediaStreamCenter* owner)
+    : m_private(adoptPtr(WebKit::webKitPlatformSupport()->createMediaStreamCenter(this)))
+    , m_owner(owner)
+{
+}
+
+MediaStreamCenterInternal::~MediaStreamCenterInternal()
+{
+}
+
+void MediaStreamCenterInternal::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
+{
+    // FIXME: Remove this "short-circuit" and forward to m_private when Chrome has implemented WebMediaStreamCenter.
+    MediaStreamSourceVector audioSources, videoSources;
+    client->didCompleteQuery(audioSources, videoSources);
+}
+
+void MediaStreamCenterInternal::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component)
+{
+    if (m_private) {
+        if (component->enabled())
+            m_private->didEnableMediaStreamTrack(stream, component);
+        else
+            m_private->didDisableMediaStreamTrack(stream, component);
+    }
+}
+
+void MediaStreamCenterInternal::didStopLocalMediaStream(MediaStreamDescriptor* stream)
+{
+    if (m_private)
+        m_private->didStopLocalMediaStream(stream);
+}
+
+void MediaStreamCenterInternal::didConstructMediaStream(MediaStreamDescriptor* stream)
+{
+    if (m_private)
+        m_private->didConstructMediaStream(stream);
+}
+
+void MediaStreamCenterInternal::stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor& stream)
+{
+    m_owner->endLocalMediaStream(stream);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
diff --git a/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.h b/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.h
new file mode 100644 (file)
index 0000000..f5c3d8a
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaStreamCenterInternal_h
+#define MediaStreamCenterInternal_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "platform/WebMediaStreamCenterClient.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+class WebMediaStreamCenter;
+}
+
+namespace WebCore {
+
+class MediaStreamCenter;
+class MediaStreamComponent;
+class MediaStreamDescriptor;
+class MediaStreamSourcesQueryClient;
+
+class MediaStreamCenterInternal : public WebKit::WebMediaStreamCenterClient {
+public:
+    explicit MediaStreamCenterInternal(MediaStreamCenter*);
+    ~MediaStreamCenterInternal();
+
+    void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>);
+    void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*);
+    void didStopLocalMediaStream(MediaStreamDescriptor*);
+    void didConstructMediaStream(MediaStreamDescriptor*);
+
+    // From WebKit::WebMediaStreamCenterClient.
+    virtual void stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&);
+
+private:
+    OwnPtr<WebKit::WebMediaStreamCenter> m_private;
+    MediaStreamCenter* m_owner;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // MediaStreamCenterInternal_h
index 0acc9ea..54795fa 100644 (file)
@@ -61,6 +61,8 @@ class WebFileUtilities;
 class WebGraphicsContext3D;
 class WebIDBFactory; // FIXME: Does this belong in platform?
 class WebIDBKey; // FIXME: Does this belong in platform?
+class WebMediaStreamCenter;
+class WebMediaStreamCenterClient;
 class WebMessagePortChannel; // FIXME: Does this belong in platform?
 class WebMimeRegistry;
 class WebPeerConnectionHandler;
@@ -337,6 +339,7 @@ public:
 
     // May return null if WebRTC functionality is not avaliable or out of resources.
     virtual WebPeerConnectionHandler* createPeerConnectionHandler(WebPeerConnectionHandlerClient*) { return 0; }
+    virtual WebMediaStreamCenter* createMediaStreamCenter(WebMediaStreamCenterClient*) { return 0; }
 
     virtual void didStartWorkerRunLoop(const WebWorkerRunLoop&) { }
     virtual void didStopWorkerRunLoop(const WebWorkerRunLoop&) { }
diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamCenter.h b/Source/WebKit/chromium/public/platform/WebMediaStreamCenter.h
new file mode 100644 (file)
index 0000000..8381a9a
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebMediaStreamCenter_h
+#define WebMediaStreamCenter_h
+
+namespace WebKit {
+
+class WebMediaStreamComponent;
+class WebMediaStreamDescriptor;
+class WebMediaStreamSourcesRequest;
+
+class WebMediaStreamCenter {
+public:
+    virtual ~WebMediaStreamCenter() { }
+
+    virtual void queryMediaStreamSources(const WebMediaStreamSourcesRequest&) = 0;
+    virtual void didEnableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) = 0;
+    virtual void didDisableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) = 0;
+    virtual void didStopLocalMediaStream(const WebMediaStreamDescriptor&) = 0;
+    virtual void didConstructMediaStream(const WebMediaStreamDescriptor&) = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebMediaStreamCenter_h
+
diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h b/Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h
new file mode 100644 (file)
index 0000000..8a0825f
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebMediaStreamCenterClient_h
+#define WebMediaStreamCenterClient_h
+
+namespace WebKit {
+
+class WebMediaStreamDescriptor;
+
+class WebMediaStreamCenterClient {
+public:
+    virtual ~WebMediaStreamCenterClient() { }
+
+    virtual void stopLocalMediaStream(const WebMediaStreamDescriptor&) = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebMediaStreamCenterClient_h
diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h b/Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h
new file mode 100644 (file)
index 0000000..bee1855
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebMediaStreamComponent_h
+#define WebMediaStreamComponent_h
+
+#include "WebCommon.h"
+#include "WebNonCopyable.h"
+#include "WebPrivatePtr.h"
+
+namespace WebCore {
+class MediaStreamComponent;
+}
+
+namespace WebKit {
+
+class WebMediaStreamSource;
+class WebString;
+
+class WebMediaStreamComponent {
+public:
+    WebMediaStreamComponent() { }
+    ~WebMediaStreamComponent() { reset(); }
+
+    WEBKIT_EXPORT void reset();
+    bool isNull() const { return m_private.isNull(); }
+
+    WEBKIT_EXPORT WebMediaStreamSource source() const;
+    WEBKIT_EXPORT bool isEnabled() const;
+
+#if WEBKIT_IMPLEMENTATION
+    WebMediaStreamComponent(WebCore::MediaStreamComponent*);
+    WebMediaStreamComponent& operator=(WebCore::MediaStreamComponent*);
+    operator WTF::PassRefPtr<WebCore::MediaStreamComponent>() const;
+    operator WebCore::MediaStreamComponent*() const;
+#endif
+
+private:
+    WebPrivatePtr<WebCore::MediaStreamComponent> m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebMediaStreamComponent_h
index ff8bd19..4923c97 100644 (file)
@@ -36,6 +36,7 @@ class MediaStreamDescriptor;
 
 namespace WebKit {
 
+class WebMediaStreamComponent;
 class WebMediaStreamSource;
 class WebString;
 
@@ -65,10 +66,11 @@ public:
     // DEPRECATED
     WEBKIT_EXPORT void sources(WebVector<WebMediaStreamSource>&) const;
 
-    WEBKIT_EXPORT void audioSources(WebVector<WebMediaStreamSource>&) const;
-    WEBKIT_EXPORT void videoSources(WebVector<WebMediaStreamSource>&) const;
+    WEBKIT_EXPORT void audioSources(WebVector<WebMediaStreamComponent>&) const;
+    WEBKIT_EXPORT void videoSources(WebVector<WebMediaStreamComponent>&) const;
 
 #if WEBKIT_IMPLEMENTATION
+    WebMediaStreamDescriptor(WebCore::MediaStreamDescriptor*);
     WebMediaStreamDescriptor(const WTF::PassRefPtr<WebCore::MediaStreamDescriptor>&);
     operator WTF::PassRefPtr<WebCore::MediaStreamDescriptor>() const;
     operator WebCore::MediaStreamDescriptor*() const;
diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h b/Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h
new file mode 100644 (file)
index 0000000..7fcc7c2
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebMediaStreamSourcesRequest_h
+#define WebMediaStreamSourcesRequest_h
+
+#include "WebCommon.h"
+#include "WebPrivatePtr.h"
+
+namespace WebCore {
+class MediaStreamSourcesQueryClient;
+}
+
+namespace WebKit {
+
+class WebMediaStreamSource;
+template <typename T> class WebVector;
+
+class WebMediaStreamSourcesRequest {
+public:
+    WebMediaStreamSourcesRequest() { }
+    ~WebMediaStreamSourcesRequest() { reset(); }
+
+    WEBKIT_EXPORT void reset();
+    bool isNull() const { return m_private.isNull(); }
+
+    WEBKIT_EXPORT bool audio() const;
+    WEBKIT_EXPORT bool video() const;
+
+    WEBKIT_EXPORT void didCompleteQuery(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) const;
+
+#if WEBKIT_IMPLEMENTATION
+    WebMediaStreamSourcesRequest(const WTF::PassRefPtr<WebCore::MediaStreamSourcesQueryClient>&);
+#endif
+
+private:
+    WebPrivatePtr<WebCore::MediaStreamSourcesQueryClient> m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebMediaStreamSourcesRequest_h
index f087123..f6ab041 100644 (file)
@@ -50,7 +50,7 @@ public:
 
     // WebCore::UserMediaClient ----------------------------------------------
     virtual void pageDestroyed();
-    virtual void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector&, const WebCore::MediaStreamSourceVector&);
+    virtual void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector& audioSources, const WebCore::MediaStreamSourceVector& videoSources);
     virtual void cancelUserMediaRequest(WebCore::UserMediaRequest*);
 
 private:
diff --git a/Source/WebKit/chromium/src/WebMediaStreamComponent.cpp b/Source/WebKit/chromium/src/WebMediaStreamComponent.cpp
new file mode 100644 (file)
index 0000000..644bcf7
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "platform/WebMediaStreamComponent.h"
+
+#include "MediaStreamComponent.h"
+#include "platform/WebMediaStreamSource.h"
+#include "platform/WebString.h"
+#include <wtf/Vector.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebMediaStreamComponent::WebMediaStreamComponent(WebCore::MediaStreamComponent* mediaStreamComponent)
+    : m_private(mediaStreamComponent)
+{
+}
+
+WebMediaStreamComponent& WebMediaStreamComponent::operator=(WebCore::MediaStreamComponent* mediaStreamComponent)
+{
+    m_private = mediaStreamComponent;
+    return *this;
+}
+
+void WebMediaStreamComponent::reset()
+{
+    m_private.reset();
+}
+
+WebMediaStreamComponent::operator PassRefPtr<MediaStreamComponent>() const
+{
+    return m_private.get();
+}
+
+WebMediaStreamComponent::operator MediaStreamComponent*() const
+{
+    return m_private.get();
+}
+
+bool WebMediaStreamComponent::isEnabled() const
+{
+    ASSERT(!m_private.isNull());
+    return m_private.get()->enabled();
+}
+
+WebMediaStreamSource WebMediaStreamComponent::source() const
+{
+    ASSERT(!m_private.isNull());
+    return WebMediaStreamSource(m_private.get()->source());
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(MEDIA_STREAM)
+
index 7daf329..9faa4fd 100644 (file)
@@ -37,6 +37,7 @@
 #include "MediaStreamComponent.h"
 #include "MediaStreamDescriptor.h"
 #include "MediaStreamSource.h"
+#include "platform/WebMediaStreamComponent.h"
 #include "platform/WebMediaStreamSource.h"
 #include "platform/WebString.h"
 #include <wtf/Vector.h>
@@ -50,6 +51,11 @@ WebMediaStreamDescriptor::WebMediaStreamDescriptor(const PassRefPtr<WebCore::Med
 {
 }
 
+WebMediaStreamDescriptor::WebMediaStreamDescriptor(WebCore::MediaStreamDescriptor* mediaStreamDescriptor)
+    : m_private(mediaStreamDescriptor)
+{
+}
+
 void WebMediaStreamDescriptor::reset()
 {
     m_private.reset();
@@ -74,21 +80,21 @@ void WebMediaStreamDescriptor::sources(WebVector<WebMediaStreamSource>& webSourc
     webSources.swap(result);
 }
 
-void WebMediaStreamDescriptor::audioSources(WebVector<WebMediaStreamSource>& webSources) const
+void WebMediaStreamDescriptor::audioSources(WebVector<WebMediaStreamComponent>& webSources) const
 {
     size_t numberOfSources = m_private->numberOfAudioComponents();
-    WebVector<WebMediaStreamSource> result(numberOfSources);
+    WebVector<WebMediaStreamComponent> result(numberOfSources);
     for (size_t i = 0; i < numberOfSources; ++i)
-        result[i] = m_private->audioComponent(i)->source();
+        result[i] = m_private->audioComponent(i);
     webSources.swap(result);
 }
 
-void WebMediaStreamDescriptor::videoSources(WebVector<WebMediaStreamSource>& webSources) const
+void WebMediaStreamDescriptor::videoSources(WebVector<WebMediaStreamComponent>& webSources) const
 {
     size_t numberOfSources = m_private->numberOfVideoComponents();
-    WebVector<WebMediaStreamSource> result(numberOfSources);
+    WebVector<WebMediaStreamComponent> result(numberOfSources);
     for (size_t i = 0; i < numberOfSources; ++i)
-        result[i] = m_private->videoComponent(i)->source();
+        result[i] = m_private->videoComponent(i);
     webSources.swap(result);
 }
 
diff --git a/Source/WebKit/chromium/src/WebMediaStreamSourcesRequest.cpp b/Source/WebKit/chromium/src/WebMediaStreamSourcesRequest.cpp
new file mode 100644 (file)
index 0000000..ea88680
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "platform/WebMediaStreamSourcesRequest.h"
+
+#include "MediaStreamCenter.h"
+#include "MediaStreamSource.h"
+#include "platform/WebMediaStreamSource.h"
+#include "platform/WebVector.h"
+#include <wtf/Vector.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest(const PassRefPtr<WebCore::MediaStreamSourcesQueryClient>& queryClient)
+    : m_private(queryClient)
+{
+}
+
+void WebMediaStreamSourcesRequest::reset()
+{
+    m_private.reset();
+}
+
+bool WebMediaStreamSourcesRequest::audio() const
+{
+    ASSERT(!isNull());
+    return m_private->audio();
+}
+
+bool WebMediaStreamSourcesRequest::video() const
+{
+    ASSERT(!isNull());
+    return m_private->video();
+}
+
+void WebMediaStreamSourcesRequest::didCompleteQuery(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) const
+{
+    ASSERT(!isNull());
+    MediaStreamSourceVector audio;
+    for (size_t i = 0; i < audioSources.size(); ++i) {
+        MediaStreamSource* curr = audioSources[i];
+        audio.append(curr);
+    }
+    MediaStreamSourceVector video;
+    for (size_t i = 0; i < videoSources.size(); ++i) {
+        MediaStreamSource* curr = videoSources[i];
+        video.append(curr);
+    }
+    m_private->didCompleteQuery(audio, video);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(MEDIA_STREAM)
+