Title: [101058] trunk/Source/WebKit/chromium
Revision
101058
Author
[email protected]
Date
2011-11-23 02:02:27 -0800 (Wed, 23 Nov 2011)

Log Message

[chromium] MediaStream API: Adding embedding code for GetUserMedia
https://bugs.webkit.org/show_bug.cgi?id=71678

This patch includes a fix for https://bugs.webkit.org/show_bug.cgi?id=72925.

Patch by Tommy Widenflycht <[email protected]> on 2011-11-23
Reviewed by Darin Fisher.

* WebKit.gyp:
* public/WebUserMediaClient.h: Added.
(WebKit::WebUserMediaClient::~WebUserMediaClient):
* public/WebUserMediaRequest.h: Added.
(WebKit::WebUserMediaRequest::WebUserMediaRequest):
(WebKit::WebUserMediaRequest::~WebUserMediaRequest):
(WebKit::WebUserMediaRequest::operator=):
(WebKit::WebUserMediaRequest::isNull):
(WebKit::operator==):
* public/WebViewClient.h:
(WebKit::WebViewClient::userMediaClient):
* src/UserMediaClientImpl.cpp: Added.
(WebKit::UserMediaClientImpl::UserMediaClientImpl):
(WebKit::UserMediaClientImpl::pageDestroyed):
(WebKit::UserMediaClientImpl::requestUserMedia):
(WebKit::UserMediaClientImpl::cancelUserMediaRequest):
* src/UserMediaClientImpl.h: Added.
* src/WebUserMediaRequest.cpp: Added.
(WebKit::WebUserMediaRequest::WebUserMediaRequest):
(WebKit::WebUserMediaRequest::reset):
(WebKit::WebUserMediaRequest::audio):
(WebKit::WebUserMediaRequest::video):
(WebKit::WebUserMediaRequest::cameraPreferenceUser):
(WebKit::WebUserMediaRequest::cameraPreferenceEnvironment):
(WebKit::WebUserMediaRequest::securityOrigin):
(WebKit::WebUserMediaRequest::requestSucceeded):
(WebKit::WebUserMediaRequest::requestFailed):
(WebKit::WebUserMediaRequest::equals):
(WebKit::WebUserMediaRequest::assign):
(WebKit::WebUserMediaRequest::operator UserMediaRequest*):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):
* src/WebViewImpl.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (101057 => 101058)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-11-23 09:25:39 UTC (rev 101057)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-11-23 10:02:27 UTC (rev 101058)
@@ -1,3 +1,46 @@
+2011-11-23  Tommy Widenflycht  <[email protected]>
+
+        [chromium] MediaStream API: Adding embedding code for GetUserMedia
+        https://bugs.webkit.org/show_bug.cgi?id=71678
+
+        This patch includes a fix for https://bugs.webkit.org/show_bug.cgi?id=72925.
+
+        Reviewed by Darin Fisher.
+
+        * WebKit.gyp:
+        * public/WebUserMediaClient.h: Added.
+        (WebKit::WebUserMediaClient::~WebUserMediaClient):
+        * public/WebUserMediaRequest.h: Added.
+        (WebKit::WebUserMediaRequest::WebUserMediaRequest):
+        (WebKit::WebUserMediaRequest::~WebUserMediaRequest):
+        (WebKit::WebUserMediaRequest::operator=):
+        (WebKit::WebUserMediaRequest::isNull):
+        (WebKit::operator==):
+        * public/WebViewClient.h:
+        (WebKit::WebViewClient::userMediaClient):
+        * src/UserMediaClientImpl.cpp: Added.
+        (WebKit::UserMediaClientImpl::UserMediaClientImpl):
+        (WebKit::UserMediaClientImpl::pageDestroyed):
+        (WebKit::UserMediaClientImpl::requestUserMedia):
+        (WebKit::UserMediaClientImpl::cancelUserMediaRequest):
+        * src/UserMediaClientImpl.h: Added.
+        * src/WebUserMediaRequest.cpp: Added.
+        (WebKit::WebUserMediaRequest::WebUserMediaRequest):
+        (WebKit::WebUserMediaRequest::reset):
+        (WebKit::WebUserMediaRequest::audio):
+        (WebKit::WebUserMediaRequest::video):
+        (WebKit::WebUserMediaRequest::cameraPreferenceUser):
+        (WebKit::WebUserMediaRequest::cameraPreferenceEnvironment):
+        (WebKit::WebUserMediaRequest::securityOrigin):
+        (WebKit::WebUserMediaRequest::requestSucceeded):
+        (WebKit::WebUserMediaRequest::requestFailed):
+        (WebKit::WebUserMediaRequest::equals):
+        (WebKit::WebUserMediaRequest::assign):
+        (WebKit::WebUserMediaRequest::operator UserMediaRequest*):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::WebViewImpl):
+        * src/WebViewImpl.h:
+
 2011-11-23  Antoine Labour  <[email protected]>
 
         [chromium] Expose showFPSCounter and showPlatformLayerTree in WebLayerTreeView::Settings

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (101057 => 101058)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2011-11-23 09:25:39 UTC (rev 101057)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2011-11-23 10:02:27 UTC (rev 101058)
@@ -327,6 +327,8 @@
                 'public/WebURLLoaderClient.h',
                 'public/WebURLRequest.h',
                 'public/WebURLResponse.h',
