| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // If there's an active IME extension is listening to the key event, and the | 83 // If there's an active IME extension is listening to the key event, and the |
| 84 // current text input client is not password input client, the key event | 84 // current text input client is not password input client, the key event |
| 85 // should be dispatched to the extension engine in the two conditions: | 85 // should be dispatched to the extension engine in the two conditions: |
| 86 // 1) |filtered| == false: the ET_KEY_PRESSED event of non-character key, | 86 // 1) |filtered| == false: the ET_KEY_PRESSED event of non-character key, |
| 87 // or the ET_KEY_RELEASED event of all key. | 87 // or the ET_KEY_RELEASED event of all key. |
| 88 // 2) |filtered| == true && NeedInsertChar(): the ET_KEY_PRESSED event of | 88 // 2) |filtered| == true && NeedInsertChar(): the ET_KEY_PRESSED event of |
| 89 // character key. | 89 // character key. |
| 90 if (text_input_type_ != TEXT_INPUT_TYPE_PASSWORD && | 90 if (text_input_type_ != TEXT_INPUT_TYPE_PASSWORD && |
| 91 GetEngine() && GetEngine()->IsInterestedInKeyEvent() && | 91 GetEngine() && GetEngine()->IsInterestedInKeyEvent() && |
| 92 (!filtered || NeedInsertChar())) { | 92 (!filtered || NeedInsertChar())) { |
| 93 // Make true that we don't handle IME API calling of setComposition and |
| 94 // commitText while the extension is processing key event. |
| 95 handling_key_event_ = true; |
| 93 ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback = | 96 ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback = |
| 94 base::Bind(&InputMethodAuraLinux::ProcessKeyEventDone, | 97 base::Bind(&InputMethodAuraLinux::ProcessKeyEventDone, |
| 95 weak_ptr_factory_.GetWeakPtr(), | 98 weak_ptr_factory_.GetWeakPtr(), |
| 96 base::Owned(new ui::KeyEvent(*event)), filtered); | 99 base::Owned(new ui::KeyEvent(*event)), filtered); |
| 97 GetEngine()->ProcessKeyEvent(*event, callback); | 100 GetEngine()->ProcessKeyEvent(*event, callback); |
| 98 } else { | 101 } else { |
| 99 ProcessKeyEventDone(event, filtered, false); | 102 ProcessKeyEventDone(event, filtered, false); |
| 100 } | 103 } |
| 101 } | 104 } |
| 102 | 105 |
| 103 void InputMethodAuraLinux::ProcessKeyEventDone(ui::KeyEvent* event, | 106 void InputMethodAuraLinux::ProcessKeyEventDone(ui::KeyEvent* event, |
| 104 bool filtered, | 107 bool filtered, |
| 105 bool is_handled) { | 108 bool is_handled) { |
| 109 handling_key_event_ = false; |
| 110 |
| 106 DCHECK(event); | 111 DCHECK(event); |
| 107 if (is_handled) | 112 if (is_handled) |
| 108 return; | 113 return; |
| 109 | 114 |
| 110 // If the IME extension has not handled the key event, passes the keyevent | 115 // If the IME extension has not handled the key event, passes the keyevent |
| 111 // back to the previous processing flow. Preconditions for this situation: | 116 // back to the previous processing flow. Preconditions for this situation: |
| 112 // 1) |filtered| == false | 117 // 1) |filtered| == false |
| 113 // 2) |filtered| == true && NeedInsertChar() | 118 // 2) |filtered| == true && NeedInsertChar() |
| 114 ui::EventDispatchDetails details; | 119 ui::EventDispatchDetails details; |
| 115 if (event->type() == ui::ET_KEY_PRESSED && filtered) { | 120 if (event->type() == ui::ET_KEY_PRESSED && filtered) { |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 client->ConfirmCompositionText(); | 417 client->ConfirmCompositionText(); |
| 413 | 418 |
| 414 if (GetEngine()) | 419 if (GetEngine()) |
| 415 GetEngine()->Reset(); | 420 GetEngine()->Reset(); |
| 416 } | 421 } |
| 417 | 422 |
| 418 ResetContext(); | 423 ResetContext(); |
| 419 } | 424 } |
| 420 | 425 |
| 421 } // namespace ui | 426 } // namespace ui |
| OLD | NEW |