[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / ppapi / cpp / text_input_controller.cc
blob59850d31be0d25f7ae7bc1ebe8b839982ba603e0
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"
11 namespace pp {
13 namespace {
15 template <> const char* interface_name<PPB_TextInputController_1_0>() {
16 return PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0;
19 } // namespace
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,
51 uint32_t caret,
52 uint32_t anchor) {
53 if (has_interface<PPB_TextInputController_1_0>()) {
54 get_interface<PPB_TextInputController_1_0>()->UpdateSurroundingText(
55 instance_.pp_instance(),
56 text.pp_var(),
57 caret,
58 anchor);
63 } // namespace pp