Chromium Code Reviews| 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()) { | |
| 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; | |
|
Devlin
2016/03/14 22:32:01
don't need this return
Azure Wei
2016/03/15 00:37:25
This 'return' is necessary to prevent the function
| |
| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 client->ConfirmCompositionText(); | 428 client->ConfirmCompositionText(); |
| 415 | 429 |
| 416 if (GetEngine()) | 430 if (GetEngine()) |
| 417 GetEngine()->Reset(); | 431 GetEngine()->Reset(); |
| 418 } | 432 } |
| 419 | 433 |
| 420 ResetContext(); | 434 ResetContext(); |
| 421 } | 435 } |
| 422 | 436 |
| 423 } // namespace ui | 437 } // namespace ui |
| OLD | NEW |