OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
6 * | 6 * |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 12 matching lines...) Expand all Loading... |
23 * DAMAGE. | 23 * DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef NavigatorGamepad_h | 26 #ifndef NavigatorGamepad_h |
27 #define NavigatorGamepad_h | 27 #define NavigatorGamepad_h |
28 | 28 |
29 #include "core/dom/ContextLifecycleObserver.h" | 29 #include "core/dom/ContextLifecycleObserver.h" |
30 #include "core/frame/LocalDOMWindow.h" | 30 #include "core/frame/LocalDOMWindow.h" |
31 #include "core/frame/Navigator.h" | 31 #include "core/frame/Navigator.h" |
32 #include "core/frame/PlatformEventController.h" | 32 #include "core/frame/PlatformEventController.h" |
| 33 #include "device/gamepad/public/cpp/gamepads.h" |
33 #include "modules/ModulesExport.h" | 34 #include "modules/ModulesExport.h" |
34 #include "platform/AsyncMethodRunner.h" | 35 #include "platform/AsyncMethodRunner.h" |
35 #include "platform/Supplementable.h" | 36 #include "platform/Supplementable.h" |
36 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
37 #include "public/platform/WebGamepads.h" | |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 class Document; | 41 class Document; |
42 class Gamepad; | 42 class Gamepad; |
43 class GamepadList; | 43 class GamepadList; |
44 class Navigator; | 44 class Navigator; |
45 | 45 |
46 class MODULES_EXPORT NavigatorGamepad final | 46 class MODULES_EXPORT NavigatorGamepad final |
47 : public GarbageCollectedFinalized<NavigatorGamepad>, | 47 : public GarbageCollectedFinalized<NavigatorGamepad>, |
48 public Supplement<Navigator>, | 48 public Supplement<Navigator>, |
49 public ContextLifecycleObserver, | 49 public ContextLifecycleObserver, |
50 public PlatformEventController, | 50 public PlatformEventController, |
51 public LocalDOMWindow::EventListenerObserver { | 51 public LocalDOMWindow::EventListenerObserver { |
52 USING_GARBAGE_COLLECTED_MIXIN(NavigatorGamepad); | 52 USING_GARBAGE_COLLECTED_MIXIN(NavigatorGamepad); |
53 | 53 |
54 public: | 54 public: |
55 static NavigatorGamepad* From(Document&); | 55 static NavigatorGamepad* From(Document&); |
56 static NavigatorGamepad& From(Navigator&); | 56 static NavigatorGamepad& From(Navigator&); |
57 ~NavigatorGamepad() override; | 57 ~NavigatorGamepad() override; |
58 | 58 |
59 static GamepadList* getGamepads(Navigator&); | 59 static GamepadList* getGamepads(Navigator&); |
60 GamepadList* Gamepads(); | 60 GamepadList* Gamepads(); |
61 | 61 |
62 DECLARE_VIRTUAL_TRACE(); | 62 DECLARE_VIRTUAL_TRACE(); |
63 | 63 |
64 void DidConnectOrDisconnectGamepad(unsigned index, | 64 void DidConnectOrDisconnectGamepad(unsigned index, |
65 const WebGamepad&, | 65 const device::Gamepad&, |
66 bool connected); | 66 bool connected); |
67 | 67 |
68 private: | 68 private: |
69 explicit NavigatorGamepad(Navigator&); | 69 explicit NavigatorGamepad(Navigator&); |
70 | 70 |
71 static const char* SupplementName(); | 71 static const char* SupplementName(); |
72 | 72 |
73 void DispatchOneEvent(); | 73 void DispatchOneEvent(); |
74 void DidRemoveGamepadEventListeners(); | 74 void DidRemoveGamepadEventListeners(); |
75 bool StartUpdatingIfAttached(); | 75 bool StartUpdatingIfAttached(); |
(...skipping 14 matching lines...) Expand all Loading... |
90 void DidRemoveAllEventListeners(LocalDOMWindow*) override; | 90 void DidRemoveAllEventListeners(LocalDOMWindow*) override; |
91 | 91 |
92 Member<GamepadList> gamepads_; | 92 Member<GamepadList> gamepads_; |
93 HeapDeque<Member<Gamepad>> pending_events_; | 93 HeapDeque<Member<Gamepad>> pending_events_; |
94 Member<AsyncMethodRunner<NavigatorGamepad>> dispatch_one_event_runner_; | 94 Member<AsyncMethodRunner<NavigatorGamepad>> dispatch_one_event_runner_; |
95 }; | 95 }; |
96 | 96 |
97 } // namespace blink | 97 } // namespace blink |
98 | 98 |
99 #endif // NavigatorGamepad_h | 99 #endif // NavigatorGamepad_h |
OLD | NEW |