Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ozone / ui / ime / input_method_context_impl_wayland.cc
index 4680532..b15fda9 100644 (file)
@@ -5,7 +5,10 @@
 #include "ozone/ui/ime/input_method_context_impl_wayland.h"
 
 #include "base/logging.h"
+#include "base/strings/utf_string_conversions.h"
+#include "ozone/ui/events/event_factory_ozone_wayland.h"
 #include "ozone/ui/events/ime_state_change_handler.h"
+#include "ui/base/ime/composition_text.h"
 
 namespace ui {
 
@@ -13,6 +16,7 @@ InputMethodContextImplWayland::InputMethodContextImplWayland(
     LinuxInputMethodContextDelegate* delegate)
     : delegate_(delegate) {
   CHECK(delegate_);
+  ui::EventFactoryOzoneWayland::GetInstance()->SetIMEChangeObserver(this);
 }
 
 InputMethodContextImplWayland::~InputMethodContextImplWayland() {
@@ -44,4 +48,19 @@ void InputMethodContextImplWayland::OnCaretBoundsChanged(
   IMEStateChangeHandler::GetInstance()->ImeCaretBoundsChanged(caret_bounds);
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// InputMethodContextImplWayland, ui::LinuxInputMethodContext implementation:
+
+void InputMethodContextImplWayland::OnCommit(unsigned handle,
+                                             const std::string& text) {
+  delegate_->OnCommit(base::string16(base::ASCIIToUTF16(text.c_str())));
+}
+
+void InputMethodContextImplWayland::OnPreeditChanged(
+    unsigned handle, const std::string& text, const std::string& commit) {
+  ui::CompositionText composition_text;
+  composition_text.text = base::string16(base::ASCIIToUTF16(text.c_str()));
+  delegate_->OnPreeditChanged(composition_text);
+}
+
 }  // namespace ui