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

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

Issue 8059006: Additional update on Pepper IME API and boilerplate thunk/proxy implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make win_shared happy. Created 9 years, 2 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/shared_impl/function_group_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/proxy/ppb_text_input_proxy.h"
6
7 #include "ppapi/proxy/plugin_dispatcher.h"
8 #include "ppapi/proxy/ppapi_messages.h"
9 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/thunk.h"
11
12 namespace ppapi {
13 namespace proxy {
14
15 PPB_TextInput_Proxy::PPB_TextInput_Proxy(Dispatcher* dispatcher)
16 : InterfaceProxy(dispatcher) {
17 }
18
19 PPB_TextInput_Proxy::~PPB_TextInput_Proxy() {
20 }
21
22 ppapi::thunk::PPB_TextInput_FunctionAPI*
23 PPB_TextInput_Proxy::AsPPB_TextInput_FunctionAPI() {
24 return this;
25 }
26
27 void PPB_TextInput_Proxy::SetTextInputType(PP_Instance instance,
28 PP_TextInput_Type type) {
29 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_SetTextInputType(
30 INTERFACE_ID_PPB_TEXT_INPUT, instance, type));
31 }
32
33 void PPB_TextInput_Proxy::UpdateCaretPosition(PP_Instance instance,
34 const PP_Rect& caret,
35 const PP_Rect& bounding_box) {
36 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_UpdateCaretPosition(
37 INTERFACE_ID_PPB_TEXT_INPUT, instance, caret, bounding_box));
38 }
39
40 void PPB_TextInput_Proxy::CancelCompositionText(PP_Instance instance) {
41 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_CancelCompositionText(
42 INTERFACE_ID_PPB_TEXT_INPUT, instance));
43 }
44
45 bool PPB_TextInput_Proxy::OnMessageReceived(const IPC::Message& msg) {
46 bool handled = true;
47 IPC_BEGIN_MESSAGE_MAP(PPB_TextInput_Proxy, msg)
48 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_SetTextInputType,
49 OnMsgSetTextInputType)
50 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_UpdateCaretPosition,
51 OnMsgUpdateCaretPosition)
52 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_CancelCompositionText,
53 OnMsgCancelCompositionText)
54 IPC_MESSAGE_UNHANDLED(handled = false)
55 IPC_END_MESSAGE_MAP()
56 return handled;
57 }
58
59 void PPB_TextInput_Proxy::OnMsgSetTextInputType(PP_Instance instance,
60 PP_TextInput_Type type) {
61 ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance,
62 true);
63 if (enter.succeeded())
64 enter.functions()->SetTextInputType(instance, type);
65 }
66
67 void PPB_TextInput_Proxy::OnMsgUpdateCaretPosition(PP_Instance instance,
68 PP_Rect caret,
69 PP_Rect bounding_box) {
70 ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance,
71 true);
72 if (enter.succeeded())
73 enter.functions()->UpdateCaretPosition(instance, caret, bounding_box);
74 }
75
76 void PPB_TextInput_Proxy::OnMsgCancelCompositionText(PP_Instance instance) {
77 ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance,
78 true);
79 if (enter.succeeded())
80 enter.functions()->CancelCompositionText(instance);
81 }
82
83 } // namespace proxy
84 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_text_input_proxy.h ('k') | ppapi/shared_impl/function_group_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698