| OLD | NEW |
| 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 "webkit/plugins/ppapi/event_conversion.h" | 5 #include "webkit/plugins/ppapi/event_conversion.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/i18n/char_iterator.h" | 8 #include "base/i18n/char_iterator.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 case WebInputEvent::Char: | 517 case WebInputEvent::Char: |
| 518 return PP_INPUTEVENT_CLASS_KEYBOARD; | 518 return PP_INPUTEVENT_CLASS_KEYBOARD; |
| 519 case WebInputEvent::Undefined: | 519 case WebInputEvent::Undefined: |
| 520 default: | 520 default: |
| 521 NOTREACHED(); | 521 NOTREACHED(); |
| 522 return PP_InputEvent_Class(0); | 522 return PP_InputEvent_Class(0); |
| 523 } | 523 } |
| 524 } | 524 } |
| 525 | 525 |
| 526 void ConvertWebKitGamepadData(WebKit::WebGamepads& webkit_data, | 526 void ConvertWebKitGamepadData(WebKit::WebGamepads& webkit_data, |
| 527 PP_GamepadsSampleData_Dev* output_data) { | 527 PP_GamepadsSampleData* output_data) { |
| 528 output_data->length = webkit_data.length; | 528 output_data->length = webkit_data.length; |
| 529 for (unsigned i = 0; i < webkit_data.length; ++i) { | 529 for (unsigned i = 0; i < webkit_data.length; ++i) { |
| 530 PP_GamepadSampleData_Dev& output_pad = output_data->items[i]; | 530 PP_GamepadSampleData& output_pad = output_data->items[i]; |
| 531 const WebKit::WebGamepad& webkit_pad = webkit_data.items[i]; | 531 const WebKit::WebGamepad& webkit_pad = webkit_data.items[i]; |
| 532 output_pad.connected = webkit_pad.connected ? PP_TRUE : PP_FALSE; | 532 output_pad.connected = webkit_pad.connected ? PP_TRUE : PP_FALSE; |
| 533 if (webkit_pad.connected) { | 533 if (webkit_pad.connected) { |
| 534 COMPILE_ASSERT(sizeof(output_pad.id) == sizeof(webkit_pad.id), | 534 COMPILE_ASSERT(sizeof(output_pad.id) == sizeof(webkit_pad.id), |
| 535 id_size_does_not_match); | 535 id_size_does_not_match); |
| 536 COMPILE_ASSERT(sizeof(output_pad.axes) == sizeof(webkit_pad.axes), | 536 COMPILE_ASSERT(sizeof(output_pad.axes) == sizeof(webkit_pad.axes), |
| 537 axes_size_does_not_match); | 537 axes_size_does_not_match); |
| 538 COMPILE_ASSERT(sizeof(output_pad.buttons) == sizeof(webkit_pad.buttons), | 538 COMPILE_ASSERT(sizeof(output_pad.buttons) == sizeof(webkit_pad.buttons), |
| 539 buttons_size_does_not_match); | 539 buttons_size_does_not_match); |
| 540 memcpy(output_pad.id, webkit_pad.id, sizeof(output_pad.id)); | 540 memcpy(output_pad.id, webkit_pad.id, sizeof(output_pad.id)); |
| 541 output_pad.timestamp = webkit_pad.timestamp; | 541 output_pad.timestamp = webkit_pad.timestamp; |
| 542 output_pad.axes_length = webkit_pad.axesLength; | 542 output_pad.axes_length = webkit_pad.axesLength; |
| 543 memcpy(output_pad.axes, webkit_pad.axes, sizeof(output_pad.axes)); | 543 memcpy(output_pad.axes, webkit_pad.axes, sizeof(output_pad.axes)); |
| 544 output_pad.buttons_length = webkit_pad.buttonsLength; | 544 output_pad.buttons_length = webkit_pad.buttonsLength; |
| 545 memcpy(output_pad.buttons, | 545 memcpy(output_pad.buttons, |
| 546 webkit_pad.buttons, | 546 webkit_pad.buttons, |
| 547 sizeof(output_pad.buttons)); | 547 sizeof(output_pad.buttons)); |
| 548 } | 548 } |
| 549 } | 549 } |
| 550 } | 550 } |
| 551 | 551 |
| 552 } // namespace ppapi | 552 } // namespace ppapi |
| 553 } // namespace webkit | 553 } // namespace webkit |
| OLD | NEW |