Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: content/browser/gamepad/gamepad_standard_mappings.h

Issue 625543002: Revert of Use the new java_cpp_enum rule in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // A Java counterpart will be generated for this enum.
28 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser.input
29 // GENERATED_JAVA_PREFIX_TO_STRIP: BUTTON_INDEX_
30 enum CanonicalButtonIndex { 27 enum CanonicalButtonIndex {
31 BUTTON_INDEX_PRIMARY, 28 kButtonPrimary,
32 BUTTON_INDEX_SECONDARY, 29 kButtonSecondary,
33 BUTTON_INDEX_TERTIARY, 30 kButtonTertiary,
34 BUTTON_INDEX_QUATERNARY, 31 kButtonQuaternary,
35 BUTTON_INDEX_LEFT_SHOULDER, 32 kButtonLeftShoulder,
36 BUTTON_INDEX_RIGHT_SHOULDER, 33 kButtonRightShoulder,
37 BUTTON_INDEX_LEFT_TRIGGER, 34 kButtonLeftTrigger,
38 BUTTON_INDEX_RIGHT_TRIGGER, 35 kButtonRightTrigger,
39 BUTTON_INDEX_BACK_SELECT, 36 kButtonBackSelect,
40 BUTTON_INDEX_START, 37 kButtonStart,
41 BUTTON_INDEX_LEFT_THUMBSTICK, 38 kButtonLeftThumbstick,
42 BUTTON_INDEX_RIGHT_THUMBSTICK, 39 kButtonRightThumbstick,
43 BUTTON_INDEX_DPAD_UP, 40 kButtonDpadUp,
44 BUTTON_INDEX_DPAD_DOWN, 41 kButtonDpadDown,
45 BUTTON_INDEX_DPAD_LEFT, 42 kButtonDpadLeft,
46 BUTTON_INDEX_DPAD_RIGHT, 43 kButtonDpadRight,
47 BUTTON_INDEX_META, 44 kButtonMeta,
48 BUTTON_INDEX_COUNT 45 kNumButtons
49 }; 46 };
50 47
51 // A Java counterpart will be generated for this enum.
52 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser.input
53 // GENERATED_JAVA_PREFIX_TO_STRIP: AXIS_INDEX_
54 enum CanonicalAxisIndex { 48 enum CanonicalAxisIndex {
55 AXIS_INDEX_LEFT_STICK_X, 49 kAxisLeftStickX,
56 AXIS_INDEX_LEFT_STICK_Y, 50 kAxisLeftStickY,
57 AXIS_INDEX_RIGHT_STICK_X, 51 kAxisRightStickX,
58 AXIS_INDEX_RIGHT_STICK_Y, 52 kAxisRightStickY,
59 AXIS_INDEX_COUNT 53 kNumAxes
60 }; 54 };
61 55
62 // Matches XInput's trigger deadzone 56 // Matches XInput's trigger deadzone
63 const float kDefaultButtonPressedThreshold = 30.f/255.f; 57 const float kDefaultButtonPressedThreshold = 30.f/255.f;
64 58
65 // Common mapping functions 59 // Common mapping functions
66 blink::WebGamepadButton AxisToButton(float input); 60 blink::WebGamepadButton AxisToButton(float input);
67 blink::WebGamepadButton AxisNegativeAsButton(float input); 61 blink::WebGamepadButton AxisNegativeAsButton(float input);
68 blink::WebGamepadButton AxisPositiveAsButton(float input); 62 blink::WebGamepadButton AxisPositiveAsButton(float input);
69 blink::WebGamepadButton ButtonFromButtonAndAxis( 63 blink::WebGamepadButton ButtonFromButtonAndAxis(
70 blink::WebGamepadButton button, float axis); 64 blink::WebGamepadButton button, float axis);
71 blink::WebGamepadButton NullButton(); 65 blink::WebGamepadButton NullButton();
72 void DpadFromAxis(blink::WebGamepad* mapped, float dir); 66 void DpadFromAxis(blink::WebGamepad* mapped, float dir);
73 67
74 } // namespace content 68 } // namespace content
75 69
76 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ 70 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_
OLDNEW
« no previous file with comments | « content/browser/gamepad/canonical_button_index_list.h ('k') | content/browser/gamepad/gamepad_standard_mappings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698