Remove ENABLE(MEDIA_STREAM) from Navigator.h
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Feb 2012 08:18:38 +0000 (08:18 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Feb 2012 08:18:38 +0000 (08:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78467

Reviewed by Kentaro Hara.

Navigator.webkitGetUser media doesn't really have anything to do with
Navigator.cpp.  This patch moves it into the mediastream directory and
removes the ENABLE(MEDIA_STREAM) ifdefs in Navigator.h and
Navigator.cpp.

* GNUmakefile.list.am:
* WebCore.gypi:
* mediastream/NavigatorMediaStream.cpp: Added.
(WebCore):
(WebCore::NavigatorMediaStream::NavigatorMediaStream):
(WebCore::NavigatorMediaStream::~NavigatorMediaStream):
(WebCore::NavigatorMediaStream::webkitGetUserMedia):
* mediastream/NavigatorMediaStream.h: Added.
(WebCore):
(NavigatorMediaStream):
* mediastream/NavigatorMediaStream.idl: Added.
* page/Navigator.cpp:
(WebCore):
* page/Navigator.h:
(WebCore):
(Navigator):
* page/Navigator.idl:

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

Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.gypi
Source/WebCore/mediastream/NavigatorMediaStream.cpp [new file with mode: 0644]
Source/WebCore/mediastream/NavigatorMediaStream.h [new file with mode: 0644]
Source/WebCore/mediastream/NavigatorMediaStream.idl [new file with mode: 0644]
Source/WebCore/page/Navigator.cpp
Source/WebCore/page/Navigator.h
Source/WebCore/page/Navigator.idl

index 5a44343..3b22cf9 100644 (file)
@@ -1,5 +1,35 @@
 2012-02-12  Adam Barth  <abarth@webkit.org>
 
+        Remove ENABLE(MEDIA_STREAM) from Navigator.h
+        https://bugs.webkit.org/show_bug.cgi?id=78467
+
+        Reviewed by Kentaro Hara.
+
+        Navigator.webkitGetUser media doesn't really have anything to do with
+        Navigator.cpp.  This patch moves it into the mediastream directory and
+        removes the ENABLE(MEDIA_STREAM) ifdefs in Navigator.h and
+        Navigator.cpp.
+
+        * GNUmakefile.list.am:
+        * WebCore.gypi:
+        * mediastream/NavigatorMediaStream.cpp: Added.
+        (WebCore):
+        (WebCore::NavigatorMediaStream::NavigatorMediaStream):
+        (WebCore::NavigatorMediaStream::~NavigatorMediaStream):
+        (WebCore::NavigatorMediaStream::webkitGetUserMedia):
+        * mediastream/NavigatorMediaStream.h: Added.
+        (WebCore):
+        (NavigatorMediaStream):
+        * mediastream/NavigatorMediaStream.idl: Added.
+        * page/Navigator.cpp:
+        (WebCore):
+        * page/Navigator.h:
+        (WebCore):
+        (Navigator):
+        * page/Navigator.idl:
+
+2012-02-12  Adam Barth  <abarth@webkit.org>
+
         Navigator.webkitGetUserMedia doesn't need to be custom
         https://bugs.webkit.org/show_bug.cgi?id=78464
 
index f77b227..45149d2 100644 (file)
@@ -876,6 +876,7 @@ dom_binding_idls += \
        $(WebCore)/mediastream/MediaStreamList.idl \
        $(WebCore)/mediastream/MediaStreamTrack.idl \
        $(WebCore)/mediastream/MediaStreamTrackList.idl \
+       $(WebCore)/mediastream/NavigatorMediaStream.idl \
        $(WebCore)/mediastream/NavigatorUserMediaError.idl \
        $(WebCore)/mediastream/NavigatorUserMediaErrorCallback.idl \
        $(WebCore)/mediastream/NavigatorUserMediaSuccessCallback.idl \
@@ -2618,6 +2619,8 @@ webcore_sources += \
        Source/WebCore/mediastream/MediaStreamTrack.h \
        Source/WebCore/mediastream/MediaStreamTrackList.cpp \
        Source/WebCore/mediastream/MediaStreamTrackList.h \
+       Source/WebCore/mediastream/NavigatorMediaStream.cpp \
+       Source/WebCore/mediastream/NavigatorMediaStream.h \
        Source/WebCore/mediastream/NavigatorUserMediaError.h \
        Source/WebCore/mediastream/NavigatorUserMediaErrorCallback.h \
        Source/WebCore/mediastream/NavigatorUserMediaSuccessCallback.h \
index 1d3cdbb..4e92149 100644 (file)
             'mediastream/MediaStreamList.idl',
             'mediastream/MediaStreamTrack.idl',
             'mediastream/MediaStreamTrackList.idl',
+            'mediastream/NavigatorMediaStream.idl',
             'mediastream/NavigatorUserMediaError.idl',
             'mediastream/NavigatorUserMediaErrorCallback.idl',
             'mediastream/NavigatorUserMediaSuccessCallback.idl',
             'mediastream/MediaStreamTrack.h',
             'mediastream/MediaStreamTrackList.cpp',
             'mediastream/MediaStreamTrackList.h',
+            'mediastream/NavigatorMediaStream.cpp',
+            'mediastream/NavigatorMediaStream.h',
             'mediastream/NavigatorUserMediaError.h',
             'mediastream/NavigatorUserMediaErrorCallback.h',
             'mediastream/NavigatorUserMediaSuccessCallback.h',
diff --git a/Source/WebCore/mediastream/NavigatorMediaStream.cpp b/Source/WebCore/mediastream/NavigatorMediaStream.cpp
new file mode 100644 (file)
index 0000000..2727bf7
--- /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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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"
+#include "NavigatorMediaStream.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "Document.h"
+#include "ExceptionCode.h"
+#include "Frame.h"
+#include "Navigator.h"
+#include "NavigatorUserMediaErrorCallback.h"
+#include "NavigatorUserMediaSuccessCallback.h"
+#include "Page.h"
+#include "UserMediaRequest.h"
+
+namespace WebCore {
+
+NavigatorMediaStream::NavigatorMediaStream()
+{
+}
+
+NavigatorMediaStream::~NavigatorMediaStream()
+{
+}
+
+void NavigatorMediaStream::webkitGetUserMedia(Navigator* navigator, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback, ExceptionCode& ec)
+{
+    if (!successCallback)
+        return;
+
+    Frame* frame = navigator->frame();
+    if (!frame)
+        return;
+
+    Page* page = frame->page();
+    if (!page)
+        return;
+
+    RefPtr<UserMediaRequest> request = UserMediaRequest::create(frame->document(), page->userMediaClient(), options, successCallback, errorCallback);
+    if (!request) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+
+    request->start();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
diff --git a/Source/WebCore/mediastream/NavigatorMediaStream.h b/Source/WebCore/mediastream/NavigatorMediaStream.h
new file mode 100644 (file)
index 0000000..b7b01fa
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 NavigatorMediaStream_h
+#define NavigatorMediaStream_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class Navigator;
+class NavigatorUserMediaErrorCallback;
+class NavigatorUserMediaSuccessCallback;
+
+typedef int ExceptionCode;
+
+class NavigatorMediaStream {
+public:
+    static void webkitGetUserMedia(Navigator*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>, ExceptionCode&);
+
+private:
+    NavigatorMediaStream();
+    ~NavigatorMediaStream();
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // NavigatorMediaStream_h
diff --git a/Source/WebCore/mediastream/NavigatorMediaStream.idl b/Source/WebCore/mediastream/NavigatorMediaStream.idl
new file mode 100644 (file)
index 0000000..effd179
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+module window {
+
+    interface [
+        Conditional=MEDIA_STREAM,
+        Supplemental=Navigator
+    ] NavigatorGamepad {
+        [V8EnabledAtRuntime] void webkitGetUserMedia(in DOMString options,
+                                                     in [Callback=FunctionOnly] NavigatorUserMediaSuccessCallback successCallback,
+                                                     in [Callback=FunctionOnly, Optional] NavigatorUserMediaErrorCallback errorCallback)
+            raises(DOMException);
+    };
+
+}
index a4a7a3d..70a15e7 100644 (file)
 #include <wtf/HashSet.h>
 #include <wtf/StdLibExtras.h>
 
-#if ENABLE(MEDIA_STREAM)
-#include "NavigatorUserMediaErrorCallback.h"
-#include "NavigatorUserMediaSuccessCallback.h"
-#include "UserMediaRequest.h"
-#endif
-
 namespace WebCore {
 
 Navigator::Navigator(Frame* frame)
@@ -274,27 +268,4 @@ void Navigator::registerProtocolHandler(const String& scheme, const String& url,
 }
 #endif
 
-#if ENABLE(MEDIA_STREAM)
-void Navigator::webkitGetUserMedia(const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback, ExceptionCode& ec)
-{
-    if (!successCallback)
-        return;
-
-    if (!m_frame)
-        return;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    RefPtr<UserMediaRequest> request = UserMediaRequest::create(m_frame->document(), page->userMediaClient(), options, successCallback, errorCallback);
-    if (!request) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    request->start();
-}
-#endif
-
 } // namespace WebCore
index 476d96b..2cd1ea9 100644 (file)
@@ -34,11 +34,8 @@ namespace WebCore {
 class DOMMimeTypeArray;
 class DOMPluginArray;
 class Frame;
-class GamepadList;
 class Geolocation;
 class PointerLock;
-class NavigatorUserMediaErrorCallback;
-class NavigatorUserMediaSuccessCallback;
 class PluginData;
 
 typedef int ExceptionCode;
@@ -72,10 +69,6 @@ public:
     void registerProtocolHandler(const String& scheme, const String& url, const String& title, ExceptionCode&);
 #endif
 
-#if ENABLE(MEDIA_STREAM)
-    virtual void webkitGetUserMedia(const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>, ExceptionCode&);
-#endif
-
     void provideSupplement(const AtomicString&, PassOwnPtr<NavigatorSupplement>);
     NavigatorSupplement* requireSupplement(const AtomicString&);
 
index f55c378..4747217 100644 (file)
@@ -54,13 +54,6 @@ module window {
         void registerProtocolHandler(in DOMString scheme, in DOMString url, in DOMString title)
             raises(DOMException);
 #endif
-
-#if defined(ENABLE_MEDIA_STREAM) && ENABLE_MEDIA_STREAM
-        [V8EnabledAtRuntime] void webkitGetUserMedia(in DOMString options,
-                                                     in [Callback=FunctionOnly] NavigatorUserMediaSuccessCallback successCallback,
-                                                     in [Callback=FunctionOnly, Optional] NavigatorUserMediaErrorCallback errorCallback)
-            raises(DOMException);
-#endif
     };
 
 }