Android WebView: build debug/release based on variant.
[chromium-blink-merge.git] / ppapi / thunk / ppb_text_input_thunk.cc
blob7d35e2a799fbb3f8b1e1b54b14182fc49233798b
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"
9 namespace ppapi {
10 namespace thunk {
12 namespace {
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,
21 const PP_Rect* caret,
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 = {
48 &SetTextInputType,
49 &UpdateCaretPosition,
50 &CancelCompositionText,
53 const PPB_TextInput_Dev g_ppb_textinput_0_2_thunk = {
54 &SetTextInputType,
55 &UpdateCaretPosition,
56 &CancelCompositionText,
57 &UpdateSurroundingText,
58 &SelectionChanged,
61 } // namespace
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;
71 } // namespace thunk
72 } // namespace ppapi