| 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 "content/renderer/pepper/event_conversion.h" | 5 #include "content/renderer/pepper/event_conversion.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 #include <stdint.h> | 8 #include <stdint.h> | 
| 9 #include <string.h> | 9 #include <string.h> | 
| 10 | 10 | 
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 373       break; | 373       break; | 
| 374     case PP_INPUTEVENT_TYPE_KEYUP: | 374     case PP_INPUTEVENT_TYPE_KEYUP: | 
| 375       key_event->type = WebInputEvent::KeyUp; | 375       key_event->type = WebInputEvent::KeyUp; | 
| 376       break; | 376       break; | 
| 377     default: | 377     default: | 
| 378       NOTREACHED(); | 378       NOTREACHED(); | 
| 379   } | 379   } | 
| 380   key_event->timeStampSeconds = event.event_time_stamp; | 380   key_event->timeStampSeconds = event.event_time_stamp; | 
| 381   key_event->modifiers = event.event_modifiers; | 381   key_event->modifiers = event.event_modifiers; | 
| 382   key_event->windowsKeyCode = event.key_code; | 382   key_event->windowsKeyCode = event.key_code; | 
| 383   key_event->setKeyIdentifierFromWindowsKeyCode(); |  | 
| 384   return key_event; | 383   return key_event; | 
| 385 } | 384 } | 
| 386 | 385 | 
| 387 WebKeyboardEvent* BuildCharEvent(const InputEventData& event) { | 386 WebKeyboardEvent* BuildCharEvent(const InputEventData& event) { | 
| 388   WebKeyboardEvent* key_event = new WebKeyboardEvent(); | 387   WebKeyboardEvent* key_event = new WebKeyboardEvent(); | 
| 389   key_event->type = WebInputEvent::Char; | 388   key_event->type = WebInputEvent::Char; | 
| 390   key_event->timeStampSeconds = event.event_time_stamp; | 389   key_event->timeStampSeconds = event.event_time_stamp; | 
| 391   key_event->modifiers = event.event_modifiers; | 390   key_event->modifiers = event.event_modifiers; | 
| 392 | 391 | 
| 393   // Make sure to not read beyond the buffer in case some bad code doesn't | 392   // Make sure to not read beyond the buffer in case some bad code doesn't | 
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 690       key_down_event->windowsKeyCode = code; | 689       key_down_event->windowsKeyCode = code; | 
| 691       key_down_event->nativeKeyCode = code; | 690       key_down_event->nativeKeyCode = code; | 
| 692       if (needs_shift_modifier) | 691       if (needs_shift_modifier) | 
| 693         key_down_event->modifiers |= WebInputEvent::ShiftKey; | 692         key_down_event->modifiers |= WebInputEvent::ShiftKey; | 
| 694 | 693 | 
| 695       // If a char event is needed, set the text fields. | 694       // If a char event is needed, set the text fields. | 
| 696       if (generate_char) { | 695       if (generate_char) { | 
| 697         key_down_event->text[0] = text; | 696         key_down_event->text[0] = text; | 
| 698         key_down_event->unmodifiedText[0] = text; | 697         key_down_event->unmodifiedText[0] = text; | 
| 699       } | 698       } | 
| 700       // Convert the key code to a string identifier. |  | 
| 701       key_down_event->setKeyIdentifierFromWindowsKeyCode(); |  | 
| 702 | 699 | 
| 703       *key_up_event = *web_char_event = *key_down_event; | 700       *key_up_event = *web_char_event = *key_down_event; | 
| 704 | 701 | 
| 705       events.push_back(std::move(key_down_event)); | 702       events.push_back(std::move(key_down_event)); | 
| 706 | 703 | 
| 707       if (generate_char) { | 704       if (generate_char) { | 
| 708         web_char_event->type = WebInputEvent::Char; | 705         web_char_event->type = WebInputEvent::Char; | 
| 709         web_char_event->keyIdentifier[0] = '\0'; |  | 
| 710         events.push_back(std::move(original_event)); | 706         events.push_back(std::move(original_event)); | 
| 711       } | 707       } | 
| 712 | 708 | 
| 713       key_up_event->type = WebInputEvent::KeyUp; | 709       key_up_event->type = WebInputEvent::KeyUp; | 
| 714       events.push_back(std::move(key_up_event)); | 710       events.push_back(std::move(key_up_event)); | 
| 715       break; | 711       break; | 
| 716     } | 712     } | 
| 717 | 713 | 
| 718     default: | 714     default: | 
| 719       break; | 715       break; | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 744       return PP_INPUTEVENT_CLASS_TOUCH; | 740       return PP_INPUTEVENT_CLASS_TOUCH; | 
| 745     case WebInputEvent::TouchScrollStarted: | 741     case WebInputEvent::TouchScrollStarted: | 
| 746       return PP_InputEvent_Class(0); | 742       return PP_InputEvent_Class(0); | 
| 747     default: | 743     default: | 
| 748       CHECK(WebInputEvent::isGestureEventType(type)); | 744       CHECK(WebInputEvent::isGestureEventType(type)); | 
| 749       return PP_InputEvent_Class(0); | 745       return PP_InputEvent_Class(0); | 
| 750   } | 746   } | 
| 751 } | 747 } | 
| 752 | 748 | 
| 753 }  // namespace content | 749 }  // namespace content | 
| OLD | NEW | 
|---|