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

Unified Diff: content/renderer/gamepad_shared_memory_reader.h

Issue 195873019: Gamepad API: add support for connection events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: and a missing override Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_common.gypi ('k') | content/renderer/gamepad_shared_memory_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
};
« no previous file with comments | « content/content_common.gypi ('k') | content/renderer/gamepad_shared_memory_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698