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

Side by Side Diff: webkit/plugins/ppapi/event_conversion.cc

Issue 10912062: Implement the gamepad API in the IPC proxy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/event_conversion.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <map> 5 #include <map>
6 6
7 #include "webkit/plugins/ppapi/event_conversion.h" 7 #include "webkit/plugins/ppapi/event_conversion.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/i18n/char_iterator.h" 10 #include "base/i18n/char_iterator.h"
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 case WebInputEvent::TouchMove: 717 case WebInputEvent::TouchMove:
718 case WebInputEvent::TouchStart: 718 case WebInputEvent::TouchStart:
719 return PP_INPUTEVENT_CLASS_TOUCH; 719 return PP_INPUTEVENT_CLASS_TOUCH;
720 case WebInputEvent::Undefined: 720 case WebInputEvent::Undefined:
721 default: 721 default:
722 NOTREACHED(); 722 NOTREACHED();
723 return PP_InputEvent_Class(0); 723 return PP_InputEvent_Class(0);
724 } 724 }
725 } 725 }
726 726
727 void ConvertWebKitGamepadData(WebKit::WebGamepads& webkit_data,
728 PP_GamepadsSampleData* output_data) {
729 output_data->length = webkit_data.length;
730 for (unsigned i = 0; i < webkit_data.length; ++i) {
731 PP_GamepadSampleData& output_pad = output_data->items[i];
732 const WebKit::WebGamepad& webkit_pad = webkit_data.items[i];
733 output_pad.connected = webkit_pad.connected ? PP_TRUE : PP_FALSE;
734 if (webkit_pad.connected) {
735 COMPILE_ASSERT(sizeof(output_pad.id) == sizeof(webkit_pad.id),
736 id_size_does_not_match);
737 COMPILE_ASSERT(sizeof(output_pad.axes) == sizeof(webkit_pad.axes),
738 axes_size_does_not_match);
739 COMPILE_ASSERT(sizeof(output_pad.buttons) == sizeof(webkit_pad.buttons),
740 buttons_size_does_not_match);
741 memcpy(output_pad.id, webkit_pad.id, sizeof(output_pad.id));
742 output_pad.timestamp = webkit_pad.timestamp;
743 output_pad.axes_length = webkit_pad.axesLength;
744 memcpy(output_pad.axes, webkit_pad.axes, sizeof(output_pad.axes));
745 output_pad.buttons_length = webkit_pad.buttonsLength;
746 memcpy(output_pad.buttons,
747 webkit_pad.buttons,
748 sizeof(output_pad.buttons));
749 }
750 }
751 }
752
753 } // namespace ppapi 727 } // namespace ppapi
754 } // namespace webkit 728 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/event_conversion.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698