| OLD | NEW |
| 1 // Copyright (c) 2011 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_DATA_FETCHER_MAC_H_ | 5 #ifndef CONTENT_BROWSER_GAMEPAD_DATA_FETCHER_MAC_H_ |
| 6 #define CONTENT_BROWSER_GAMEPAD_DATA_FETCHER_MAC_H_ | 6 #define CONTENT_BROWSER_GAMEPAD_DATA_FETCHER_MAC_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
| 12 #include "content/browser/gamepad/data_fetcher.h" | 12 #include "content/browser/gamepad/data_fetcher.h" |
| 13 #include "content/common/gamepad_hardware_buffer.h" | 13 #include "content/common/gamepad_hardware_buffer.h" |
| 14 | 14 |
| 15 #include <CoreFoundation/CoreFoundation.h> | 15 #include <CoreFoundation/CoreFoundation.h> |
| 16 #include <IOKit/hid/IOHIDManager.h> | 16 #include <IOKit/hid/IOHIDManager.h> |
| 17 | 17 |
| 18 #if defined(__OBJC__) | 18 #if defined(__OBJC__) |
| 19 @class NSArray; | 19 @class NSArray; |
| 20 #else | 20 #else |
| 21 class NSArray; | 21 class NSArray; |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 | 25 |
| 26 class GamepadDataFetcherMac : public GamepadDataFetcher { | 26 class GamepadPlatformDataFetcherMac : public GamepadDataFetcher { |
| 27 public: | 27 public: |
| 28 GamepadDataFetcherMac(); | 28 GamepadPlatformDataFetcherMac(); |
| 29 virtual ~GamepadDataFetcherMac(); | 29 virtual ~GamepadPlatformDataFetcherMac(); |
| 30 virtual void GetGamepadData(WebKit::WebGamepads* pads, | 30 virtual void GetGamepadData(WebKit::WebGamepads* pads, |
| 31 bool devices_changed_hint) OVERRIDE; | 31 bool devices_changed_hint) OVERRIDE; |
| 32 virtual void PauseHint(bool paused) OVERRIDE; | 32 virtual void PauseHint(bool paused) OVERRIDE; |
| 33 private: | 33 private: |
| 34 bool enabled_; | 34 bool enabled_; |
| 35 base::mac::ScopedCFTypeRef<IOHIDManagerRef> hid_manager_ref_; | 35 base::mac::ScopedCFTypeRef<IOHIDManagerRef> hid_manager_ref_; |
| 36 | 36 |
| 37 static GamepadDataFetcherMac* InstanceFromContext(void* context); | 37 static GamepadPlatformDataFetcherMac* InstanceFromContext(void* context); |
| 38 static void DeviceAddCallback(void* context, | 38 static void DeviceAddCallback(void* context, |
| 39 IOReturn result, | 39 IOReturn result, |
| 40 void* sender, | 40 void* sender, |
| 41 IOHIDDeviceRef ref); | 41 IOHIDDeviceRef ref); |
| 42 static void DeviceRemoveCallback(void* context, | 42 static void DeviceRemoveCallback(void* context, |
| 43 IOReturn result, | 43 IOReturn result, |
| 44 void* sender, | 44 void* sender, |
| 45 IOHIDDeviceRef ref); | 45 IOHIDDeviceRef ref); |
| 46 static void ValueChangedCallback(void* context, | 46 static void ValueChangedCallback(void* context, |
| 47 IOReturn result, | 47 IOReturn result, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 66 IOHIDElementRef axis_elements[WebKit::WebGamepad::buttonsLengthCap]; | 66 IOHIDElementRef axis_elements[WebKit::WebGamepad::buttonsLengthCap]; |
| 67 CFIndex axis_minimums[WebKit::WebGamepad::axesLengthCap]; | 67 CFIndex axis_minimums[WebKit::WebGamepad::axesLengthCap]; |
| 68 CFIndex axis_maximums[WebKit::WebGamepad::axesLengthCap]; | 68 CFIndex axis_maximums[WebKit::WebGamepad::axesLengthCap]; |
| 69 }; | 69 }; |
| 70 AssociatedData associated_[WebKit::WebGamepads::itemsLengthCap]; | 70 AssociatedData associated_[WebKit::WebGamepads::itemsLengthCap]; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 } // namespace content | 73 } // namespace content |
| 74 | 74 |
| 75 #endif // CONTENT_BROWSER_GAMEPAD_DATA_FETCHER_MAC_H_ | 75 #endif // CONTENT_BROWSER_GAMEPAD_DATA_FETCHER_MAC_H_ |
| OLD | NEW |