| Index: remoting/host/input_injector_chromeos.cc
|
| diff --git a/remoting/host/input_injector_chromeos.cc b/remoting/host/input_injector_chromeos.cc
|
| index 1398e3f864c84e35cfefe71ce0abfe561482f073..d3bccd0b813db5f6da94ba2a3d97f74a9c30b12e 100644
|
| --- a/remoting/host/input_injector_chromeos.cc
|
| +++ b/remoting/host/input_injector_chromeos.cc
|
| @@ -15,9 +15,10 @@
|
| #include "remoting/host/chromeos/point_transformer.h"
|
| #include "remoting/host/clipboard.h"
|
| #include "remoting/proto/internal.pb.h"
|
| +#include "ui/base/ime/chromeos/ime_keyboard.h"
|
| +#include "ui/base/ime/chromeos/input_method_manager.h"
|
| #include "ui/events/keycodes/dom/dom_code.h"
|
| #include "ui/events/keycodes/dom/keycode_converter.h"
|
| -#include "ui/ozone/public/input_controller.h"
|
| #include "ui/ozone/public/ozone_platform.h"
|
| #include "ui/ozone/public/system_input_injector.h"
|
|
|
| @@ -45,6 +46,28 @@ ui::EventFlags MouseButtonToUIFlags(MouseEvent::MouseButton button) {
|
| }
|
| }
|
|
|
| +bool shouldSetLockStates(ui::DomCode dom_code, bool key_pressed) {
|
| + if (!key_pressed)
|
| + return false;
|
| + switch (dom_code) {
|
| + // Ignores all the keys that could possibly be mapped to Caps Lock in event
|
| + // rewriter. Please refer to ui::EventRewriterChromeOS::RewriteModifierKeys.
|
| + case ui::DomCode::F16:
|
| + case ui::DomCode::CAPS_LOCK:
|
| + case ui::DomCode::META_LEFT:
|
| + case ui::DomCode::META_RIGHT:
|
| + case ui::DomCode::CONTROL_LEFT:
|
| + case ui::DomCode::CONTROL_RIGHT:
|
| + case ui::DomCode::ALT_LEFT:
|
| + case ui::DomCode::ALT_RIGHT:
|
| + case ui::DomCode::ESCAPE:
|
| + case ui::DomCode::BACKSPACE:
|
| + return false;
|
| + default:
|
| + return true;
|
| + }
|
| +}
|
| +
|
| } // namespace
|
|
|
| // This class is run exclusively on the UI thread of the browser process.
|
| @@ -85,13 +108,14 @@ void InputInjectorChromeos::Core::InjectKeyEvent(const KeyEvent& event) {
|
| DCHECK(event.has_pressed());
|
| DCHECK(event.has_usb_keycode());
|
|
|
| - if (event.has_lock_states()) {
|
| - SetLockStates(event.lock_states());
|
| - }
|
| -
|
| ui::DomCode dom_code =
|
| ui::KeycodeConverter::UsbKeycodeToDomCode(event.usb_keycode());
|
|
|
| + if (event.has_lock_states() &&
|
| + shouldSetLockStates(dom_code, event.pressed())) {
|
| + SetLockStates(event.lock_states());
|
| + }
|
| +
|
| // Ignore events which can't be mapped.
|
| if (dom_code != ui::DomCode::NONE) {
|
| delegate_->InjectKeyEvent(dom_code, event.pressed(),
|
| @@ -131,9 +155,9 @@ void InputInjectorChromeos::Core::Start(
|
| }
|
|
|
| void InputInjectorChromeos::Core::SetLockStates(uint32_t states) {
|
| - ui::InputController* input_controller =
|
| - ui::OzonePlatform::GetInstance()->GetInputController();
|
| - input_controller->SetCapsLockEnabled(
|
| + chromeos::input_method::InputMethodManager* ime =
|
| + chromeos::input_method::InputMethodManager::Get();
|
| + ime->GetImeKeyboard()->SetCapsLockEnabled(
|
| states & protocol::KeyEvent::LOCK_STATES_CAPSLOCK);
|
| }
|
|
|
|
|