OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 6448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6459 void RenderFrameImpl::HandlePepperImeCommit(const base::string16& text) { | 6459 void RenderFrameImpl::HandlePepperImeCommit(const base::string16& text) { |
6460 if (text.empty()) | 6460 if (text.empty()) |
6461 return; | 6461 return; |
6462 | 6462 |
6463 if (!IsPepperAcceptingCompositionEvents()) { | 6463 if (!IsPepperAcceptingCompositionEvents()) { |
6464 // For pepper plugins unable to handle IME events, send the plugin a | 6464 // For pepper plugins unable to handle IME events, send the plugin a |
6465 // sequence of characters instead. | 6465 // sequence of characters instead. |
6466 base::i18n::UTF16CharIterator iterator(&text); | 6466 base::i18n::UTF16CharIterator iterator(&text); |
6467 int32_t i = 0; | 6467 int32_t i = 0; |
6468 while (iterator.Advance()) { | 6468 while (iterator.Advance()) { |
6469 blink::WebKeyboardEvent char_event; | 6469 blink::WebKeyboardEvent char_event( |
6470 char_event.type = blink::WebInputEvent::Char; | 6470 blink::WebInputEvent::Char, blink::WebInputEvent::NoModifiers, |
6471 char_event.timeStampSeconds = | 6471 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
6472 ui::EventTimeStampToSeconds(ui::EventTimeForNow()); | |
6473 char_event.modifiers = 0; | |
6474 char_event.windowsKeyCode = text[i]; | 6472 char_event.windowsKeyCode = text[i]; |
6475 char_event.nativeKeyCode = text[i]; | 6473 char_event.nativeKeyCode = text[i]; |
6476 | 6474 |
6477 const int32_t char_start = i; | 6475 const int32_t char_start = i; |
6478 for (; i < iterator.array_pos(); ++i) { | 6476 for (; i < iterator.array_pos(); ++i) { |
6479 char_event.text[i - char_start] = text[i]; | 6477 char_event.text[i - char_start] = text[i]; |
6480 char_event.unmodifiedText[i - char_start] = text[i]; | 6478 char_event.unmodifiedText[i - char_start] = text[i]; |
6481 } | 6479 } |
6482 | 6480 |
6483 if (GetRenderWidget()->GetWebWidget()) | 6481 if (GetRenderWidget()->GetWebWidget()) |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6676 // event target. Potentially a Pepper plugin will receive the event. | 6674 // event target. Potentially a Pepper plugin will receive the event. |
6677 // In order to tell whether a plugin gets the last mouse event and which it | 6675 // In order to tell whether a plugin gets the last mouse event and which it |
6678 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6676 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6679 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6677 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6680 // |pepper_last_mouse_event_target_|. | 6678 // |pepper_last_mouse_event_target_|. |
6681 pepper_last_mouse_event_target_ = nullptr; | 6679 pepper_last_mouse_event_target_ = nullptr; |
6682 #endif | 6680 #endif |
6683 } | 6681 } |
6684 | 6682 |
6685 } // namespace content | 6683 } // namespace content |
OLD | NEW |