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

Unified Diff: Source/modules/gamepad/GamepadBase.h

Issue 183313003: Added non-prefixed navigator.getGamepads() with updated API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added LayoutTests Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/gamepad/GamepadBase.h
diff --git a/Source/modules/gamepad/Gamepad.h b/Source/modules/gamepad/GamepadBase.h
similarity index 80%
copy from Source/modules/gamepad/Gamepad.h
copy to Source/modules/gamepad/GamepadBase.h
index 1e4cfafad5d41341501300f734136996acf67a4e..cab072f0f3473a3e51f8a9b05a221817f62d827f 100644
--- a/Source/modules/gamepad/Gamepad.h
+++ b/Source/modules/gamepad/GamepadBase.h
@@ -23,8 +23,8 @@
* DAMAGE.
*/
-#ifndef Gamepad_h
-#define Gamepad_h
+#ifndef GamepadBase_h
+#define GamepadBase_h
#include "bindings/v8/ScriptWrappable.h"
#include "heap/Handle.h"
@@ -35,13 +35,9 @@
namespace WebCore {
-class Gamepad: public RefCountedWillBeGarbageCollectedFinalized<Gamepad>, public ScriptWrappable {
+class GamepadBase: public RefCountedWillBeGarbageCollectedFinalized<GamepadBase>, public ScriptWrappable {
public:
- static PassRefPtrWillBeRawPtr<Gamepad> create()
- {
- return adoptRefWillBeNoop(new Gamepad);
- }
- ~Gamepad();
+ virtual ~GamepadBase();
typedef Vector<float> FloatVector;
@@ -61,28 +57,22 @@ public:
void mapping(const String& val) { m_mapping = val; }
const FloatVector& axes() const { return m_axes; }
- void axes(unsigned count, float* data);
+ void axes(unsigned count, const float* data);
- const FloatVector& buttons() const { return m_buttons; }
-#if defined(ENABLE_NEW_GAMEPAD_API)
- void buttons(unsigned count, blink::WebGamepadButton* data);
-#else
- void buttons(unsigned count, float* data);
-#endif
+ virtual void buttons(unsigned count, const blink::WebGamepadButton* data) = 0;
void trace(Visitor*);
-private:
- Gamepad();
+protected:
+ GamepadBase();
String m_id;
unsigned m_index;
bool m_connected;
unsigned long long m_timestamp;
String m_mapping;
FloatVector m_axes;
- FloatVector m_buttons;
};
} // namespace WebCore
-#endif // Gamepad_h
+#endif // GamepadBase_h

Powered by Google App Engine
This is Rietveld 408576698