+                'public/WebUserMediaClient.h',
+                'public/WebUserMediaRequest.h',
                 'public/WebVector.h',
                 'public/WebView.h',
                 'public/WebViewClient.h',
@@ -454,6 +456,8 @@
                 'src/StorageInfoChromium.cpp',
                 'src/StorageNamespaceProxy.cpp',
                 'src/StorageNamespaceProxy.h',
+                'src/UserMediaClientImpl.h',
+                'src/UserMediaClientImpl.cpp',
                 'src/WebTextCheckingCompletionImpl.h',
                 'src/WebTextCheckingCompletionImpl.cpp',
                 'src/VideoFrameChromiumImpl.cpp',
@@ -637,6 +641,7 @@
                 'src/WebURLResponse.cpp',
                 'src/WebURLResponsePrivate.h',
                 'src/WebURLError.cpp',
+                'src/WebUserMediaRequest.cpp',
                 'src/WebViewImpl.cpp',
                 'src/WebViewImpl.h',
                 'src/WebWorkerBase.cpp',

Added: trunk/Source/WebKit/chromium/public/WebUserMediaClient.h (0 => 101058)


--- trunk/Source/WebKit/chromium/public/WebUserMediaClient.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/public/WebUserMediaClient.h	2011-11-23 10:02:27 UTC (rev 101058)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2011 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 WebUserMediaClient_h
+#define WebUserMediaClient_h
+
+namespace WebKit {
+
+class WebMediaStreamSource;
+class WebUserMediaRequest;
+template <typename T> class WebVector;
+
+class WebUserMediaClient {
+public:
+    virtual ~WebUserMediaClient() { }
+
+    virtual void requestUserMedia(const WebUserMediaRequest&, const WebVector<WebMediaStreamSource>&) = 0;
+    virtual void cancelUserMediaRequest(const WebUserMediaRequest&) = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebUserMediaClient_h

Added: trunk/Source/WebKit/chromium/public/WebUserMediaRequest.h (0 => 101058)


--- trunk/Source/WebKit/chromium/public/WebUserMediaRequest.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/public/WebUserMediaRequest.h	2011-11-23 10:02:27 UTC (rev 101058)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2011 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 WebUserMediaRequest_h
+#define WebUserMediaRequest_h
+
+#include "WebCommon.h"
+#include "WebPrivatePtr.h"
+
+namespace WebCore {
+class UserMediaRequest;
+}
+
+namespace WebKit {
+
+class WebMediaStreamSource;
+class WebSecurityOrigin;
+class WebString;
+template <typename T> class WebVector;
+
+class WebUserMediaRequest {
+public:
+    WebUserMediaRequest() { }
+    WebUserMediaRequest(const WebUserMediaRequest& request) { assign(request); }
+    ~WebUserMediaRequest() { reset(); }
+
+    WebUserMediaRequest& operator=(const WebUserMediaRequest& other)
+    {
+        assign(other);
+        return *this;
+    }
+
+    WEBKIT_EXPORT void reset();
+    bool isNull() const { return m_private.isNull(); }
+    WEBKIT_EXPORT bool equals(const WebUserMediaRequest&) const;
+    WEBKIT_EXPORT void assign(const WebUserMediaRequest&);
+
+    WEBKIT_EXPORT bool audio() const;
+    WEBKIT_EXPORT bool video() const;
+    WEBKIT_EXPORT bool cameraPreferenceUser() const;
+    WEBKIT_EXPORT bool cameraPreferenceEnvironment() const;
+    WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const;
+
+    WEBKIT_EXPORT void requestSucceeded(const WebVector<WebMediaStreamSource>&);
+    WEBKIT_EXPORT void requestFailed();
+
+#if WEBKIT_IMPLEMENTATION
+    WebUserMediaRequest(const PassRefPtr<WebCore::UserMediaRequest>&);
+    operator WebCore::UserMediaRequest*() const;
+#endif
+
+private:
+    WebPrivatePtr<WebCore::UserMediaRequest> m_private;
+};
+
+inline bool operator==(const WebUserMediaRequest& a, const WebUserMediaRequest& b)
+{
+    return a.equals(b);
+}
+
+} // namespace WebKit
+
+#endif // WebUserMediaRequest_h

Modified: trunk/Source/WebKit/chromium/public/WebViewClient.h (101057 => 101058)


--- trunk/Source/WebKit/chromium/public/WebViewClient.h	2011-11-23 09:25:39 UTC (rev 101057)
+++ trunk/Source/WebKit/chromium/public/WebViewClient.h	2011-11-23 10:02:27 UTC (rev 101058)
@@ -67,6 +67,7 @@
 class WebStorageNamespace;
 class WebURL;
 class WebURLRequest;
+class WebUserMediaClient;
 class WebView;
 class WebWidget;
 struct WebConsoleMessage;
@@ -319,6 +320,10 @@
         return WebPageVisibilityStateVisible;
     }
 
+    // Media Streams -------------------------------------------------------
+
+    virtual WebUserMediaClient* userMediaClient() { return 0; }
+
 protected:
     ~WebViewClient() { }
 };

