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

Unified Diff: content/browser/gamepad/gamepad_platform_data_fetcher_win.h

Issue 135523006: Implemented Gamepad support via Raw Input on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Features, fixes, and cleanups Created 6 years, 11 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
Index: content/browser/gamepad/gamepad_platform_data_fetcher_win.h
diff --git a/content/browser/gamepad/gamepad_platform_data_fetcher_win.h b/content/browser/gamepad/gamepad_platform_data_fetcher_win.h
index c894143b076316f6d5ce32cb17b7a1eef1f759d2..bbd50c3cfc6b52a9add9bbbe49a6727d13997a25 100644
--- a/content/browser/gamepad/gamepad_platform_data_fetcher_win.h
+++ b/content/browser/gamepad/gamepad_platform_data_fetcher_win.h
@@ -20,9 +20,13 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/message_loop/message_loop.h"
#include "base/scoped_native_library.h"
#include "content/browser/gamepad/gamepad_data_fetcher.h"
#include "content/browser/gamepad/gamepad_standard_mappings.h"
+#include "content/browser/gamepad/raw_input_data_fetcher_win.h"
#include "third_party/WebKit/public/platform/WebGamepads.h"
namespace content {
@@ -33,6 +37,8 @@ class GamepadPlatformDataFetcherWin : public GamepadDataFetcher {
virtual ~GamepadPlatformDataFetcherWin();
virtual void GetGamepadData(blink::WebGamepads* pads,
bool devices_changed_hint) OVERRIDE;
+ virtual void PauseHint(bool paused) OVERRIDE;
+
private:
// XInput-specific implementation for GetGamepadData.
bool GetXInputGamepadData(blink::WebGamepads* pads,
@@ -59,10 +65,12 @@ class GamepadPlatformDataFetcherWin : public GamepadDataFetcher {
void GetXInputPadData(int i, blink::WebGamepad* pad);
void GetDirectInputPadData(int i, blink::WebGamepad* pad);
+ void GetRawInputPadData(int i, blink::WebGamepad* pad);
int FirstAvailableGamepadId() const;
bool HasXInputGamepad(int index) const;
bool HasDirectInputGamepad(const GUID &guid) const;
+ bool HasRawInputGamepad(const HANDLE handle) const;
base::ScopedNativeLibrary xinput_dll_;
bool xinput_available_;
@@ -79,18 +87,26 @@ class GamepadPlatformDataFetcherWin : public GamepadDataFetcher {
enum PadConnectionStatus {
DISCONNECTED,
XINPUT_CONNECTED,
- DIRECTINPUT_CONNECTED
+ DIRECTINPUT_CONNECTED,
+ RAWINPUT_CONNECTED
};
struct PadState {
PadConnectionStatus status;
- int xinput_index; // XInput-only.
- // Fields below are for DirectInput devices only.
+ GamepadStandardMappingFunction mapper;
+
+ // XInput-only fields.
+ int xinput_index;
+ // DirectInput-only fields.
GUID guid;
IDirectInputDevice8* directinput_gamepad;
- GamepadStandardMappingFunction mapper;
+ // RawInput-only fields.
+ HANDLE handle;
};
PadState pad_state_[blink::WebGamepads::itemsLengthCap];
+ blink::WebGamepads data_;
scottmg 2014/01/31 20:51:10 i don't like storing this state here. does Raw nee
+
+ scoped_ptr<RawInputDataFetcher> raw_input_fetcher_;
DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherWin);
};

Powered by Google App Engine
This is Rietveld 408576698