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.
5 #ifndef GamepadDispatcher_h
6 #define GamepadDispatcher_h
8 #include "core/frame/DeviceSensorEventDispatcher.h"
9 #include "public/platform/WebGamepadListener.h"
18 class NavigatorGamepad;
20 class GamepadDispatcher : public DeviceSensorEventDispatcher, public blink::WebGamepadListener {
22 static GamepadDispatcher& instance();
24 void addClient(NavigatorGamepad*);
25 void removeClient(NavigatorGamepad*);
26 void sampleGamepads(blink::WebGamepads&);
30 virtual ~GamepadDispatcher();
32 virtual void didConnectGamepad(unsigned index, const blink::WebGamepad&) OVERRIDE;
33 virtual void didDisconnectGamepad(unsigned index, const blink::WebGamepad&) OVERRIDE;
34 void dispatchDidConnectOrDisconnectGamepad(unsigned index, const blink::WebGamepad&, bool connected);
36 virtual void startListening() OVERRIDE;
37 virtual void stopListening() OVERRIDE;
40 } // namespace WebCore