1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ppapi/cpp/text_input_controller.h"
7 #include "ppapi/cpp/module_impl.h"
8 #include "ppapi/cpp/rect.h"
9 #include "ppapi/cpp/var.h"
15 template <> const char* interface_name
<PPB_TextInputController_1_0
>() {
16 return PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0
;
22 TextInputController::TextInputController(const InstanceHandle
& instance
)
23 : instance_(instance
) {
26 TextInputController::~TextInputController() {
29 void TextInputController::SetTextInputType(PP_TextInput_Type type
) {
30 if (has_interface
<PPB_TextInputController_1_0
>()) {
31 get_interface
<PPB_TextInputController_1_0
>()->SetTextInputType(
32 instance_
.pp_instance(), type
);
36 void TextInputController::UpdateCaretPosition(const Rect
& caret
) {
37 if (has_interface
<PPB_TextInputController_1_0
>()) {
38 get_interface
<PPB_TextInputController_1_0
>()->UpdateCaretPosition(
39 instance_
.pp_instance(), &caret
.pp_rect());
43 void TextInputController::CancelCompositionText() {
44 if (has_interface
<PPB_TextInputController_1_0
>()) {
45 get_interface
<PPB_TextInputController_1_0
>()->CancelCompositionText(
46 instance_
.pp_instance());
50 void TextInputController::UpdateSurroundingText(const Var
& text
,
53 if (has_interface
<PPB_TextInputController_1_0
>()) {
54 get_interface
<PPB_TextInputController_1_0
>()->UpdateSurroundingText(
55 instance_
.pp_instance(),