OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WebKitGamepad_h | 5 #ifndef WebKitGamepad_h |
6 #define WebKitGamepad_h | 6 #define WebKitGamepad_h |
7 | 7 |
8 #include "bindings/v8/ScriptWrappable.h" | 8 #include "bindings/v8/ScriptWrappable.h" |
9 #include "heap/Handle.h" | 9 #include "heap/Handle.h" |
10 #include "public/platform/WebGamepad.h" | 10 #include "modules/gamepad/GamepadCommon.h" |
11 #include "wtf/RefCounted.h" | 11 #include "wtf/RefCounted.h" |
12 #include "wtf/Vector.h" | 12 #include "wtf/Vector.h" |
13 #include "wtf/text/WTFString.h" | |
14 | 13 |
15 namespace WebCore { | 14 namespace WebCore { |
16 | 15 |
17 class WebKitGamepad FINAL : public RefCountedWillBeGarbageCollectedFinalized<Web KitGamepad>, public ScriptWrappable { | 16 class WebKitGamepad FINAL : public RefCountedWillBeGarbageCollectedFinalized<Web KitGamepad>, public GamepadCommon, public ScriptWrappable { |
18 public: | 17 public: |
19 static PassRefPtrWillBeRawPtr<WebKitGamepad> create() | 18 static PassRefPtrWillBeRawPtr<WebKitGamepad> create() |
20 { | 19 { |
21 return adoptRefWillBeNoop(new WebKitGamepad); | 20 return adoptRefWillBeNoop(new WebKitGamepad); |
22 } | 21 } |
23 ~WebKitGamepad(); | 22 ~WebKitGamepad() { } |
haraken
2014/03/13 09:33:50
Please keep the empty destructor in the cpp file.
Nils Barth (inactive)
2014/03/13 12:51:14
Done.
| |
24 | 23 |
25 typedef Vector<float> FloatVector; | 24 typedef Vector<float> FloatVector; |
26 | 25 |
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; } | 26 const FloatVector& buttons() const { return m_buttons; } |
46 void setButtons(unsigned count, const blink::WebGamepadButton* data); | 27 void setButtons(unsigned count, const blink::WebGamepadButton* data); |
47 | 28 |
48 void trace(Visitor*); | 29 void trace(Visitor*) { } |
haraken
2014/03/13 09:33:50
Add virtual.
zerny-chromium
2014/03/13 09:48:00
We don't actually need a virtual trace here.
| |
49 | 30 |
50 private: | 31 private: |
51 WebKitGamepad(); | 32 WebKitGamepad() { ScriptWrappable::init(this); } |
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; | 33 FloatVector m_buttons; |
59 }; | 34 }; |
60 | 35 |
61 } // namespace WebCore | 36 } // namespace WebCore |
62 | 37 |
63 #endif // WebKitGamepad_h | 38 #endif // WebKitGamepad_h |
OLD | NEW |