Added: trunk/Source/WebKit/chromium/src/UserMediaClientImpl.cpp (0 => 101058)


--- trunk/Source/WebKit/chromium/src/UserMediaClientImpl.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/UserMediaClientImpl.cpp	2011-11-23 10:02:27 UTC (rev 101058)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2011 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 "UserMediaClientImpl.h"
+
+#include "WebMediaStreamSource.h"
+#include "WebUserMediaClient.h"
+#include "WebUserMediaRequest.h"
+#include "WebViewClient.h"
+#include "WebViewImpl.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+UserMediaClientImpl::UserMediaClientImpl(WebViewImpl* webView)
+    : m_client(webView->client() ? webView->client()->userMediaClient() : 0)
+{
+}
+
+void UserMediaClientImpl::pageDestroyed()
+{
+}
+
+void UserMediaClientImpl::requestUserMedia(PassRefPtr<UserMediaRequest> request, const MediaStreamSourceVector& sources)
+{
+    if (m_client)
+        m_client->requestUserMedia(request, sources);
+}
+
+void UserMediaClientImpl::cancelUserMediaRequest(UserMediaRequest* request)
+{
+    if (m_client)
+        m_client->cancelUserMediaRequest(WebUserMediaRequest(request));
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(MEDIA_STREAM)

Added: trunk/Source/WebKit/chromium/src/UserMediaClientImpl.h (0 => 101058)


--- trunk/Source/WebKit/chromium/src/UserMediaClientImpl.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/UserMediaClientImpl.h	2011-11-23 10:02:27 UTC (rev 101058)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011 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 UserMediaClientImpl_h
+#define UserMediaClientImpl_h
+
+#include "MediaStreamSource.h"
+#include "UserMediaClient.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+class UserMediaRequest;
+}
+
+namespace WebKit {
+
+class WebUserMediaClient;
+class WebViewImpl;
+
+class UserMediaClientImpl : public WebCore::UserMediaClient {
+public:
+    UserMediaClientImpl(WebViewImpl*);
+
+    // WebCore::UserMediaClient ----------------------------------------------
+    virtual void pageDestroyed();
+    virtual void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector&);
+    virtual void cancelUserMediaRequest(WebCore::UserMediaRequest*);
+
+private:
+    UserMediaClientImpl();
+
+    WebUserMediaClient* m_client;
+};
+
+} // namespace WebKit
+
+#endif // UserMediaClientImpl_h

Added: trunk/Source/WebKit/chromium/src/WebUserMediaRequest.cpp (0 => 101058)


