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

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

Issue 1586663006: Refactoring gamepad polling to support dynamically added sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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_mac.h
diff --git a/content/browser/gamepad/gamepad_platform_data_fetcher_mac.h b/content/browser/gamepad/gamepad_platform_data_fetcher_mac.h
index ebfe57e35f458b31d18c19d1083ee42622ac76e9..303263c3d98aabb7ce20a46c95549038dbc653f4 100644
--- a/content/browser/gamepad/gamepad_platform_data_fetcher_mac.h
+++ b/content/browser/gamepad/gamepad_platform_data_fetcher_mac.h
@@ -13,8 +13,6 @@
#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "content/browser/gamepad/gamepad_data_fetcher.h"
-#include "content/browser/gamepad/xbox_data_fetcher_mac.h"
-#include "content/common/gamepad_hardware_buffer.h"
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/hid/IOHIDManager.h>
@@ -27,13 +25,11 @@ class NSArray;
namespace content {
-class GamepadPlatformDataFetcherMac : public GamepadDataFetcher,
- public XboxDataFetcher::Delegate {
+class GamepadPlatformDataFetcherMac : public GamepadDataFetcher {
public:
GamepadPlatformDataFetcherMac();
~GamepadPlatformDataFetcherMac() override;
- void GetGamepadData(blink::WebGamepads* pads,
- bool devices_changed_hint) override;
+ void GetGamepadData(bool devices_changed_hint) override;
void PauseHint(bool paused) override;
private:
@@ -55,44 +51,28 @@ class GamepadPlatformDataFetcherMac : public GamepadDataFetcher,
void* sender,
IOHIDValueRef ref);
+ void OnAddedToProvider() override;
+
size_t GetEmptySlot();
size_t GetSlotForDevice(IOHIDDeviceRef device);
- size_t GetSlotForXboxDevice(XboxController* device);
void DeviceAdd(IOHIDDeviceRef device);
- bool AddButtonsAndAxes(NSArray* elements, size_t slot);
+ bool AddButtonsAndAxes(NSArray* elements, PadState* state, size_t slot);
void DeviceRemove(IOHIDDeviceRef device);
void ValueChanged(IOHIDValueRef value);
- void XboxDeviceAdd(XboxController* device) override;
- void XboxDeviceRemove(XboxController* device) override;
- void XboxValueChanged(XboxController* device,
- const XboxController::Data& data) override;
-
void RegisterForNotifications();
void UnregisterFromNotifications();
- void SanitizeGamepadData(size_t index, blink::WebGamepad* pad);
-
- scoped_ptr<XboxDataFetcher> xbox_fetcher_;
-
// Side-band data that's not passed to the consumer, but we need to maintain
// to update data_.
struct AssociatedData {
- bool is_xbox;
- union {
- struct {
- IOHIDDeviceRef device_ref;
- IOHIDElementRef button_elements[blink::WebGamepad::buttonsLengthCap];
- IOHIDElementRef axis_elements[blink::WebGamepad::axesLengthCap];
- CFIndex axis_minimums[blink::WebGamepad::axesLengthCap];
- CFIndex axis_maximums[blink::WebGamepad::axesLengthCap];
- } hid;
- struct {
- XboxController* device;
- UInt32 location_id;
- } xbox;
- };
+ int location_id;
+ IOHIDDeviceRef device_ref;
+ IOHIDElementRef button_elements[blink::WebGamepad::buttonsLengthCap];
+ IOHIDElementRef axis_elements[blink::WebGamepad::axesLengthCap];
+ CFIndex axis_minimums[blink::WebGamepad::axesLengthCap];
+ CFIndex axis_maximums[blink::WebGamepad::axesLengthCap];
};
AssociatedData associated_[blink::WebGamepads::itemsLengthCap];

Powered by Google App Engine
This is Rietveld 408576698