#ifndef NavigatorGamepad_h
#define NavigatorGamepad_h
#include "core/frame/DOMWindowLifecycleObserver.h"
#include "core/frame/DOMWindowProperty.h"
#include "core/frame/DeviceSensorEventController.h"
#include "heap/Handle.h"
#include "platform/Supplementable.h"
#include "public/platform/WebGamepads.h"
namespace blink {
class WebGamepad;
class WebGamepads;
}
namespace WebCore {
class GamepadList;
class Navigator;
class WebKitGamepadList;
class NavigatorGamepad FINAL : public NoBaseWillBeGarbageCollectedFinalized<NavigatorGamepad>, public WillBeHeapSupplement<Navigator>, public DOMWindowProperty, public DeviceSensorEventController, public DOMWindowLifecycleObserver {
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NavigatorGamepad);
public:
static NavigatorGamepad* from(Document&);
static NavigatorGamepad& from(Navigator&);
virtual ~NavigatorGamepad();
static WebKitGamepadList* webkitGetGamepads(Navigator&);
static GamepadList* getGamepads(Navigator&);
WebKitGamepadList* webkitGamepads();
GamepadList* gamepads();
virtual void trace(Visitor*);
void didConnectOrDisconnectGamepad(unsigned index, const blink::WebGamepad&, bool connected);
private:
explicit NavigatorGamepad(Document&);
static const char* supplementName();
virtual void willDestroyGlobalObjectInFrame() OVERRIDE FINAL;
virtual void willDetachGlobalObjectFromFrame() OVERRIDE FINAL;
virtual void registerWithDispatcher() OVERRIDE FINAL;
virtual void unregisterWithDispatcher() OVERRIDE FINAL;
virtual bool hasLastData() OVERRIDE FINAL;
virtual PassRefPtrWillBeRawPtr<Event> getLastEvent() OVERRIDE FINAL;
virtual bool isNullEvent(Event*) OVERRIDE FINAL;
virtual void didAddEventListener(DOMWindow*, const AtomicString&) OVERRIDE FINAL;
virtual void didRemoveEventListener(DOMWindow*, const AtomicString&) OVERRIDE FINAL;
virtual void didRemoveAllEventListeners(DOMWindow*) OVERRIDE FINAL;
RefPtrWillBeMember<GamepadList> m_gamepads;
RefPtrWillBeMember<WebKitGamepadList> m_webkitGamepads;
};
}
#endif