Chromium Code Reviews| 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 GamepadDispatcher_h | 5 #ifndef GamepadDispatcher_h |
| 6 #define GamepadDispatcher_h | 6 #define GamepadDispatcher_h |
| 7 | 7 |
| 8 #include "core/frame/DeviceSensorEventDispatcher.h" | 8 #include "core/frame/DeviceEventDispatcherBase.h" |
| 9 #include "platform/heap/Handle.h" | |
| 10 #include "public/platform/WebGamepad.h" | |
| 9 #include "public/platform/WebGamepadListener.h" | 11 #include "public/platform/WebGamepadListener.h" |
| 10 | 12 |
| 11 namespace blink { | 13 namespace blink { |
| 12 class WebGamepad; | |
| 13 class WebGamepads; | 14 class WebGamepads; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace WebCore { | 17 namespace WebCore { |
| 17 | 18 |
| 18 class NavigatorGamepad; | 19 class NavigatorGamepad; |
| 19 | 20 |
| 20 class GamepadDispatcher : public DeviceSensorEventDispatcher, public blink::WebG amepadListener { | 21 class GamepadDispatcher : public DeviceEventDispatcherBase, public blink::WebGam epadListener { |
| 21 public: | 22 public: |
| 22 static GamepadDispatcher& instance(); | 23 static GamepadDispatcher& instance(); |
| 23 | 24 |
| 24 void addClient(NavigatorGamepad*); | |
| 25 void removeClient(NavigatorGamepad*); | |
| 26 void sampleGamepads(blink::WebGamepads&); | 25 void sampleGamepads(blink::WebGamepads&); |
| 27 | 26 |
| 27 const blink::WebGamepad& latestGamepadEventData(unsigned& index) const; | |
|
timvolodine
2014/06/16 13:05:17
drop the index argument here?
| |
| 28 | |
| 28 private: | 29 private: |
| 29 GamepadDispatcher(); | 30 GamepadDispatcher(); |
| 30 virtual ~GamepadDispatcher(); | 31 virtual ~GamepadDispatcher(); |
| 31 | 32 |
| 32 virtual void didConnectGamepad(unsigned index, const blink::WebGamepad&) OVE RRIDE; | 33 virtual void didConnectGamepad(unsigned index, const blink::WebGamepad&) OVE RRIDE; |
|
timvolodine
2014/06/16 13:05:17
nit: not really related to this patch but could yo
kbalazs
2014/06/16 17:01:47
Sure
| |
| 33 virtual void didDisconnectGamepad(unsigned index, const blink::WebGamepad&) OVERRIDE; | 34 virtual void didDisconnectGamepad(unsigned index, const blink::WebGamepad&) OVERRIDE; |
| 34 void dispatchDidConnectOrDisconnectGamepad(unsigned index, const blink::WebG amepad&, bool connected); | 35 void dispatchDidConnectOrDisconnectGamepad(unsigned index, const blink::WebG amepad&, bool connected); |
| 35 | 36 |
| 36 virtual void startListening() OVERRIDE; | 37 virtual void startListening() OVERRIDE; |
| 37 virtual void stopListening() OVERRIDE; | 38 virtual void stopListening() OVERRIDE; |
| 39 | |
| 40 blink::WebGamepad m_latestGamepad; | |
| 41 unsigned m_latestGamepadIndex; | |
|
timvolodine
2014/06/16 13:05:17
is this needed?
| |
| 38 }; | 42 }; |
| 39 | 43 |
| 40 } // namespace WebCore | 44 } // namespace WebCore |
| 41 | 45 |
| 42 #endif | 46 #endif |
| OLD | NEW |