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

Unified Diff: chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.cc

Issue 2557493002: IME for Mus: Use ui::InputMethodChromeOS to provide logic for ime driver. (Closed)
Patch Set: More cleanup. Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.cc
diff --git a/chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.cc b/chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.cc
new file mode 100644
index 0000000000000000000000000000000000000000..76869b1c0e8e141390161ec3f3073b212c280cf9
--- /dev/null
+++ b/chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.cc
@@ -0,0 +1,48 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.h"
+
+#include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h"
+
+InputMethodBridge::InputMethodBridge(ui::mojom::TextInputClientPtr client)
+ : client_(base::MakeUnique<RemoteTextInputClient>(std::move(client))),
+ input_method_chromeos_(
+ base::MakeUnique<ui::InputMethodChromeOS>(nullptr)) {
+ input_method_chromeos_->SetFocusedTextInputClient(client_.get());
+}
+
+InputMethodBridge::~InputMethodBridge() {}
+
+void InputMethodBridge::OnTextInputModeChanged(
+ ui::mojom::TextInputMode text_input_mode) {
+ // TODO(moshayedi): crbug.com/631527. Consider removing this, as
+ // ui::InputMethodChromeOS doesn't have this.
+}
+
+void InputMethodBridge::OnTextInputTypeChanged(
+ ui::mojom::TextInputType text_input_type) {
+ input_method_chromeos_->OnTextInputTypeChanged(client_.get());
+}
+
+void InputMethodBridge::OnCaretBoundsChanged(const gfx::Rect& caret_bounds) {
+ input_method_chromeos_->OnCaretBoundsChanged(client_.get());
+}
+
+void InputMethodBridge::ProcessKeyEvent(
+ std::unique_ptr<ui::Event> event,
+ const ProcessKeyEventCallback& callback) {
+ DCHECK(event->IsKeyEvent());
+ ui::KeyEvent* key_event = event->AsKeyEvent();
+ if (!key_event->is_char()) {
+ input_method_chromeos_->DispatchKeyEvent(
+ key_event, base::MakeUnique<base::Callback<void(bool)>>(callback));
+ } else {
+ callback.Run(false);
+ }
+}
+
+void InputMethodBridge::CancelComposition() {
+ input_method_chromeos_->CancelComposition(client_.get());
+}

Powered by Google App Engine
This is Rietveld 408576698