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/views/ime_driver/input_method_bridge_chromeos.h" | 5 #include "chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.h" |
6 | 6 |
7 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h" | 7 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h" |
8 | 8 |
9 InputMethodBridge::InputMethodBridge(ui::mojom::TextInputClientPtr client) | 9 InputMethodBridge::InputMethodBridge(ui::mojom::TextInputClientPtr client) |
10 : client_(base::MakeUnique<RemoteTextInputClient>(std::move(client))), | 10 : client_(base::MakeUnique<RemoteTextInputClient>(std::move(client))), |
(...skipping 21 matching lines...) Expand all Loading... | |
32 | 32 |
33 void InputMethodBridge::ProcessKeyEvent( | 33 void InputMethodBridge::ProcessKeyEvent( |
34 std::unique_ptr<ui::Event> event, | 34 std::unique_ptr<ui::Event> event, |
35 const ProcessKeyEventCallback& callback) { | 35 const ProcessKeyEventCallback& callback) { |
36 DCHECK(event->IsKeyEvent()); | 36 DCHECK(event->IsKeyEvent()); |
37 ui::KeyEvent* key_event = event->AsKeyEvent(); | 37 ui::KeyEvent* key_event = event->AsKeyEvent(); |
38 if (!key_event->is_char()) { | 38 if (!key_event->is_char()) { |
39 input_method_chromeos_->DispatchKeyEvent( | 39 input_method_chromeos_->DispatchKeyEvent( |
40 key_event, base::MakeUnique<base::Callback<void(bool)>>(callback)); | 40 key_event, base::MakeUnique<base::Callback<void(bool)>>(callback)); |
41 } else { | 41 } else { |
42 callback.Run(false); | 42 // On Linux (include ChromeOS), the mus emulates the WM_CHAR generation |
sky
2016/12/15 16:54:14
This seems like a work around. Unnecessarily consu
Peng
2016/12/15 17:24:36
On Window, the char events are consumed by InputMe
| |
43 // behaviour of Windows. But for ChromeOS, we don't expect those char | |
44 // events, so we filter them out. | |
45 const bool handled = true; | |
46 callback.Run(handled); | |
43 } | 47 } |
44 } | 48 } |
45 | 49 |
46 void InputMethodBridge::CancelComposition() { | 50 void InputMethodBridge::CancelComposition() { |
47 input_method_chromeos_->CancelComposition(client_.get()); | 51 input_method_chromeos_->CancelComposition(client_.get()); |
48 } | 52 } |
OLD | NEW |