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 "ui/base/ime/input_method_auralinux.h" | 5 #include "ui/base/ime/input_method_auralinux.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "ui/base/ime/ime_bridge.h" | 9 #include "ui/base/ime/ime_bridge.h" |
10 #include "ui/base/ime/ime_engine_handler_interface.h" | 10 #include "ui/base/ime/ime_engine_handler_interface.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 void InputMethodAuraLinux::DispatchKeyEvent(ui::KeyEvent* event) { | 59 void InputMethodAuraLinux::DispatchKeyEvent(ui::KeyEvent* event) { |
60 DCHECK(event->type() == ET_KEY_PRESSED || event->type() == ET_KEY_RELEASED); | 60 DCHECK(event->type() == ET_KEY_PRESSED || event->type() == ET_KEY_RELEASED); |
61 | 61 |
62 // If no text input client, do nothing. | 62 // If no text input client, do nothing. |
63 if (!GetTextInputClient()) { | 63 if (!GetTextInputClient()) { |
64 ignore_result(DispatchKeyEventPostIME(event)); | 64 ignore_result(DispatchKeyEventPostIME(event)); |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
| 68 if (!event->HasNativeEvent() && sending_key_event_) { |
| 69 // Faked key events that are sent from input.ime.sendKeyEvents. |
| 70 ui::EventDispatchDetails details = DispatchKeyEventPostIME(event); |
| 71 if (details.dispatcher_destroyed || details.target_destroyed || |
| 72 event->stopped_propagation()) { |
| 73 return; |
| 74 } |
| 75 if ((event->is_char() || event->GetDomKey().IsCharacter()) && |
| 76 event->type() == ui::ET_KEY_PRESSED) { |
| 77 GetTextInputClient()->InsertChar(*event); |
| 78 } |
| 79 return; |
| 80 } |
| 81 |
68 suppress_next_result_ = false; | 82 suppress_next_result_ = false; |
69 composition_changed_ = false; | 83 composition_changed_ = false; |
70 result_text_.clear(); | 84 result_text_.clear(); |
71 | 85 |
72 bool filtered = false; | 86 bool filtered = false; |
73 { | 87 { |
74 base::AutoReset<bool> flipper(&is_sync_mode_, true); | 88 base::AutoReset<bool> flipper(&is_sync_mode_, true); |
75 if (text_input_type_ != TEXT_INPUT_TYPE_NONE && | 89 if (text_input_type_ != TEXT_INPUT_TYPE_NONE && |
76 text_input_type_ != TEXT_INPUT_TYPE_PASSWORD) { | 90 text_input_type_ != TEXT_INPUT_TYPE_PASSWORD) { |
77 filtered = context_->DispatchKeyEvent(*event); | 91 filtered = context_->DispatchKeyEvent(*event); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 client->ConfirmCompositionText(); | 432 client->ConfirmCompositionText(); |
419 | 433 |
420 if (GetEngine()) | 434 if (GetEngine()) |
421 GetEngine()->Reset(); | 435 GetEngine()->Reset(); |
422 } | 436 } |
423 | 437 |
424 ResetContext(); | 438 ResetContext(); |
425 } | 439 } |
426 | 440 |
427 } // namespace ui | 441 } // namespace ui |
OLD | NEW |