Don't announce clipboard events if the event target is not visible and focused.
[chromium-blink-merge.git] / ppapi / cpp / text_input_controller.h
blob8843bd362f26e6c1c6082c2f3b16670fd8405962
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_
8 #include <string>
10 #include "ppapi/c/ppb_text_input_controller.h"
11 #include "ppapi/cpp/instance_handle.h"
12 #include "ppapi/cpp/var.h"
14 /// @file
15 /// This file defines the APIs for text input handling.
17 namespace pp {
19 class Rect;
20 class Instance;
22 /// This class can be used for giving hints to the browser about the text input
23 /// status of plugins.
24 class TextInputController {
25 public:
26 /// A constructor for creating a <code>TextInputController</code>.
27 ///
28 /// @param[in] instance The instance with which this resource will be
29 /// associated.
30 explicit TextInputController(const InstanceHandle& instance);
32 /// Destructor.
33 ~TextInputController();
35 /// SetTextInputType() informs the browser about the current text input mode
36 /// of the plugin.
37 ///
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.
43 ///
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.
53 ///
54 /// @param[in] text A UTF-8 sting indicating string buffer of current input
55 /// context.
56 ///
57 /// @param[in] caret A integer indicating the byte index of caret location in
58 /// <code>text</code>.
59 ///
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,
64 uint32_t caret,
65 uint32_t anchor);
67 private:
68 InstanceHandle instance_;
71 } // namespace pp
73 #endif // PPAPI_CPP_TEXT_INPUT_CONTROLLER_H_