OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WebKitGamepad_h |
| 6 #define WebKitGamepad_h |
| 7 |
| 8 #include "bindings/v8/ScriptWrappable.h" |
| 9 #include "heap/Handle.h" |
| 10 #include "public/platform/WebGamepad.h" |
| 11 #include "wtf/RefCounted.h" |
| 12 #include "wtf/Vector.h" |
| 13 #include "wtf/text/WTFString.h" |
| 14 |
| 15 namespace WebCore { |
| 16 |
| 17 class WebKitGamepad FINAL : public RefCountedWillBeGarbageCollectedFinalized<Web
KitGamepad>, public ScriptWrappable { |
| 18 public: |
| 19 static PassRefPtrWillBeRawPtr<WebKitGamepad> create() |
| 20 { |
| 21 return adoptRefWillBeNoop(new WebKitGamepad); |
| 22 } |
| 23 virtual ~WebKitGamepad(); |
| 24 |
| 25 typedef Vector<float> FloatVector; |
| 26 |
| 27 const String& id() const { return m_id; } |
| 28 void setId(const String& id) { m_id = id; } |
| 29 |
| 30 unsigned index() const { return m_index; } |
| 31 void setIndex(unsigned val) { m_index = val; } |
| 32 |
| 33 bool connected() const { return m_connected; } |
| 34 void setConnected(bool val) { m_connected = val; } |
| 35 |
| 36 unsigned long long timestamp() const { return m_timestamp; } |
| 37 void setTimestamp(unsigned long long val) { m_timestamp = val; } |
| 38 |
| 39 const String& mapping() const { return m_mapping; } |
| 40 void setMapping(const String& val) { m_mapping = val; } |
| 41 |
| 42 const FloatVector& axes() const { return m_axes; } |
| 43 void setAxes(unsigned count, const float* data); |
| 44 |
| 45 const FloatVector& buttons() const { return m_buttons; } |
| 46 void setButtons(unsigned count, const blink::WebGamepadButton* data); |
| 47 |
| 48 void trace(Visitor*); |
| 49 |
| 50 private: |
| 51 WebKitGamepad(); |
| 52 String m_id; |
| 53 unsigned m_index; |
| 54 bool m_connected; |
| 55 unsigned long long m_timestamp; |
| 56 String m_mapping; |
| 57 FloatVector m_axes; |
| 58 FloatVector m_buttons; |
| 59 }; |
| 60 |
| 61 } // namespace WebCore |
| 62 |
| 63 #endif // WebKitGamepad_h |
OLD | NEW |