OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_ | 5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_ |
6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_ | 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #endif | 26 #endif |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 | 29 |
30 class GamepadPlatformDataFetcherMac : public GamepadDataFetcher, | 30 class GamepadPlatformDataFetcherMac : public GamepadDataFetcher, |
31 public XboxDataFetcher::Delegate { | 31 public XboxDataFetcher::Delegate { |
32 public: | 32 public: |
33 GamepadPlatformDataFetcherMac(); | 33 GamepadPlatformDataFetcherMac(); |
34 virtual ~GamepadPlatformDataFetcherMac(); | 34 virtual ~GamepadPlatformDataFetcherMac(); |
35 virtual void GetGamepadData(blink::WebGamepads* pads, | 35 virtual void GetGamepadData(blink::WebGamepads* pads, |
36 bool devices_changed_hint) OVERRIDE; | 36 bool devices_changed_hint) override; |
37 virtual void PauseHint(bool paused) OVERRIDE; | 37 virtual void PauseHint(bool paused) override; |
38 | 38 |
39 private: | 39 private: |
40 bool enabled_; | 40 bool enabled_; |
41 base::ScopedCFTypeRef<IOHIDManagerRef> hid_manager_ref_; | 41 base::ScopedCFTypeRef<IOHIDManagerRef> hid_manager_ref_; |
42 | 42 |
43 static GamepadPlatformDataFetcherMac* InstanceFromContext(void* context); | 43 static GamepadPlatformDataFetcherMac* InstanceFromContext(void* context); |
44 static void DeviceAddCallback(void* context, | 44 static void DeviceAddCallback(void* context, |
45 IOReturn result, | 45 IOReturn result, |
46 void* sender, | 46 void* sender, |
47 IOHIDDeviceRef ref); | 47 IOHIDDeviceRef ref); |
48 static void DeviceRemoveCallback(void* context, | 48 static void DeviceRemoveCallback(void* context, |
49 IOReturn result, | 49 IOReturn result, |
50 void* sender, | 50 void* sender, |
51 IOHIDDeviceRef ref); | 51 IOHIDDeviceRef ref); |
52 static void ValueChangedCallback(void* context, | 52 static void ValueChangedCallback(void* context, |
53 IOReturn result, | 53 IOReturn result, |
54 void* sender, | 54 void* sender, |
55 IOHIDValueRef ref); | 55 IOHIDValueRef ref); |
56 | 56 |
57 size_t GetEmptySlot(); | 57 size_t GetEmptySlot(); |
58 size_t GetSlotForDevice(IOHIDDeviceRef device); | 58 size_t GetSlotForDevice(IOHIDDeviceRef device); |
59 size_t GetSlotForXboxDevice(XboxController* device); | 59 size_t GetSlotForXboxDevice(XboxController* device); |
60 | 60 |
61 void DeviceAdd(IOHIDDeviceRef device); | 61 void DeviceAdd(IOHIDDeviceRef device); |
62 void AddButtonsAndAxes(NSArray* elements, size_t slot); | 62 void AddButtonsAndAxes(NSArray* elements, size_t slot); |
63 void DeviceRemove(IOHIDDeviceRef device); | 63 void DeviceRemove(IOHIDDeviceRef device); |
64 void ValueChanged(IOHIDValueRef value); | 64 void ValueChanged(IOHIDValueRef value); |
65 | 65 |
66 virtual void XboxDeviceAdd(XboxController* device) OVERRIDE; | 66 virtual void XboxDeviceAdd(XboxController* device) override; |
67 virtual void XboxDeviceRemove(XboxController* device) OVERRIDE; | 67 virtual void XboxDeviceRemove(XboxController* device) override; |
68 virtual void XboxValueChanged(XboxController* device, | 68 virtual void XboxValueChanged(XboxController* device, |
69 const XboxController::Data& data) OVERRIDE; | 69 const XboxController::Data& data) override; |
70 | 70 |
71 void RegisterForNotifications(); | 71 void RegisterForNotifications(); |
72 void UnregisterFromNotifications(); | 72 void UnregisterFromNotifications(); |
73 | 73 |
74 scoped_ptr<XboxDataFetcher> xbox_fetcher_; | 74 scoped_ptr<XboxDataFetcher> xbox_fetcher_; |
75 | 75 |
76 blink::WebGamepads data_; | 76 blink::WebGamepads data_; |
77 | 77 |
78 // Side-band data that's not passed to the consumer, but we need to maintain | 78 // Side-band data that's not passed to the consumer, but we need to maintain |
79 // to update data_. | 79 // to update data_. |
(...skipping 17 matching lines...) Expand all Loading... |
97 }; | 97 }; |
98 }; | 98 }; |
99 AssociatedData associated_[blink::WebGamepads::itemsLengthCap]; | 99 AssociatedData associated_[blink::WebGamepads::itemsLengthCap]; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherMac); | 101 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherMac); |
102 }; | 102 }; |
103 | 103 |
104 } // namespace content | 104 } // namespace content |
105 | 105 |
106 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_ | 106 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_ |
OLD | NEW |