1 // Copyright (c) 2012 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/thunk/enter.h"
6 #include "ppapi/thunk/thunk.h"
7 #include "ppapi/thunk/ppb_instance_api.h"
14 void SetTextInputType(PP_Instance instance
, PP_TextInput_Type type
) {
15 EnterInstance
enter(instance
);
16 if (enter
.succeeded())
17 enter
.functions()->SetTextInputType(instance
, type
);
20 void UpdateCaretPosition(PP_Instance instance
,
22 const PP_Rect
* bounding_box
) {
23 EnterInstance
enter(instance
);
24 if (enter
.succeeded() && caret
&& bounding_box
)
25 enter
.functions()->UpdateCaretPosition(instance
, *caret
, *bounding_box
);
28 void CancelCompositionText(PP_Instance instance
) {
29 EnterInstance
enter(instance
);
30 if (enter
.succeeded())
31 enter
.functions()->CancelCompositionText(instance
);
34 void UpdateSurroundingText(PP_Instance instance
, const char* text
,
35 uint32_t caret
, uint32_t anchor
) {
36 EnterInstance
enter(instance
);
37 if (enter
.succeeded())
38 enter
.functions()->UpdateSurroundingText(instance
, text
, caret
, anchor
);
41 void SelectionChanged(PP_Instance instance
) {
42 EnterInstance
enter(instance
);
43 if (enter
.succeeded())
44 enter
.functions()->SelectionChanged(instance
);
47 const PPB_TextInput_Dev_0_1 g_ppb_textinput_0_1_thunk
= {
50 &CancelCompositionText
,
53 const PPB_TextInput_Dev g_ppb_textinput_0_2_thunk
= {
56 &CancelCompositionText
,
57 &UpdateSurroundingText
,
63 const PPB_TextInput_Dev_0_1
* GetPPB_TextInput_Dev_0_1_Thunk() {
64 return &g_ppb_textinput_0_1_thunk
;
67 const PPB_TextInput_Dev_0_2
* GetPPB_TextInput_Dev_0_2_Thunk() {
68 return &g_ppb_textinput_0_2_thunk
;