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

Unified Diff: ppapi/cpp/text_input_controller.cc

Issue 18671004: PPAPI: Move IMEInputEvent and TextInput to stable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing one comment Created 7 years, 5 months 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 | « ppapi/cpp/text_input_controller.h ('k') | ppapi/examples/ime/ime.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/text_input_controller.cc
diff --git a/ppapi/cpp/text_input_controller.cc b/ppapi/cpp/text_input_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..851390bab5b1df518036a0c3d540bce34b5080c8
--- /dev/null
+++ b/ppapi/cpp/text_input_controller.cc
@@ -0,0 +1,63 @@
+// Copyright (c) 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
« no previous file with comments | « ppapi/cpp/text_input_controller.h ('k') | ppapi/examples/ime/ime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698