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 29 matching lines...) Expand all Loading... |
40 class Document; | 40 class Document; |
41 class Gamepad; | 41 class Gamepad; |
42 class GamepadList; | 42 class GamepadList; |
43 class Navigator; | 43 class Navigator; |
44 | 44 |
45 class MODULES_EXPORT NavigatorGamepad final : public GarbageCollectedFinalized<N
avigatorGamepad>, public HeapSupplement<Navigator>, public DOMWindowProperty, pu
blic PlatformEventController, public DOMWindowLifecycleObserver { | 45 class MODULES_EXPORT NavigatorGamepad final : public GarbageCollectedFinalized<N
avigatorGamepad>, public HeapSupplement<Navigator>, public DOMWindowProperty, pu
blic PlatformEventController, public DOMWindowLifecycleObserver { |
46 USING_GARBAGE_COLLECTED_MIXIN(NavigatorGamepad); | 46 USING_GARBAGE_COLLECTED_MIXIN(NavigatorGamepad); |
47 public: | 47 public: |
48 static NavigatorGamepad* from(Document&); | 48 static NavigatorGamepad* from(Document&); |
49 static NavigatorGamepad& from(Navigator&); | 49 static NavigatorGamepad& from(Navigator&); |
50 virtual ~NavigatorGamepad(); | 50 ~NavigatorGamepad() override; |
51 | 51 |
52 static GamepadList* getGamepads(Navigator&); | 52 static GamepadList* getGamepads(Navigator&); |
53 GamepadList* gamepads(); | 53 GamepadList* gamepads(); |
54 | 54 |
55 DECLARE_VIRTUAL_TRACE(); | 55 DECLARE_VIRTUAL_TRACE(); |
56 | 56 |
57 void didConnectOrDisconnectGamepad(unsigned index, const WebGamepad&, bool c
onnected); | 57 void didConnectOrDisconnectGamepad(unsigned index, const WebGamepad&, bool c
onnected); |
58 | 58 |
59 private: | 59 private: |
60 explicit NavigatorGamepad(LocalFrame*); | 60 explicit NavigatorGamepad(LocalFrame*); |
61 | 61 |
62 static const char* supplementName(); | 62 static const char* supplementName(); |
63 | 63 |
64 void dispatchOneEvent(); | 64 void dispatchOneEvent(); |
65 void didRemoveGamepadEventListeners(); | 65 void didRemoveGamepadEventListeners(); |
66 bool startUpdatingIfAttached(); | 66 bool startUpdatingIfAttached(); |
67 | 67 |
68 // DOMWindowProperty | 68 // DOMWindowProperty |
69 virtual void willDestroyGlobalObjectInFrame() override; | 69 void willDestroyGlobalObjectInFrame() override; |
70 virtual void willDetachGlobalObjectFromFrame() override; | 70 void willDetachGlobalObjectFromFrame() override; |
71 | 71 |
72 // PlatformEventController | 72 // PlatformEventController |
73 virtual void registerWithDispatcher() override; | 73 void registerWithDispatcher() override; |
74 virtual void unregisterWithDispatcher() override; | 74 void unregisterWithDispatcher() override; |
75 virtual bool hasLastData() override; | 75 bool hasLastData() override; |
76 virtual void didUpdateData() override; | 76 void didUpdateData() override; |
77 virtual void pageVisibilityChanged() override; | 77 void pageVisibilityChanged() override; |
78 | 78 |
79 // DOMWindowLifecycleObserver | 79 // DOMWindowLifecycleObserver |
80 virtual void didAddEventListener(LocalDOMWindow*, const AtomicString&) overr
ide; | 80 void didAddEventListener(LocalDOMWindow*, const AtomicString&) override; |
81 virtual void didRemoveEventListener(LocalDOMWindow*, const AtomicString&) ov
erride; | 81 void didRemoveEventListener(LocalDOMWindow*, const AtomicString&) override; |
82 virtual void didRemoveAllEventListeners(LocalDOMWindow*) override; | 82 void didRemoveAllEventListeners(LocalDOMWindow*) override; |
83 | 83 |
84 Member<GamepadList> m_gamepads; | 84 Member<GamepadList> m_gamepads; |
85 HeapDeque<Member<Gamepad>> m_pendingEvents; | 85 HeapDeque<Member<Gamepad>> m_pendingEvents; |
86 AsyncMethodRunner<NavigatorGamepad> m_dispatchOneEventRunner; | 86 AsyncMethodRunner<NavigatorGamepad> m_dispatchOneEventRunner; |
87 }; | 87 }; |
88 | 88 |
89 } // namespace blink | 89 } // namespace blink |
90 | 90 |
91 #endif // NavigatorGamepad_h | 91 #endif // NavigatorGamepad_h |
OLD | NEW |