Upstream version 6.35.121.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / gamepad / GamepadDispatcher.h
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 GamepadDispatcher_h
6 #define GamepadDispatcher_h
7
8 #include "core/frame/DeviceSensorEventDispatcher.h"
9 #include "public/platform/WebGamepadListener.h"
10
11 namespace blink {
12 class WebGamepad;
13 class WebGamepads;
14 }
15
16 namespace WebCore {
17
18 class NavigatorGamepad;
19
20 class GamepadDispatcher : public DeviceSensorEventDispatcher, public blink::WebGamepadListener {
21 public:
22     static GamepadDispatcher& instance();
23
24     void addClient(NavigatorGamepad*);
25     void removeClient(NavigatorGamepad*);
26     void sampleGamepads(blink::WebGamepads&);
27
28 private:
29     GamepadDispatcher();
30     virtual ~GamepadDispatcher();
31
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);
35
36     virtual void startListening() OVERRIDE;
37     virtual void stopListening() OVERRIDE;
38 };
39
40 } // namespace WebCore
41
42 #endif