Index: content/shell/renderer/test_runner/gamepad_controller.h |
diff --git a/content/shell/renderer/test_runner/gamepad_controller.h b/content/shell/renderer/test_runner/gamepad_controller.h |
index b648fd08be275f79fe3ae1695c2f28520eb40edc..99b7efc285598a6b40cbcd3b1caa5e5e8ef9e726 100644 |
--- a/content/shell/renderer/test_runner/gamepad_controller.h |
+++ b/content/shell/renderer/test_runner/gamepad_controller.h |
@@ -5,26 +5,38 @@ |
#ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_ |
#define CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_ |
+#include <map> |
+ |
#include "base/memory/weak_ptr.h" |
+#include "content/public/renderer/renderer_gamepad_provider.h" |
#include "third_party/WebKit/public/platform/WebGamepads.h" |
namespace blink { |
class WebFrame; |
+class WebGamepadListener; |
} |
namespace content { |
class WebTestDelegate; |
-class GamepadController : public base::SupportsWeakPtr<GamepadController> { |
+class GamepadController |
+ : public base::SupportsWeakPtr<GamepadController>, |
+ public RendererGamepadProvider { |
public: |
GamepadController(); |
- ~GamepadController(); |
+ virtual ~GamepadController(); |
void Reset(); |
void Install(blink::WebFrame* frame); |
void SetDelegate(WebTestDelegate* delegate); |
+ // RendererGamepadProvider implementation. |
+ virtual void SampleGamepads( |
+ blink::WebGamepads& gamepads) OVERRIDE; |
+ virtual void SetGamepadListener( |
+ blink::WebGamepadListener* listener) OVERRIDE; |
+ |
private: |
friend class GamepadControllerBindings; |
@@ -46,7 +58,10 @@ class GamepadController : public base::SupportsWeakPtr<GamepadController> { |
blink::WebGamepads gamepads_; |
- WebTestDelegate* delegate_; |
+ blink::WebGamepadListener* listener_; |
+ |
+ // Mapping from gamepad index to connection state. |
+ std::map<int, bool> pending_changes_; |
base::WeakPtrFactory<GamepadController> weak_factory_; |