summaryrefslogtreecommitdiff
path: root/Source/WebCore/Modules/gamepad/deprecated
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/Modules/gamepad/deprecated')
-rw-r--r--Source/WebCore/Modules/gamepad/deprecated/Gamepad.cpp61
-rw-r--r--Source/WebCore/Modules/gamepad/deprecated/Gamepad.h72
-rw-r--r--Source/WebCore/Modules/gamepad/deprecated/Gamepad.idl37
-rw-r--r--Source/WebCore/Modules/gamepad/deprecated/GamepadList.cpp58
-rw-r--r--Source/WebCore/Modules/gamepad/deprecated/GamepadList.h55
-rw-r--r--Source/WebCore/Modules/gamepad/deprecated/GamepadList.idl34
-rw-r--r--Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.cpp76
-rw-r--r--Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.h56
-rw-r--r--Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.idl25
9 files changed, 474 insertions, 0 deletions
diff --git a/Source/WebCore/Modules/gamepad/deprecated/Gamepad.cpp b/Source/WebCore/Modules/gamepad/deprecated/Gamepad.cpp
new file mode 100644
index 000000000..52e274906
--- /dev/null
+++ b/Source/WebCore/Modules/gamepad/deprecated/Gamepad.cpp
@@ -0,0 +1,61 @@
+/*
+ * 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:
+ *
+ * 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 "Gamepad.h"
+
+#if ENABLE(GAMEPAD_DEPRECATED)
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+Gamepad::Gamepad()
+ : m_index(0)
+ , m_timestamp(0)
+{
+}
+
+void Gamepad::axes(unsigned count, float* data)
+{
+ m_axes.resize(count);
+ if (count)
+ std::copy(data, data + count, m_axes.begin());
+}
+
+void Gamepad::buttons(unsigned count, float* data)
+{
+ m_buttons.resize(count);
+ if (count)
+ std::copy(data, data + count, m_buttons.begin());
+}
+
+Gamepad::~Gamepad()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD_DEPRECATED)
diff --git a/Source/WebCore/Modules/gamepad/deprecated/Gamepad.h b/Source/WebCore/Modules/gamepad/deprecated/Gamepad.h
new file mode 100644
index 000000000..54c949b8c
--- /dev/null
+++ b/Source/WebCore/Modules/gamepad/deprecated/Gamepad.h
@@ -0,0 +1,72 @@
+/*
+ * 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:
+ *
+ * 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.
+ */
+
+#pragma once
+
+#if ENABLE(GAMEPAD_DEPRECATED)
+
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class Gamepad: public RefCounted<Gamepad> {
+public:
+ static Ref<Gamepad> create()
+ {
+ return adoptRef(*new Gamepad);
+ }
+ ~Gamepad();
+
+ typedef Vector<float> FloatVector;
+
+ const String& id() const { return m_id; }
+ void id(const String& id) { m_id = id; }
+
+ unsigned index() const { return m_index; }
+ void index(unsigned val) { m_index = val; }
+
+ unsigned long long timestamp() const { return m_timestamp; }
+ void timestamp(unsigned long long val) { m_timestamp = val; }
+
+ const FloatVector& axes() const { return m_axes; }
+ void axes(unsigned count, float* data);
+
+ const FloatVector& buttons() const { return m_buttons; }
+ void buttons(unsigned count, float* data);
+
+private:
+ Gamepad();
+ String m_id;
+ unsigned m_index;
+ unsigned long long m_timestamp;
+ FloatVector m_axes;
+ FloatVector m_buttons;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD_DEPRECATED)
diff --git a/Source/WebCore/Modules/gamepad/deprecated/Gamepad.idl b/Source/WebCore/Modules/gamepad/deprecated/Gamepad.idl
new file mode 100644
index 000000000..824e97e96
--- /dev/null
+++ b/Source/WebCore/Modules/gamepad/deprecated/Gamepad.idl
@@ -0,0 +1,37 @@
+/*
+ * 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:
+ *
+ * 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.
+ */
+
+[
+ NoInterfaceObject,
+ Conditional=GAMEPAD_DEPRECATED,
+ ImplementationLacksVTable
+] interface Gamepad {
+ readonly attribute DOMString id;
+ readonly attribute unsigned long index;
+ readonly attribute unsigned long long timestamp;
+ readonly attribute sequence<unrestricted float> axes;
+ readonly attribute sequence<unrestricted float> buttons;
+};
+
diff --git a/Source/WebCore/Modules/gamepad/deprecated/GamepadList.cpp b/Source/WebCore/Modules/gamepad/deprecated/GamepadList.cpp
new file mode 100644
index 000000000..22e028867
--- /dev/null
+++ b/Source/WebCore/Modules/gamepad/deprecated/GamepadList.cpp
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ *
+ * 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 "GamepadList.h"
+
+#include "Gamepad.h"
+
+#if ENABLE(GAMEPAD_DEPRECATED)
+
+namespace WebCore {
+
+GamepadList::~GamepadList()
+{
+}
+
+void GamepadList::set(unsigned index, RefPtr<Gamepad>&& gamepad)
+{
+ if (index >= kMaximumGamepads)
+ return;
+ m_items[index] = WTFMove(gamepad);
+}
+
+unsigned GamepadList::length() const
+{
+ return kMaximumGamepads;
+}
+
+Gamepad* GamepadList::item(unsigned index)
+{
+ return index < length() ? m_items[index].get() : 0;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD_DEPRECATED)
diff --git a/Source/WebCore/Modules/gamepad/deprecated/GamepadList.h b/Source/WebCore/Modules/gamepad/deprecated/GamepadList.h
new file mode 100644
index 000000000..ab3626b4a
--- /dev/null
+++ b/Source/WebCore/Modules/gamepad/deprecated/GamepadList.h
@@ -0,0 +1,55 @@
+/*
+ * 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:
+ *
+ * 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.
+ */
+
+#pragma once
+
+#if ENABLE(GAMEPAD_DEPRECATED)
+
+#include "Gamepad.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+typedef Vector<RefPtr<Gamepad> > GamepadVector;
+
+class GamepadList : public RefCounted<GamepadList> {
+public:
+ static Ref<GamepadList> create() { return adoptRef(*new GamepadList); }
+ ~GamepadList();
+
+ void set(unsigned index, RefPtr<Gamepad>&&);
+ Gamepad* item(unsigned index);
+ unsigned length() const;
+
+private:
+ enum { kMaximumGamepads = 4 };
+ GamepadList() { }
+ RefPtr<Gamepad> m_items[kMaximumGamepads];
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD_DEPRECATED)
diff --git a/Source/WebCore/Modules/gamepad/deprecated/GamepadList.idl b/Source/WebCore/Modules/gamepad/deprecated/GamepadList.idl
new file mode 100644
index 000000000..9ab4c57fe
--- /dev/null
+++ b/Source/WebCore/Modules/gamepad/deprecated/GamepadList.idl
@@ -0,0 +1,34 @@
+/*
+ * 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:
+ *
+ * 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.
+ */
+
+[
+ NoInterfaceObject,
+ Conditional=GAMEPAD_DEPRECATED,
+ ImplementationLacksVTable,
+] interface GamepadList {
+ readonly attribute unsigned long length;
+ getter Gamepad item(unsigned long index);
+};
+
diff --git a/Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.cpp b/Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.cpp
new file mode 100644
index 000000000..2321d5ada
--- /dev/null
+++ b/Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.cpp
@@ -0,0 +1,76 @@
+/*
+ * 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:
+ *
+ * 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 "NavigatorGamepad.h"
+
+#if ENABLE(GAMEPAD_DEPRECATED)
+
+#include "GamepadList.h"
+#include "Gamepads.h"
+#include "Navigator.h"
+
+namespace WebCore {
+
+NavigatorGamepad::NavigatorGamepad()
+{
+}
+
+NavigatorGamepad::~NavigatorGamepad()
+{
+}
+
+const char* NavigatorGamepad::supplementName()
+{
+ return "NavigatorGamepad";
+}
+
+NavigatorGamepad* NavigatorGamepad::from(Navigator* navigator)
+{
+ NavigatorGamepad* supplement = static_cast<NavigatorGamepad*>(Supplement<Navigator>::from(navigator, supplementName()));
+ if (!supplement) {
+ auto newSupplement = std::make_unique<NavigatorGamepad>();
+ supplement = newSupplement.get();
+ provideTo(navigator, supplementName(), WTFMove(newSupplement));
+ }
+ return supplement;
+}
+
+GamepadList* NavigatorGamepad::webkitGetGamepads(Navigator& navigator)
+{
+ return NavigatorGamepad::from(&navigator)->gamepads();
+}
+
+GamepadList* NavigatorGamepad::gamepads()
+{
+ if (!m_gamepads)
+ m_gamepads = GamepadList::create();
+ sampleGamepads(m_gamepads.get());
+ return m_gamepads.get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD_DEPRECATED)
diff --git a/Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.h b/Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.h
new file mode 100644
index 000000000..6f57882d8
--- /dev/null
+++ b/Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.h
@@ -0,0 +1,56 @@
+/*
+ * 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:
+ *
+ * 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.
+ */
+
+#pragma once
+
+#if ENABLE(GAMEPAD_DEPRECATED)
+
+#include "Supplementable.h"
+
+namespace WebCore {
+
+class GamepadList;
+class Navigator;
+
+class NavigatorGamepad : public Supplement<Navigator> {
+public:
+ NavigatorGamepad();
+ virtual ~NavigatorGamepad();
+
+ static NavigatorGamepad* from(Navigator*);
+
+ static GamepadList* webkitGetGamepads(Navigator&);
+
+ GamepadList* gamepads();
+
+private:
+ static const char* supplementName();
+
+ RefPtr<GamepadList> m_gamepads;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD_DEPRECATED)
diff --git a/Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.idl b/Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.idl
new file mode 100644
index 000000000..d19d843ef
--- /dev/null
+++ b/Source/WebCore/Modules/gamepad/deprecated/NavigatorGamepad.idl
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+[
+ Conditional=GAMEPAD_DEPRECATED,
+] partial interface Navigator {
+ GamepadList webkitGetGamepads();
+};
+