Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: Source/modules/gamepad/GamepadDispatcher.h

Issue 336693004: Deduplicate DeviceEvent* classes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: oops - fix grammar in test expectation as well Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 struct ConnectionChange {
28 blink::WebGamepad pad;
29 unsigned index;
30 };
31
32 const ConnectionChange& latestConnectionChange() const { return m_latestChan ge; }
33
28 private: 34 private:
29 GamepadDispatcher(); 35 GamepadDispatcher();
30 virtual ~GamepadDispatcher(); 36 virtual ~GamepadDispatcher();
31 37
38 // WebGamepadListener
32 virtual void didConnectGamepad(unsigned index, const blink::WebGamepad&) OVE RRIDE; 39 virtual void didConnectGamepad(unsigned index, const blink::WebGamepad&) OVE RRIDE;
33 virtual void didDisconnectGamepad(unsigned index, const blink::WebGamepad&) OVERRIDE; 40 virtual void didDisconnectGamepad(unsigned index, const blink::WebGamepad&) OVERRIDE;
41
42 // DeviceEventDispatcherBase
43 virtual void startListening() OVERRIDE;
44 virtual void stopListening() OVERRIDE;
45
34 void dispatchDidConnectOrDisconnectGamepad(unsigned index, const blink::WebG amepad&, bool connected); 46 void dispatchDidConnectOrDisconnectGamepad(unsigned index, const blink::WebG amepad&, bool connected);
35 47
36 virtual void startListening() OVERRIDE; 48 ConnectionChange m_latestChange;
37 virtual void stopListening() OVERRIDE;
38 }; 49 };
39 50
40 } // namespace WebCore 51 } // namespace WebCore
41 52
42 #endif 53 #endif
OLDNEW
« no previous file with comments | « Source/modules/device_light/DeviceLightDispatcher.cpp ('k') | Source/modules/gamepad/GamepadDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698