| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/input_method/input_method_engine_base.h" | 5 #include "chrome/browser/ui/input_method/input_method_engine_base.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #undef FocusIn | 9 #undef FocusIn |
| 10 #undef FocusOut | 10 #undef FocusOut |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 bool InputMethodEngineBase::IsInterestedInKeyEvent() const { | 355 bool InputMethodEngineBase::IsInterestedInKeyEvent() const { |
| 356 return observer_->IsInterestedInKeyEvent(); | 356 return observer_->IsInterestedInKeyEvent(); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void InputMethodEngineBase::ProcessKeyEvent(const ui::KeyEvent& key_event, | 359 void InputMethodEngineBase::ProcessKeyEvent(const ui::KeyEvent& key_event, |
| 360 KeyEventDoneCallback& callback) { | 360 KeyEventDoneCallback& callback) { |
| 361 // Make true that we don't handle IME API calling of setComposition and | 361 // Make true that we don't handle IME API calling of setComposition and |
| 362 // commitText while the extension is handling key event. | 362 // commitText while the extension is handling key event. |
| 363 handling_key_event_ = true; | 363 handling_key_event_ = true; |
| 364 | 364 |
| 365 if (key_event.IsCommandDown()) { |
| 366 callback.Run(false); |
| 367 return; |
| 368 } |
| 369 |
| 365 KeyboardEvent ext_event; | 370 KeyboardEvent ext_event; |
| 366 GetExtensionKeyboardEventFromKeyEvent(key_event, &ext_event); | 371 GetExtensionKeyboardEventFromKeyEvent(key_event, &ext_event); |
| 367 | 372 |
| 368 // If the given key event is equal to the key event sent by | 373 // If the given key event is equal to the key event sent by |
| 369 // SendKeyEvents, this engine ID is propagated to the extension IME. | 374 // SendKeyEvents, this engine ID is propagated to the extension IME. |
| 370 // Note, this check relies on that ui::KeyEvent is propagated as | 375 // Note, this check relies on that ui::KeyEvent is propagated as |
| 371 // reference without copying. | 376 // reference without copying. |
| 372 if (&key_event == sent_key_event_) | 377 if (&key_event == sent_key_event_) |
| 373 ext_event.extension_id = extension_id_; | 378 ext_event.extension_id = extension_id_; |
| 374 | 379 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 ui::EventTimeForNow()); | 464 ui::EventTimeForNow()); |
| 460 base::AutoReset<const ui::KeyEvent*> reset_sent_key(&sent_key_event_, | 465 base::AutoReset<const ui::KeyEvent*> reset_sent_key(&sent_key_event_, |
| 461 &ui_event); | 466 &ui_event); |
| 462 if (!SendKeyEvent(&ui_event, event.code)) | 467 if (!SendKeyEvent(&ui_event, event.code)) |
| 463 return false; | 468 return false; |
| 464 } | 469 } |
| 465 return true; | 470 return true; |
| 466 } | 471 } |
| 467 | 472 |
| 468 } // namespace input_method | 473 } // namespace input_method |
| OLD | NEW |