--- trunk/Source/WebKit/chromium/src/WebUserMediaRequest.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebUserMediaRequest.cpp	2011-11-23 10:02:27 UTC (rev 101058)
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2011 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 "WebUserMediaRequest.h"
+
+#include "Document.h"
+#include "Frame.h"
+#include "MediaStreamSource.h"
+#include "Page.h"
+#include "SecurityOrigin.h"
+#include "UserMediaRequest.h"
+#include "WebMediaStreamSource.h"
+#include "WebSecurityOrigin.h"
+#include "WebString.h"
+#include "WebVector.h"
+#include <wtf/Vector.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebUserMediaRequest::WebUserMediaRequest(const PassRefPtr<UserMediaRequest>& request)
+    : m_private(request)
+{
+}
+
+void WebUserMediaRequest::reset()
+{
+    m_private.reset();
+}
+
+bool WebUserMediaRequest::audio() const
+{
+    return m_private->audio();
+}
+
+bool WebUserMediaRequest::video() const
+{
+    return m_private->video();
+}
+
+bool WebUserMediaRequest::cameraPreferenceUser() const
+{
+    return m_private->cameraPreferenceUser();
+}
+
+bool WebUserMediaRequest::cameraPreferenceEnvironment() const
+{
+    return m_private->cameraPreferenceEnvironment();
+}
+
+WebSecurityOrigin WebUserMediaRequest::securityOrigin() const
+{
+    ASSERT(m_private->scriptExecutionContext());
+    return WebSecurityOrigin(m_private->scriptExecutionContext()->securityOrigin());
+}
+
+void WebUserMediaRequest::requestSucceeded(const WebVector<WebMediaStreamSource>& sources)
+{
+    if (m_private.isNull())
+        return;
+
+    MediaStreamSourceVector s;
+    for (size_t i = 0; i < sources.size(); ++i) {
+        MediaStreamSource* curr = sources[i];
+        s.append(curr);
+    }
+
+    m_private->succeed(s);
+}
+
+void WebUserMediaRequest::requestFailed()
+{
+    m_private->fail();
+}
+
+bool WebUserMediaRequest::equals(const WebUserMediaRequest& other) const
+{
+    if (isNull() || other.isNull())
+        return false;
+    return m_private.get() == other.m_private.get();
+}
+
+void WebUserMediaRequest::assign(const WebUserMediaRequest& other)
+{
+    UserMediaRequest* p = other.m_private.get();
+    if (p)
+        p->ref();
+    m_private = p;
+}
+
+WebUserMediaRequest::operator UserMediaRequest*() const
+{
+    return m_private.get();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(MEDIA_STREAM)
+

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (101057 => 101058)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-11-23 09:25:39 UTC (rev 101057)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-11-23 10:02:27 UTC (rev 101058)
@@ -370,6 +370,9 @@
 #if ENABLE(GESTURE_RECOGNIZER)
     , m_gestureRecognizer(WebCore::PlatformGestureRecognizer::create())
 #endif
+#if ENABLE(MEDIA_STREAM)
+    , m_userMediaClientImpl(this)
+#endif
 {
     // WebKit/win/WebView.cpp does the same thing, except they call the
     // KJS specific wrapper around this method. We need to have threading
@@ -392,6 +395,9 @@
     pageClients.deviceOrientationClient = m_deviceOrientationClientProxy.get();
     pageClients.geolocationClient = m_geolocationClientProxy.get();
     pageClients.backForwardClient = BackForwardListChromium::create(this);
+#if ENABLE(MEDIA_STREAM)
+    pageClients.userMediaClient = &m_userMediaClientImpl;
+#endif
 
     m_page = adoptPtr(new Page(pageClients));
 

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (101057 => 101058)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.h	2011-11-23 09:25:39 UTC (rev 101057)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h	2011-11-23 10:02:27 UTC (rev 101058)
@@ -48,6 +48,7 @@
 #include "IntRect.h"
 #include "NotificationPresenterImpl.h"
 #include "PageOverlay.h"
+#include "UserMediaClientImpl.h"
 #include "cc/CCLayerTreeHost.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/RefCounted.h>
@@ -81,6 +82,7 @@
 class DragScrollTimer;
 class GeolocationClientProxy;
 class SpeechInputClientImpl;
+class UserMediaClientImpl;
 class WebAccessibilityObject;
 class WebCompositorImpl;
 class WebDevToolsAgentClient;
@@ -625,6 +627,10 @@
 #if ENABLE(GESTURE_RECOGNIZER)
     OwnPtr<WebCore::PlatformGestureRecognizer> m_gestureRecognizer;
 #endif
+
+#if ENABLE(MEDIA_STREAM)
+    UserMediaClientImpl m_userMediaClientImpl;
+#endif
 };
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to