Move prefs::kLastPolicyStatisticsUpdate to the policy component.
[chromium-blink-merge.git] / ppapi / shared_impl / ppb_gamepad_shared.cc
blob41c7668ebb1c62fda45cffd0acfcf848de3fe334
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 #include "ppapi/shared_impl/ppb_gamepad_shared.h"
7 #include "base/basictypes.h"
9 namespace ppapi {
11 void ConvertWebKitGamepadData(const WebKitGamepads& webkit_data,
12 PP_GamepadsSampleData* output_data) {
13 output_data->length = webkit_data.length;
14 for (unsigned i = 0; i < webkit_data.length; ++i) {
15 PP_GamepadSampleData& output_pad = output_data->items[i];
16 const WebKitGamepad& webkit_pad = webkit_data.items[i];
17 output_pad.connected = webkit_pad.connected ? PP_TRUE : PP_FALSE;
18 if (webkit_pad.connected) {
19 COMPILE_ASSERT(sizeof(output_pad.id) == sizeof(webkit_pad.id),
20 id_size_does_not_match);
21 COMPILE_ASSERT(sizeof(output_pad.axes) == sizeof(webkit_pad.axes),
22 axes_size_does_not_match);
23 COMPILE_ASSERT(sizeof(output_pad.buttons) == sizeof(webkit_pad.buttons),
24 buttons_size_does_not_match);
25 memcpy(output_pad.id, webkit_pad.id, sizeof(output_pad.id));
26 output_pad.timestamp = webkit_pad.timestamp;
27 output_pad.axes_length = webkit_pad.axes_length;
28 memcpy(output_pad.axes, webkit_pad.axes, sizeof(output_pad.axes));
29 output_pad.buttons_length = webkit_pad.buttons_length;
30 memcpy(output_pad.buttons,
31 webkit_pad.buttons,
32 sizeof(output_pad.buttons));
37 } // namespace ppapi