summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/text_input_controller.cc
diff options
context:
space:
mode:
authornona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-01 00:22:48 +0000
committernona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-01 00:22:48 +0000
commit79cad34f87841d010fd39023d369e406daef39f7 (patch)
tree4bf8330916574fe9fa103f92c381f77d36ffdf73 /ppapi/cpp/text_input_controller.cc
parent934e3c950dad11ddc4198005ea2bc5ec6df3a5ec (diff)
downloadchromium_src-79cad34f87841d010fd39023d369e406daef39f7.zip
chromium_src-79cad34f87841d010fd39023d369e406daef39f7.tar.gz
chromium_src-79cad34f87841d010fd39023d369e406daef39f7.tar.bz2
PPAPI: Move IMEInputEvent and TextInput to stable.
To be able to work with current ppapi Flash, this CL keeps ABI of "PPB_IMEInputEvent_Dev_0_2", "PPB_TextInput_Dev_0_2" and "PPP_TextInput_Dev_0_2". BUG=None TEST=Manually checked that ppapi_example_ime works and also works with current Flash. NOTRY=True Review URL: https://chromiumcodereview.appspot.com/18671004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/text_input_controller.cc')
-rw-r--r--ppapi/cpp/text_input_controller.cc63
1 files changed, 63 insertions, 0 deletions
diff --git a/ppapi/cpp/text_input_controller.cc b/ppapi/cpp/text_input_controller.cc
new file mode 100644
index 0000000..59850d3
--- /dev/null
+++ b/ppapi/cpp/text_input_controller.cc
@@ -0,0 +1,63 @@
+// Copyright 2013 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 "ppapi/cpp/text_input_controller.h"
+
+#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/rect.h"
+#include "ppapi/cpp/var.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_TextInputController_1_0>() {
+ return PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0;
+}
+
+} // namespace
+
+
+TextInputController::TextInputController(const InstanceHandle& instance)
+ : instance_(instance) {
+}
+
+TextInputController::~TextInputController() {
+}
+
+void TextInputController::SetTextInputType(PP_TextInput_Type type) {
+ if (has_interface<PPB_TextInputController_1_0>()) {
+ get_interface<PPB_TextInputController_1_0>()->SetTextInputType(
+ instance_.pp_instance(), type);
+ }
+}
+
+void TextInputController::UpdateCaretPosition(const Rect& caret) {
+ if (has_interface<PPB_TextInputController_1_0>()) {
+ get_interface<PPB_TextInputController_1_0>()->UpdateCaretPosition(
+ instance_.pp_instance(), &caret.pp_rect());
+ }
+}
+
+void TextInputController::CancelCompositionText() {
+ if (has_interface<PPB_TextInputController_1_0>()) {
+ get_interface<PPB_TextInputController_1_0>()->CancelCompositionText(
+ instance_.pp_instance());
+ }
+}
+
+void TextInputController::UpdateSurroundingText(const Var& text,
+ uint32_t caret,
+ uint32_t anchor) {
+ if (has_interface<PPB_TextInputController_1_0>()) {
+ get_interface<PPB_TextInputController_1_0>()->UpdateSurroundingText(
+ instance_.pp_instance(),
+ text.pp_var(),
+ caret,
+ anchor);
+ }
+}
+
+
+} // namespace pp