| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 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 |
| 5 #include "ppapi/thunk/enter.h" |
| 6 #include "ppapi/thunk/ppb_text_input_api.h" |
| 7 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 8 #include "webkit/plugins/ppapi/resource_tracker.h" |
| 9 |
| 10 namespace ppapi { |
| 11 namespace thunk { |
| 12 |
| 13 namespace { |
| 14 |
| 15 void SetTextInputType(PP_Instance instance, PP_TextInput_Type type) { |
| 16 EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true); |
| 17 if (enter.succeeded()) |
| 18 enter.functions()->SetTextInputType(instance, type); |
| 19 } |
| 20 |
| 21 void UpdateCaretPosition(PP_Instance instance, |
| 22 const PP_Rect* caret, |
| 23 const PP_Rect* boundingBox) { |
| 24 EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true); |
| 25 if (enter.succeeded() && caret && boundingBox) |
| 26 enter.functions()->UpdateCaretPosition(instance, *caret, *boundingBox); |
| 27 } |
| 28 |
| 29 void ConfirmCompositionText(PP_Instance instance) { |
| 30 EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true); |
| 31 if (enter.succeeded()) |
| 32 enter.functions()->ConfirmCompositionText(instance); |
| 33 } |
| 34 |
| 35 void CancelCompositionText(PP_Instance instance) { |
| 36 EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true); |
| 37 if (enter.succeeded()) |
| 38 enter.functions()->CancelCompositionText(instance); |
| 39 } |
| 40 |
| 41 const PPB_TextInput_Dev g_ppb_textinput_thunk = { |
| 42 &SetTextInputType, |
| 43 &UpdateCaretPosition, |
| 44 &ConfirmCompositionText, |
| 45 &CancelCompositionText, |
| 46 }; |
| 47 |
| 48 } // namespace |
| 49 |
| 50 const PPB_TextInput_Dev* GetPPB_TextInput_Thunk() { |
| 51 return &g_ppb_textinput_thunk; |
| 52 } |
| 53 |
| 54 } // namespace thunk |
| 55 } // namespace ppapi |
| OLD | NEW |