Chromium Code Reviews| Index: ui/events/ozone/gamepad/gamepad_mapping.h |
| diff --git a/ui/events/ozone/gamepad/gamepad_mapping.h b/ui/events/ozone/gamepad/gamepad_mapping.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c5b250988a509d0a57893cb1fac417578d009fcb |
| --- /dev/null |
| +++ b/ui/events/ozone/gamepad/gamepad_mapping.h |
| @@ -0,0 +1,28 @@ |
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_EVENTS_OZONE_GAMEPAD_GAMEPAD_MAPPING_H_ |
| +#define UI_EVENTS_OZONE_GAMEPAD_GAMEPAD_MAPPING_H_ |
| + |
| +#include "ui/events/ozone/gamepad/webgamepad_constants.h" |
| + |
| +namespace ui { |
| + |
| +// The following HATX and HATY is not part of web gamepad definition, but we |
| +// need to specially treat them cause HAT_Y can be mapped to DPAD_UP or |
| +// DPAD_DOWN, and HAT_X can be mapped to DAPD_LEFT or DPAD_RIGHT. |
| +constexpr int kHAT_X = 4; |
| +constexpr int kHAT_Y = 5; |
| + |
| +typedef bool (*GamepadMapper)(uint16_t key, |
| + uint16_t code, |
| + GamepadEventType* mapped_type, |
| + uint16_t* mapped_code); |
| + |
| +// This function get the best mapper for the gamepad vendor_id and product_id. |
|
scottmg
2017/05/01 18:20:53
get -> gets
jkwang
2017/05/01 22:21:57
Done.
|
| +GamepadMapper GetGamepadMapper(uint16_t vendor_id, uint16_t product_id); |
| + |
| +}; // namespace ui |
|
scottmg
2017/05/01 18:20:53
No ;.
jkwang
2017/05/01 22:21:57
Done.
|
| + |
| +#endif // UI_EVENTS_OZONE_GAMEPAD_GAMEPAD_MAPPING_H_ |