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

Unified Diff: ui/aura/mus/text_input_client_impl.cc

Issue 2539453002: IME for Mus: Add ui.mojom.CompositionText and its struct traits. (Closed)
Patch Set: Addressed feedback. 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
« no previous file with comments | « ui/aura/mus/text_input_client_impl.h ('k') | ui/base/ime/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/text_input_client_impl.cc
diff --git a/ui/aura/mus/text_input_client_impl.cc b/ui/aura/mus/text_input_client_impl.cc
index 9e22764cb7b4e7a7538a564d2018feba64ffbc2c..2dbc39eeace328886101103482c957fc31068e2a 100644
--- a/ui/aura/mus/text_input_client_impl.cc
+++ b/ui/aura/mus/text_input_client_impl.cc
@@ -4,6 +4,7 @@
#include "ui/aura/mus/text_input_client_impl.h"
+#include "base/strings/utf_string_conversions.h"
#include "ui/aura/mus/input_method_mus.h"
#include "ui/base/ime/text_input_client.h"
@@ -18,29 +19,28 @@ ui::mojom::TextInputClientPtr TextInputClientImpl::CreateInterfacePtrAndBind() {
return binding_.CreateInterfacePtrAndBind();
}
-void TextInputClientImpl::OnCompositionEvent(
- ui::mojom::CompositionEventPtr event) {
- switch (event->type) {
- case ui::mojom::CompositionEventType::INSERT_CHAR: {
- DCHECK((*event->key_event)->IsKeyEvent());
- ui::KeyEvent* key_event = (*event->key_event)->AsKeyEvent();
- DCHECK(key_event->is_char());
- text_input_client_->InsertChar(*key_event);
- break;
- }
- case ui::mojom::CompositionEventType::CONFIRM:
- text_input_client_->ConfirmCompositionText();
- break;
- case ui::mojom::CompositionEventType::CLEAR:
- text_input_client_->ClearCompositionText();
- break;
- case ui::mojom::CompositionEventType::UPDATE:
- case ui::mojom::CompositionEventType::INSERT_TEXT:
- // TODO(moshayedi): crbug.com/631524. Implement these types of composition
- // events once we have the necessary fields in ui.mojom.CompositionEvent.
- NOTIMPLEMENTED();
- break;
- }
+void TextInputClientImpl::SetCompositionText(
+ const ui::CompositionText& composition) {
+ text_input_client_->SetCompositionText(composition);
+}
+
+void TextInputClientImpl::ConfirmCompositionText() {
+ text_input_client_->ConfirmCompositionText();
+}
+
+void TextInputClientImpl::ClearCompositionText() {
+ text_input_client_->ClearCompositionText();
+}
+
+void TextInputClientImpl::InsertText(const std::string& text) {
+ text_input_client_->InsertText(base::UTF8ToUTF16(text));
+}
+
+void TextInputClientImpl::InsertChar(std::unique_ptr<ui::Event> event) {
+ DCHECK(event->IsKeyEvent());
+ ui::KeyEvent* key_event = event->AsKeyEvent();
+ DCHECK(key_event->is_char());
+ text_input_client_->InsertChar(*key_event);
}
} // namespace aura
« no previous file with comments | « ui/aura/mus/text_input_client_impl.h ('k') | ui/base/ime/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698