Remove PlatformFile from profile_browsertest
[chromium-blink-merge.git] / content / browser / gamepad / gamepad_standard_mappings.h
blobe436f0c74977ea39795eb2c65990ce49932c6c90
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_
6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_
8 #include "base/strings/string_piece.h"
9 #include "content/common/gamepad_hardware_buffer.h"
11 namespace content {
13 typedef void (*GamepadStandardMappingFunction)(
14 const blink::WebGamepad& original,
15 blink::WebGamepad* mapped);
17 GamepadStandardMappingFunction GetGamepadStandardMappingFunction(
18 const base::StringPiece& vendor_id,
19 const base::StringPiece& product_id);
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
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
25 // appropriately.
27 enum CanonicalButtonIndex {
28 kButtonPrimary,
29 kButtonSecondary,
30 kButtonTertiary,
31 kButtonQuaternary,
32 kButtonLeftShoulder,
33 kButtonRightShoulder,
34 kButtonLeftTrigger,
35 kButtonRightTrigger,
36 kButtonBackSelect,
37 kButtonStart,
38 kButtonLeftThumbstick,
39 kButtonRightThumbstick,
40 kButtonDpadUp,
41 kButtonDpadDown,
42 kButtonDpadLeft,
43 kButtonDpadRight,
44 kButtonMeta,
45 kNumButtons
48 enum CanonicalAxisIndex {
49 kAxisLeftStickX,
50 kAxisLeftStickY,
51 kAxisRightStickX,
52 kAxisRightStickY,
53 kNumAxes
56 // Matches XInput's trigger deadzone
57 const float kDefaultButtonPressedThreshold = 30.f/255.f;
59 // Common mapping functions
60 blink::WebGamepadButton AxisToButton(float input);
61 blink::WebGamepadButton AxisNegativeAsButton(float input);
62 blink::WebGamepadButton AxisPositiveAsButton(float input);
63 blink::WebGamepadButton ButtonFromButtonAndAxis(
64 blink::WebGamepadButton button, float axis);
65 void DpadFromAxis(blink::WebGamepad* mapped, float dir);
67 } // namespace content
69 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_