Add ability to change display settings to chrome.systemInfo.display
[chromium-blink-merge.git] / ppapi / shared_impl / ppb_gamepad_shared.h
blob2a30c7d874a432d7f4ec1ccb6447e6634f53e44c
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 PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_
8 #include "base/atomicops.h"
9 #include "base/strings/string16.h"
10 #include "ppapi/c/ppb_gamepad.h"
11 #include "ppapi/shared_impl/ppapi_shared_export.h"
13 namespace ppapi {
15 // TODO(brettw) when we remove the non-IPC-based gamepad implementation, this
16 // code should all move into the GamepadResource.
18 #pragma pack(push, 1)
20 // This must match the definition of WebKit::Gamepad. The GamepadHost unit test
21 // has some compile asserts to validate this.
22 struct WebKitGamepad {
23 static const size_t kIdLengthCap = 128;
24 static const size_t kAxesLengthCap = 16;
25 static const size_t kButtonsLengthCap = 32;
27 // Is there a gamepad connected at this index?
28 bool connected;
30 // Device identifier (based on manufacturer, model, etc.).
31 char16 id[kIdLengthCap];
33 // Monotonically increasing value referring to when the data were last
34 // updated.
35 unsigned long long timestamp;
37 // Number of valid entries in the axes array.
38 unsigned axes_length;
40 // Normalized values representing axes, in the range [-1..1].
41 float axes[kAxesLengthCap];
43 // Number of valid entries in the buttons array.
44 unsigned buttons_length;
46 // Normalized values representing buttons, in the range [0..1].
47 float buttons[kButtonsLengthCap];
50 // This must match the definition of WebKit::Gamepads. The GamepadHost unit
51 // test has some compile asserts to validate this.
52 struct WebKitGamepads {
53 static const size_t kItemsLengthCap = 4;
55 // Number of valid entries in the items array.
56 unsigned length;
58 // Gamepad data for N separate gamepad devices.
59 WebKitGamepad items[kItemsLengthCap];
62 // This is the structure store in shared memory. It must match
63 // content/common/gamepad_hardware_buffer.h. The GamepadHost unit test has
64 // some compile asserts to validate this.
65 struct ContentGamepadHardwareBuffer {
66 base::subtle::Atomic32 sequence;
67 WebKitGamepads buffer;
70 #pragma pack(pop)
72 PPAPI_SHARED_EXPORT void ConvertWebKitGamepadData(
73 const WebKitGamepads& webkit_data,
74 PP_GamepadsSampleData* output_data);
76 } // namespace ppapi
78 #endif // PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_