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

Side by Side Diff: ppapi/proxy/ppb_text_input_proxy.cc

Issue 8769003: Pepper IME API for surrounding text retrieval. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge master. Created 8 years, 9 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
« no previous file with comments | « ppapi/proxy/ppb_text_input_proxy.h ('k') | ppapi/proxy/ppp_text_input_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/proxy/ppb_text_input_proxy.h" 5 #include "ppapi/proxy/ppb_text_input_proxy.h"
6 6
7 #include "ppapi/proxy/plugin_dispatcher.h" 7 #include "ppapi/proxy/plugin_dispatcher.h"
8 #include "ppapi/proxy/ppapi_messages.h" 8 #include "ppapi/proxy/ppapi_messages.h"
9 #include "ppapi/thunk/enter.h" 9 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/thunk.h" 10 #include "ppapi/thunk/thunk.h"
(...skipping 24 matching lines...) Expand all
35 const PP_Rect& bounding_box) { 35 const PP_Rect& bounding_box) {
36 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_UpdateCaretPosition( 36 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_UpdateCaretPosition(
37 API_ID_PPB_TEXT_INPUT, instance, caret, bounding_box)); 37 API_ID_PPB_TEXT_INPUT, instance, caret, bounding_box));
38 } 38 }
39 39
40 void PPB_TextInput_Proxy::CancelCompositionText(PP_Instance instance) { 40 void PPB_TextInput_Proxy::CancelCompositionText(PP_Instance instance) {
41 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_CancelCompositionText( 41 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_CancelCompositionText(
42 API_ID_PPB_TEXT_INPUT, instance)); 42 API_ID_PPB_TEXT_INPUT, instance));
43 } 43 }
44 44
45 void PPB_TextInput_Proxy::SelectionChanged(PP_Instance instance) {
46 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_SelectionChanged(
47 API_ID_PPB_TEXT_INPUT, instance));
48 }
49
50 void PPB_TextInput_Proxy::UpdateSurroundingText(PP_Instance instance,
51 const char* text,
52 uint32_t caret,
53 uint32_t anchor) {
54 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_UpdateSurroundingText(
55 API_ID_PPB_TEXT_INPUT, instance, text, caret, anchor));
56 }
57
45 bool PPB_TextInput_Proxy::OnMessageReceived(const IPC::Message& msg) { 58 bool PPB_TextInput_Proxy::OnMessageReceived(const IPC::Message& msg) {
46 bool handled = true; 59 bool handled = true;
47 IPC_BEGIN_MESSAGE_MAP(PPB_TextInput_Proxy, msg) 60 IPC_BEGIN_MESSAGE_MAP(PPB_TextInput_Proxy, msg)
48 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_SetTextInputType, 61 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_SetTextInputType,
49 OnMsgSetTextInputType) 62 OnMsgSetTextInputType)
50 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_UpdateCaretPosition, 63 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_UpdateCaretPosition,
51 OnMsgUpdateCaretPosition) 64 OnMsgUpdateCaretPosition)
52 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_CancelCompositionText, 65 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_CancelCompositionText,
53 OnMsgCancelCompositionText) 66 OnMsgCancelCompositionText)
67 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_SelectionChanged,
68 OnMsgSelectionChanged)
69 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_UpdateSurroundingText,
70 OnMsgUpdateSurroundingText)
54 IPC_MESSAGE_UNHANDLED(handled = false) 71 IPC_MESSAGE_UNHANDLED(handled = false)
55 IPC_END_MESSAGE_MAP() 72 IPC_END_MESSAGE_MAP()
56 return handled; 73 return handled;
57 } 74 }
58 75
59 void PPB_TextInput_Proxy::OnMsgSetTextInputType(PP_Instance instance, 76 void PPB_TextInput_Proxy::OnMsgSetTextInputType(PP_Instance instance,
60 PP_TextInput_Type type) { 77 PP_TextInput_Type type) {
61 ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance, 78 ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance,
62 true); 79 true);
63 if (enter.succeeded()) 80 if (enter.succeeded())
64 enter.functions()->SetTextInputType(instance, type); 81 enter.functions()->SetTextInputType(instance, type);
65 } 82 }
66 83
67 void PPB_TextInput_Proxy::OnMsgUpdateCaretPosition(PP_Instance instance, 84 void PPB_TextInput_Proxy::OnMsgUpdateCaretPosition(PP_Instance instance,
68 PP_Rect caret, 85 PP_Rect caret,
69 PP_Rect bounding_box) { 86 PP_Rect bounding_box) {
70 ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance, 87 ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance,
71 true); 88 true);
72 if (enter.succeeded()) 89 if (enter.succeeded())
73 enter.functions()->UpdateCaretPosition(instance, caret, bounding_box); 90 enter.functions()->UpdateCaretPosition(instance, caret, bounding_box);
74 } 91 }
75 92
76 void PPB_TextInput_Proxy::OnMsgCancelCompositionText(PP_Instance instance) { 93 void PPB_TextInput_Proxy::OnMsgCancelCompositionText(PP_Instance instance) {
77 ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance, 94 ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance,
78 true); 95 true);
79 if (enter.succeeded()) 96 if (enter.succeeded())
80 enter.functions()->CancelCompositionText(instance); 97 enter.functions()->CancelCompositionText(instance);
81 } 98 }
82 99
100 void PPB_TextInput_Proxy::OnMsgSelectionChanged(PP_Instance instance) {
101 ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance,
102 true);
103 if (enter.succeeded())
104 enter.functions()->SelectionChanged(instance);
105 }
106
107 void PPB_TextInput_Proxy::OnMsgUpdateSurroundingText(PP_Instance instance,
108 const std::string& text,
109 uint32_t caret,
110 uint32_t anchor) {
111 ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance,
112 true);
113 if (enter.succeeded())
114 enter.functions()->UpdateSurroundingText(instance,
115 text.c_str(), caret, anchor);
116 }
117
83 } // namespace proxy 118 } // namespace proxy
84 } // namespace ppapi 119 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_text_input_proxy.h ('k') | ppapi/proxy/ppp_text_input_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698