Chromium Code Reviews| 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_STANDARD_MAPPINGS_H_ | 5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ |
| 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ | 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ |
| 7 | 7 |
| 8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
| 9 #include "content/common/gamepad_hardware_buffer.h" | 9 #include "content/common/gamepad_hardware_buffer.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 typedef void (*GamepadStandardMappingFunction)( | 13 typedef void (*GamepadStandardMappingFunction)( |
| 14 const blink::WebGamepad& original, | 14 const blink::WebGamepad& original, |
| 15 blink::WebGamepad* mapped); | 15 blink::WebGamepad* mapped); |
| 16 | 16 |
| 17 GamepadStandardMappingFunction GetGamepadStandardMappingFunction( | 17 GamepadStandardMappingFunction GetGamepadStandardMappingFunction( |
| 18 const base::StringPiece& vendor_id, | 18 const base::StringPiece& vendor_id, |
| 19 const base::StringPiece& product_id); | 19 const base::StringPiece& product_id); |
| 20 | 20 |
| 21 // This defines our canonical mapping order for gamepad-like devices. If these | 21 // This defines our canonical mapping order for gamepad-like devices. If these |
| 22 // items cannot all be satisfied, it is a case-by-case judgement as to whether | 22 // items cannot all be satisfied, it is a case-by-case judgement as to whether |
| 23 // it is better to leave the device unmapped, or to partially map it. In | 23 // it is better to leave the device unmapped, or to partially map it. In |
| 24 // general, err towards leaving it *unmapped* so that content can handle | 24 // general, err towards leaving it *unmapped* so that content can handle |
| 25 // appropriately. | 25 // appropriately. |
| 26 | 26 |
| 27 // TODO(b.kelemen): generate this via canonical_button_list.h and | |
| 28 // canonical_axes_list.h. | |
| 29 | |
|
jdduke (slow)
2014/03/07 23:16:39
Please file a bug. Until we adopt the mentioned h
kbalazs
2014/03/12 00:17:36
Bug filed: http://crbug.com/351558
| |
| 27 enum CanonicalButtonIndex { | 30 enum CanonicalButtonIndex { |
| 28 kButtonPrimary, | 31 kButtonPrimary, |
| 29 kButtonSecondary, | 32 kButtonSecondary, |
| 30 kButtonTertiary, | 33 kButtonTertiary, |
| 31 kButtonQuaternary, | 34 kButtonQuaternary, |
| 32 kButtonLeftShoulder, | 35 kButtonLeftShoulder, |
| 33 kButtonRightShoulder, | 36 kButtonRightShoulder, |
| 34 kButtonLeftTrigger, | 37 kButtonLeftTrigger, |
| 35 kButtonRightTrigger, | 38 kButtonRightTrigger, |
| 36 kButtonBackSelect, | 39 kButtonBackSelect, |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 58 | 61 |
| 59 // Common mapping functions | 62 // Common mapping functions |
| 60 blink::WebGamepadButton AxisToButton(float input); | 63 blink::WebGamepadButton AxisToButton(float input); |
| 61 blink::WebGamepadButton AxisNegativeAsButton(float input); | 64 blink::WebGamepadButton AxisNegativeAsButton(float input); |
| 62 blink::WebGamepadButton AxisPositiveAsButton(float input); | 65 blink::WebGamepadButton AxisPositiveAsButton(float input); |
| 63 void DpadFromAxis(blink::WebGamepad* mapped, float dir); | 66 void DpadFromAxis(blink::WebGamepad* mapped, float dir); |
| 64 | 67 |
| 65 } // namespace content | 68 } // namespace content |
| 66 | 69 |
| 67 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ | 70 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ |
| OLD | NEW |