// 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() { 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()) { get_interface()->SetTextInputType( instance_.pp_instance(), type); } } void TextInputController::UpdateCaretPosition(const Rect& caret) { if (has_interface()) { get_interface()->UpdateCaretPosition( instance_.pp_instance(), &caret.pp_rect()); } } void TextInputController::CancelCompositionText() { if (has_interface()) { get_interface()->CancelCompositionText( instance_.pp_instance()); } } void TextInputController::UpdateSurroundingText(const Var& text, uint32_t caret, uint32_t anchor) { if (has_interface()) { get_interface()->UpdateSurroundingText( instance_.pp_instance(), text.pp_var(), caret, anchor); } } } // namespace pp