Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.cc

Issue 2626983003: IME for Mus: Send TextInputClient information to IMEDriver. (Closed)
Patch Set: Addressed feedback. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h" 8 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h"
9 9
10 InputMethodBridge::InputMethodBridge(ui::mojom::TextInputClientPtr client) 10 InputMethodBridge::InputMethodBridge(
11 : client_(base::MakeUnique<RemoteTextInputClient>(std::move(client))), 11 std::unique_ptr<RemoteTextInputClient> client)
12 : client_(std::move(client)),
12 input_method_chromeos_( 13 input_method_chromeos_(
13 base::MakeUnique<ui::InputMethodChromeOS>(nullptr)) { 14 base::MakeUnique<ui::InputMethodChromeOS>(nullptr)) {
14 input_method_chromeos_->SetFocusedTextInputClient(client_.get()); 15 input_method_chromeos_->SetFocusedTextInputClient(client_.get());
15 } 16 }
16 17
17 InputMethodBridge::~InputMethodBridge() {} 18 InputMethodBridge::~InputMethodBridge() {}
18 19
19 void InputMethodBridge::OnTextInputModeChanged( 20 void InputMethodBridge::OnTextInputModeChanged(
20 ui::TextInputMode text_input_mode) { 21 ui::TextInputMode text_input_mode) {
21 // TODO(moshayedi): crbug.com/631527. Consider removing this, as 22 // TODO(moshayedi): crbug.com/631527. Consider removing this, as
22 // ui::InputMethodChromeOS doesn't have this. 23 // ui::InputMethodChromeOS doesn't have this.
23 } 24 }
24 25
25 void InputMethodBridge::OnTextInputTypeChanged( 26 void InputMethodBridge::OnTextInputTypeChanged(
26 ui::TextInputType text_input_type) { 27 ui::TextInputType text_input_type) {
28 client_->SetTextInputType(text_input_type);
27 input_method_chromeos_->OnTextInputTypeChanged(client_.get()); 29 input_method_chromeos_->OnTextInputTypeChanged(client_.get());
28 } 30 }
29 31
30 void InputMethodBridge::OnCaretBoundsChanged(const gfx::Rect& caret_bounds) { 32 void InputMethodBridge::OnCaretBoundsChanged(const gfx::Rect& caret_bounds) {
33 client_->SetCaretBounds(caret_bounds);
31 input_method_chromeos_->OnCaretBoundsChanged(client_.get()); 34 input_method_chromeos_->OnCaretBoundsChanged(client_.get());
32 } 35 }
33 36
34 void InputMethodBridge::ProcessKeyEvent( 37 void InputMethodBridge::ProcessKeyEvent(
35 std::unique_ptr<ui::Event> event, 38 std::unique_ptr<ui::Event> event,
36 const ProcessKeyEventCallback& callback) { 39 const ProcessKeyEventCallback& callback) {
37 DCHECK(event->IsKeyEvent()); 40 DCHECK(event->IsKeyEvent());
38 ui::KeyEvent* key_event = event->AsKeyEvent(); 41 ui::KeyEvent* key_event = event->AsKeyEvent();
39 if (!key_event->is_char()) { 42 if (!key_event->is_char()) {
40 input_method_chromeos_->DispatchKeyEvent( 43 input_method_chromeos_->DispatchKeyEvent(
41 key_event, base::MakeUnique<base::Callback<void(bool)>>(callback)); 44 key_event, base::MakeUnique<base::Callback<void(bool)>>(callback));
42 } else { 45 } else {
43 // On Linux (include ChromeOS), the mus emulates the WM_CHAR generation 46 // On Linux (include ChromeOS), the mus emulates the WM_CHAR generation
44 // behaviour of Windows. But for ChromeOS, we don't expect those char 47 // behaviour of Windows. But for ChromeOS, we don't expect those char
45 // events, so we filter them out. 48 // events, so we filter them out.
46 const bool handled = true; 49 const bool handled = true;
47 callback.Run(handled); 50 callback.Run(handled);
48 } 51 }
49 } 52 }
50 53
51 void InputMethodBridge::CancelComposition() { 54 void InputMethodBridge::CancelComposition() {
52 input_method_chromeos_->CancelComposition(client_.get()); 55 input_method_chromeos_->CancelComposition(client_.get());
53 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698