Index: content/renderer/gamepad_shared_memory_reader.h |
diff --git a/content/renderer/gamepad_shared_memory_reader.h b/content/renderer/gamepad_shared_memory_reader.h |
index 08dc41a8c91e1e9edd7aedbfdf591777e5c78481..3846176107c3fdd3bd9276cac8587dd9878e3a4b 100644 |
--- a/content/renderer/gamepad_shared_memory_reader.h |
+++ b/content/renderer/gamepad_shared_memory_reader.h |
@@ -7,23 +7,40 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/shared_memory.h" |
+#include "content/common/gamepad_messages.h" |
+#include "content/public/renderer/render_process_observer.h" |
#include "third_party/WebKit/public/platform/WebGamepads.h" |
+namespace blink { class WebGamepadListener; } |
+ |
namespace content { |
struct GamepadHardwareBuffer; |
-class GamepadSharedMemoryReader { |
+class GamepadSharedMemoryReader : public RenderProcessObserver { |
public: |
GamepadSharedMemoryReader(); |
virtual ~GamepadSharedMemoryReader(); |
- void SampleGamepads(blink::WebGamepads&); |
+ |
+ void SampleGamepads(blink::WebGamepads& gamepads); |
+ void SetGamepadListener(blink::WebGamepadListener* listener); |
+ |
+ // RenderProcessObserver implementation. |
+ virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
private: |
+ void OnGamepadConnected(int index, const blink::WebGamepad& gamepad); |
+ void OnGamepadDisconnected(int index, const blink::WebGamepad& gamepad); |
+ |
+ void StartPollingIfNecessary(); |
+ void StopPollingIfNecessary(); |
+ |
base::SharedMemoryHandle renderer_shared_memory_handle_; |
scoped_ptr<base::SharedMemory> renderer_shared_memory_; |
GamepadHardwareBuffer* gamepad_hardware_buffer_; |
+ blink::WebGamepadListener* gamepad_listener_; |
+ bool is_polling_; |
bool ever_interacted_with_; |
}; |