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

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

Issue 18671004: PPAPI: Move IMEInputEvent and TextInput to stable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments Created 7 years, 5 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_instance_api.h" 7 #include "ppapi/thunk/ppb_instance_api.h"
8 8
9 // This struct is for ABI compatibility for PPAPI Flash and PDF plugin.
10 // TODO(nona): Remove once Flash and PDF plugin support TextInput1.0.
11 struct PPB_TextInput_Dev_0_2 {
12 void (*SetTextInputType)(PP_Instance instance, PP_TextInput_Type type);
13 void (*UpdateCaretPosition)(PP_Instance instance,
14 const struct PP_Rect* caret,
15 const struct PP_Rect* bounding_box);
16 void (*CancelCompositionText)(PP_Instance instance);
17 void (*UpdateSurroundingText)(PP_Instance instance,
18 const char* text,
19 uint32_t caret,
20 uint32_t anchor);
21 void (*SelectionChanged)(PP_Instance instance);
22 };
23
9 namespace ppapi { 24 namespace ppapi {
10 namespace thunk { 25 namespace thunk {
11 26
12 namespace { 27 namespace {
13 28
14 void SetTextInputType(PP_Instance instance, PP_TextInput_Type type) { 29 void SetTextInputType(PP_Instance instance, PP_TextInput_Type type) {
15 EnterInstance enter(instance); 30 EnterInstance enter(instance);
16 if (enter.succeeded()) 31 if (enter.succeeded())
17 enter.functions()->SetTextInputType(instance, type); 32 enter.functions()->SetTextInputType(instance, type);
18 } 33 }
(...skipping 18 matching lines...) Expand all
37 if (enter.succeeded()) 52 if (enter.succeeded())
38 enter.functions()->UpdateSurroundingText(instance, text, caret, anchor); 53 enter.functions()->UpdateSurroundingText(instance, text, caret, anchor);
39 } 54 }
40 55
41 void SelectionChanged(PP_Instance instance) { 56 void SelectionChanged(PP_Instance instance) {
42 EnterInstance enter(instance); 57 EnterInstance enter(instance);
43 if (enter.succeeded()) 58 if (enter.succeeded())
44 enter.functions()->SelectionChanged(instance); 59 enter.functions()->SelectionChanged(instance);
45 } 60 }
46 61
47 const PPB_TextInput_Dev_0_1 g_ppb_textinput_0_1_thunk = { 62 const PPB_TextInput g_ppb_textinput_1_0_thunk = {
48 &SetTextInputType, 63 &SetTextInputType,
49 &UpdateCaretPosition, 64 &UpdateCaretPosition,
50 &CancelCompositionText, 65 &CancelCompositionText,
66 &UpdateSurroundingText,
67 &SelectionChanged,
51 }; 68 };
52 69
53 const PPB_TextInput_Dev g_ppb_textinput_0_2_thunk = { 70 // TODO(nona): Remove once Flash and PDF support TextInput1.0.
71 const PPB_TextInput_Dev_0_2 g_ppb_textinput_dev_0_2_thunk = {
54 &SetTextInputType, 72 &SetTextInputType,
55 &UpdateCaretPosition, 73 &UpdateCaretPosition,
56 &CancelCompositionText, 74 &CancelCompositionText,
57 &UpdateSurroundingText, 75 &UpdateSurroundingText,
58 &SelectionChanged, 76 &SelectionChanged,
59 }; 77 };
60 78
61 } // namespace 79 } // namespace
62 80
63 const PPB_TextInput_Dev_0_1* GetPPB_TextInput_Dev_0_1_Thunk() { 81 const PPB_TextInput* GetPPB_TextInput_1_0_Thunk() {
64 return &g_ppb_textinput_0_1_thunk; 82 return &g_ppb_textinput_1_0_thunk;
65 } 83 }
66 84
85 // TODO(nona): Remove once Flash and PDF support TextInput1.0.
67 const PPB_TextInput_Dev_0_2* GetPPB_TextInput_Dev_0_2_Thunk() { 86 const PPB_TextInput_Dev_0_2* GetPPB_TextInput_Dev_0_2_Thunk() {
68 return &g_ppb_textinput_0_2_thunk; 87 return &g_ppb_textinput_dev_0_2_thunk;
69 } 88 }
70 89
71 } // namespace thunk 90 } // namespace thunk
72 } // namespace ppapi 91 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698