Pepper_47_C++_interfaces
text_input_controller.cc
Go to the documentation of this file.
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.
4 
6 
8 #include "ppapi/cpp/rect.h"
9 #include "ppapi/cpp/var.h"
10 
11 namespace pp {
12 
13 namespace {
14 
15 template <> const char* interface_name<PPB_TextInputController_1_0>() {
16  return PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0;
17 }
18 
19 } // namespace
20 
21 
23  : instance_(instance) {
24 }
25 
27 }
28 
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);
33  }
34 }
35 
37  if (has_interface<PPB_TextInputController_1_0>()) {
38  get_interface<PPB_TextInputController_1_0>()->UpdateCaretPosition(
39  instance_.pp_instance(), &caret.pp_rect());
40  }
41 }
42 
44  if (has_interface<PPB_TextInputController_1_0>()) {
45  get_interface<PPB_TextInputController_1_0>()->CancelCompositionText(
46  instance_.pp_instance());
47  }
48 }
49 
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);
59  }
60 }
61 
62 
63 } // namespace pp
void UpdateSurroundingText(const Var &text, uint32_t caret, uint32_t anchor)
Definition: rect.h:19
const PP_Var & pp_var() const
Definition: var.h:226
void SetTextInputType(PP_TextInput_Type type)
void UpdateCaretPosition(const Rect &caret)
A generic type used for passing data types between the module and the page.
Definition: var.h:21
PP_Instance pp_instance() const
TextInputController(const InstanceHandle &instance)
const PP_Rect & pp_rect() const
Definition: rect.h:110