Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: ppapi/thunk/ppb_text_input_thunk.cc

Issue 10170014: Move text input API to Instance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/thunk/enter.h" 5 #include "ppapi/thunk/enter.h"
6 #include "ppapi/thunk/thunk.h" 6 #include "ppapi/thunk/thunk.h"
7 #include "ppapi/thunk/ppb_text_input_api.h" 7 #include "ppapi/thunk/ppb_instance_api.h"
8 8
9 namespace ppapi { 9 namespace ppapi {
10 namespace thunk { 10 namespace thunk {
11 11
12 namespace { 12 namespace {
13 13
14 void SetTextInputType(PP_Instance instance, PP_TextInput_Type type) { 14 void SetTextInputType(PP_Instance instance, PP_TextInput_Type type) {
15 EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true); 15 EnterInstance enter(instance);
16 if (enter.succeeded()) 16 if (enter.succeeded())
17 enter.functions()->SetTextInputType(instance, type); 17 enter.functions()->SetTextInputType(instance, type);
18 } 18 }
19 19
20 void UpdateCaretPosition(PP_Instance instance, 20 void UpdateCaretPosition(PP_Instance instance,
21 const PP_Rect* caret, 21 const PP_Rect* caret,
22 const PP_Rect* bounding_box) { 22 const PP_Rect* bounding_box) {
23 EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true); 23 EnterInstance enter(instance);
24 if (enter.succeeded() && caret && bounding_box) 24 if (enter.succeeded() && caret && bounding_box)
25 enter.functions()->UpdateCaretPosition(instance, *caret, *bounding_box); 25 enter.functions()->UpdateCaretPosition(instance, *caret, *bounding_box);
26 } 26 }
27 27
28 void CancelCompositionText(PP_Instance instance) { 28 void CancelCompositionText(PP_Instance instance) {
29 EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true); 29 EnterInstance enter(instance);
30 if (enter.succeeded()) 30 if (enter.succeeded())
31 enter.functions()->CancelCompositionText(instance); 31 enter.functions()->CancelCompositionText(instance);
32 } 32 }
33 33
34 void UpdateSurroundingText(PP_Instance instance, const char* text, 34 void UpdateSurroundingText(PP_Instance instance, const char* text,
35 uint32_t caret, uint32_t anchor) { 35 uint32_t caret, uint32_t anchor) {
36 EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true); 36 EnterInstance enter(instance);
37 if (enter.succeeded()) 37 if (enter.succeeded())
38 enter.functions()->UpdateSurroundingText(instance, text, caret, anchor); 38 enter.functions()->UpdateSurroundingText(instance, text, caret, anchor);
39 } 39 }
40 40
41 void SelectionChanged(PP_Instance instance) { 41 void SelectionChanged(PP_Instance instance) {
42 EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true); 42 EnterInstance enter(instance);
43 if (enter.succeeded()) 43 if (enter.succeeded())
44 enter.functions()->SelectionChanged(instance); 44 enter.functions()->SelectionChanged(instance);
45 } 45 }
46 46
47 const PPB_TextInput_Dev_0_1 g_ppb_textinput_0_1_thunk = { 47 const PPB_TextInput_Dev_0_1 g_ppb_textinput_0_1_thunk = {
48 &SetTextInputType, 48 &SetTextInputType,
49 &UpdateCaretPosition, 49 &UpdateCaretPosition,
50 &CancelCompositionText, 50 &CancelCompositionText,
51 }; 51 };
52 52
(...skipping 10 matching lines...) Expand all
63 const PPB_TextInput_Dev_0_1* GetPPB_TextInput_Dev_0_1_Thunk() { 63 const PPB_TextInput_Dev_0_1* GetPPB_TextInput_Dev_0_1_Thunk() {
64 return &g_ppb_textinput_0_1_thunk; 64 return &g_ppb_textinput_0_1_thunk;
65 } 65 }
66 66
67 const PPB_TextInput_Dev_0_2* GetPPB_TextInput_Dev_0_2_Thunk() { 67 const PPB_TextInput_Dev_0_2* GetPPB_TextInput_Dev_0_2_Thunk() {
68 return &g_ppb_textinput_0_2_thunk; 68 return &g_ppb_textinput_0_2_thunk;
69 } 69 }
70 70
71 } // namespace thunk 71 } // namespace thunk
72 } // namespace ppapi 72 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698