Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.h" | |
| 6 | |
| 7 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h" | |
| 8 | |
| 9 InputMethodBridge::InputMethodBridge(ui::mojom::TextInputClientPtr client) | |
| 10 : client_(new RemoteTextInputClient(std::move(client))), | |
|
sky
2016/12/12 02:16:21
MakeUnique where possible.
Hadi
2016/12/12 16:04:57
Done.
| |
| 11 input_method_chromeos_(new ui::InputMethodChromeOS(nullptr)) { | |
| 12 input_method_chromeos_->SetFocusedTextInputClient(client_.get()); | |
| 13 } | |
| 14 | |
| 15 InputMethodBridge::~InputMethodBridge() {} | |
| 16 | |
| 17 void InputMethodBridge::OnTextInputModeChanged( | |
| 18 ui::mojom::TextInputMode text_input_mode) { | |
| 19 // TODO(moshayedi): crbug.com/631527. Consider removing this, as | |
| 20 // ui::InputMethodChromeOS doesn't have this. | |
| 21 } | |
| 22 | |
| 23 void InputMethodBridge::OnTextInputTypeChanged( | |
| 24 ui::mojom::TextInputType text_input_type) { | |
| 25 input_method_chromeos_->OnTextInputTypeChanged(client_.get()); | |
| 26 } | |
| 27 | |
| 28 void InputMethodBridge::OnCaretBoundsChanged(const gfx::Rect& caret_bounds) { | |
| 29 input_method_chromeos_->OnCaretBoundsChanged(client_.get()); | |
| 30 } | |
| 31 | |
| 32 void InputMethodBridge::ProcessKeyEvent( | |
| 33 std::unique_ptr<ui::Event> event, | |
| 34 const ProcessKeyEventCallback& callback) { | |
| 35 DCHECK(event->IsKeyEvent()); | |
| 36 ui::KeyEvent* key_event = event->AsKeyEvent(); | |
| 37 if (!key_event->is_char()) { | |
| 38 input_method_chromeos_->DispatchKeyEvent( | |
| 39 key_event, base::MakeUnique<base::Callback<void(bool)>>(callback)); | |
| 40 } else { | |
| 41 callback.Run(false); | |
| 42 } | |
| 43 } | |
| 44 | |
| 45 void InputMethodBridge::CancelComposition() { | |
| 46 input_method_chromeos_->CancelComposition(client_.get()); | |
| 47 } | |
| OLD | NEW |