OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 DEVICE_GAMEPAD_RAW_INPUT_DATA_FETCHER_WIN_H_ | 5 #ifndef DEVICE_GAMEPAD_RAW_INPUT_DATA_FETCHER_WIN_H_ |
6 #define DEVICE_GAMEPAD_RAW_INPUT_DATA_FETCHER_WIN_H_ | 6 #define DEVICE_GAMEPAD_RAW_INPUT_DATA_FETCHER_WIN_H_ |
7 | 7 |
8 #include <Unknwn.h> | 8 #include <Unknwn.h> |
9 #include <WinDef.h> | 9 #include <WinDef.h> |
10 #include <hidsdi.h> | 10 #include <hidsdi.h> |
11 #include <stdint.h> | 11 #include <stdint.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 #include <windows.h> | 13 #include <windows.h> |
14 | 14 |
15 #include <map> | 15 #include <map> |
16 #include <memory> | 16 #include <memory> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
22 #include "base/scoped_native_library.h" | 22 #include "base/scoped_native_library.h" |
23 #include "base/win/message_window.h" | 23 #include "base/win/message_window.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 #include "device/gamepad/gamepad_data_fetcher.h" | 25 #include "device/gamepad/gamepad_data_fetcher.h" |
26 #include "device/gamepad/gamepad_standard_mappings.h" | 26 #include "device/gamepad/gamepad_standard_mappings.h" |
27 #include "third_party/WebKit/public/platform/WebGamepads.h" | 27 #include "device/gamepad/public/cpp/gamepad.h" |
28 | 28 |
29 namespace device { | 29 namespace device { |
30 | 30 |
31 struct RawGamepadAxis { | 31 struct RawGamepadAxis { |
32 HIDP_VALUE_CAPS caps; | 32 HIDP_VALUE_CAPS caps; |
33 float value; | 33 float value; |
34 bool active; | 34 bool active; |
35 unsigned long bitmask; | 35 unsigned long bitmask; |
36 }; | 36 }; |
37 | 37 |
38 struct RawGamepadInfo { | 38 struct RawGamepadInfo { |
39 RawGamepadInfo(); | 39 RawGamepadInfo(); |
40 ~RawGamepadInfo(); | 40 ~RawGamepadInfo(); |
41 | 41 |
42 int source_id; | 42 int source_id; |
43 int enumeration_id; | 43 int enumeration_id; |
44 HANDLE handle; | 44 HANDLE handle; |
45 std::unique_ptr<uint8_t[]> ppd_buffer; | 45 std::unique_ptr<uint8_t[]> ppd_buffer; |
46 PHIDP_PREPARSED_DATA preparsed_data; | 46 PHIDP_PREPARSED_DATA preparsed_data; |
47 | 47 |
48 uint32_t report_id; | 48 uint32_t report_id; |
49 uint32_t vendor_id; | 49 uint32_t vendor_id; |
50 uint32_t product_id; | 50 uint32_t product_id; |
51 | 51 |
52 wchar_t id[blink::WebGamepad::kIdLengthCap]; | 52 wchar_t id[Gamepad::kIdLengthCap]; |
53 | 53 |
54 uint32_t buttons_length; | 54 uint32_t buttons_length; |
55 bool buttons[blink::WebGamepad::kButtonsLengthCap]; | 55 bool buttons[Gamepad::kButtonsLengthCap]; |
56 | 56 |
57 uint32_t axes_length; | 57 uint32_t axes_length; |
58 RawGamepadAxis axes[blink::WebGamepad::kAxesLengthCap]; | 58 RawGamepadAxis axes[Gamepad::kAxesLengthCap]; |
59 }; | 59 }; |
60 | 60 |
61 class RawInputDataFetcher : public GamepadDataFetcher, | 61 class RawInputDataFetcher : public GamepadDataFetcher, |
62 public base::SupportsWeakPtr<RawInputDataFetcher>, | 62 public base::SupportsWeakPtr<RawInputDataFetcher>, |
63 public base::MessageLoop::DestructionObserver { | 63 public base::MessageLoop::DestructionObserver { |
64 public: | 64 public: |
65 typedef GamepadDataFetcherFactoryImpl<RawInputDataFetcher, | 65 typedef GamepadDataFetcherFactoryImpl<RawInputDataFetcher, |
66 GAMEPAD_SOURCE_WIN_RAW> | 66 GAMEPAD_SOURCE_WIN_RAW> |
67 Factory; | 67 Factory; |
68 | 68 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 HidPGetUsageValueFunc hidp_get_usage_value_; | 163 HidPGetUsageValueFunc hidp_get_usage_value_; |
164 HidPGetScaledUsageValueFunc hidp_get_scaled_usage_value_; | 164 HidPGetScaledUsageValueFunc hidp_get_scaled_usage_value_; |
165 HidDGetStringFunc hidd_get_product_string_; | 165 HidDGetStringFunc hidd_get_product_string_; |
166 | 166 |
167 DISALLOW_COPY_AND_ASSIGN(RawInputDataFetcher); | 167 DISALLOW_COPY_AND_ASSIGN(RawInputDataFetcher); |
168 }; | 168 }; |
169 | 169 |
170 } // namespace device | 170 } // namespace device |
171 | 171 |
172 #endif // DEVICE_GAMEPAD_RAW_INPUT_DATA_FETCHER_WIN_H_ | 172 #endif // DEVICE_GAMEPAD_RAW_INPUT_DATA_FETCHER_WIN_H_ |
OLD | NEW |