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

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

Issue 2808093006: [Device Service] Move Gamepad Blink headers to be part of the Gamepad client library (Closed)
Patch Set: rebase and address comments Created 3 years, 8 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/PlatformEventDispatcher.h" 8 #include "core/frame/PlatformEventDispatcher.h"
9 #include "device/gamepad/public/cpp/gamepads.h"
9 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
10 #include "public/platform/WebGamepad.h"
11 #include "public/platform/WebGamepadListener.h" 11 #include "public/platform/WebGamepadListener.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class WebGamepads;
16
17 class GamepadDispatcher final 15 class GamepadDispatcher final
18 : public GarbageCollectedFinalized<GamepadDispatcher>, 16 : public GarbageCollectedFinalized<GamepadDispatcher>,
19 public PlatformEventDispatcher, 17 public PlatformEventDispatcher,
20 public WebGamepadListener { 18 public WebGamepadListener {
21 USING_GARBAGE_COLLECTED_MIXIN(GamepadDispatcher); 19 USING_GARBAGE_COLLECTED_MIXIN(GamepadDispatcher);
22 20
23 public: 21 public:
24 static GamepadDispatcher& Instance(); 22 static GamepadDispatcher& Instance();
25 ~GamepadDispatcher() override; 23 ~GamepadDispatcher() override;
26 24
27 void SampleGamepads(WebGamepads&); 25 void SampleGamepads(device::Gamepads&);
28 26
29 struct ConnectionChange { 27 struct ConnectionChange {
30 DISALLOW_NEW(); 28 DISALLOW_NEW();
31 WebGamepad pad; 29 device::Gamepad pad;
32 unsigned index; 30 unsigned index;
33 }; 31 };
34 32
35 const ConnectionChange& LatestConnectionChange() const { 33 const ConnectionChange& LatestConnectionChange() const {
36 return latest_change_; 34 return latest_change_;
37 } 35 }
38 36
39 DECLARE_VIRTUAL_TRACE(); 37 DECLARE_VIRTUAL_TRACE();
40 38
41 private: 39 private:
42 GamepadDispatcher(); 40 GamepadDispatcher();
43 41
44 // WebGamepadListener 42 // WebGamepadListener
45 void DidConnectGamepad(unsigned index, const WebGamepad&) override; 43 void DidConnectGamepad(unsigned index, const device::Gamepad&) override;
46 void DidDisconnectGamepad(unsigned index, const WebGamepad&) override; 44 void DidDisconnectGamepad(unsigned index, const device::Gamepad&) override;
47 45
48 // PlatformEventDispatcher 46 // PlatformEventDispatcher
49 void StartListening() override; 47 void StartListening() override;
50 void StopListening() override; 48 void StopListening() override;
51 49
52 void DispatchDidConnectOrDisconnectGamepad(unsigned index, 50 void DispatchDidConnectOrDisconnectGamepad(unsigned index,
53 const WebGamepad&, 51 const device::Gamepad&,
54 bool connected); 52 bool connected);
55 53
56 ConnectionChange latest_change_; 54 ConnectionChange latest_change_;
57 }; 55 };
58 56
59 } // namespace blink 57 } // namespace blink
60 58
61 #endif 59 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/gamepad/Gamepad.cpp ('k') | third_party/WebKit/Source/modules/gamepad/GamepadDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698