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 #ifndef PPAPI_CPP_TEXT_INPUT_CONTROLLER_H_
6 #define PPAPI_CPP_TEXT_INPUT_CONTROLLER_H_
10 #include "ppapi/c/ppb_text_input_controller.h"
11 #include "ppapi/cpp/instance_handle.h"
12 #include "ppapi/cpp/var.h"
15 /// This file defines the APIs for text input handling.
22 /// This class can be used for giving hints to the browser about the text input
23 /// status of plugins.
24 class TextInputController
{
26 /// A constructor for creating a <code>TextInputController</code>.
28 /// @param[in] instance The instance with which this resource will be
30 explicit TextInputController(const InstanceHandle
& instance
);
33 ~TextInputController();
35 /// SetTextInputType() informs the browser about the current text input mode
38 /// @param[in] type The type of text input type.
39 void SetTextInputType(PP_TextInput_Type type
);
41 /// UpdateCaretPosition() informs the browser about the coordinates of the
42 /// text input caret area.
44 /// @param[in] caret A rectangle indicating the caret area.
45 void UpdateCaretPosition(const Rect
& caret
);
47 /// CancelCompositionText() informs the browser that the current composition
48 /// text is cancelled by the plugin.
49 void CancelCompositionText();
51 /// UpdateSurroundingText() informs the browser about the current text
52 /// selection and surrounding text.
54 /// @param[in] text A UTF-8 sting indicating string buffer of current input
57 /// @param[in] caret A integer indicating the byte index of caret location in
58 /// <code>text</code>.
60 /// @param[in] caret A integer indicating the byte index of anchor location in
61 /// <code>text</code>. If there is no selection, this value should be equal to
62 /// <code>caret</code>.
63 void UpdateSurroundingText(const Var
& text
,
68 InstanceHandle instance_
;
73 #endif // PPAPI_CPP_TEXT_INPUT_CONTROLLER_H_