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

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

Issue 7621010: Never submit: tentative Pepper IME. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: snapshot. Created 9 years, 3 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/plugin_resource_tracker.h"
9 #include "ppapi/proxy/ppapi_messages.h"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/thunk.h"
12 #include <stdio.h>
13
14 using ppapi::thunk::EnterFunctionNoLock;
15 using ppapi::thunk::PPB_TextInput_FunctionAPI;
16
17 namespace ppapi {
18 namespace proxy {
19
20 namespace {
21
22 InterfaceProxy* CreateTextInputProxy(Dispatcher* dispatcher,
23 const void* target_interface) {
24 return new PPB_TextInput_Proxy(dispatcher, target_interface);
25 }
26
27 } // namespace
28
29 PPB_TextInput_Proxy::PPB_TextInput_Proxy(Dispatcher* dispatcher,
30 const void* target_interface)
31 : InterfaceProxy(dispatcher, target_interface) {
32 }
33
34 PPB_TextInput_Proxy::~PPB_TextInput_Proxy() {
35 }
36
37 // static
38 const InterfaceProxy::Info* PPB_TextInput_Proxy::GetInfo() {
39 static const Info info = {
40 thunk::GetPPB_TextInput_Thunk(),
41 PPB_TEXTINPUT_DEV_INTERFACE,
42 INTERFACE_ID_PPB_TEXTINPUT,
43 false,
44 &CreateTextInputProxy,
45 };
46 return &info;
47 }
48
49 ppapi::thunk::PPB_TextInput_FunctionAPI*
50 PPB_TextInput_Proxy::AsPPB_TextInput_FunctionAPI() {
51 return this;
52 }
53
54 void PPB_TextInput_Proxy::SetTextInputType(PP_Instance instance,
55 PP_TextInput_Type type) {
56 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_SetTextInputType(
57 INTERFACE_ID_PPB_TEXTINPUT, instance, type));
58 }
59
60 void PPB_TextInput_Proxy::UpdateCaretPosition(PP_Instance instance,
61 const PP_Rect& caret,
62 const PP_Rect& boundingBox) {
63 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_UpdateCaretPosition(
64 INTERFACE_ID_PPB_TEXTINPUT, instance, caret, boundingBox));
65 }
66
67 void PPB_TextInput_Proxy::ConfirmCompositionText(PP_Instance instance) {
68 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_ConfirmCompositionText(
69 INTERFACE_ID_PPB_TEXTINPUT, instance));
70 }
71
72 void PPB_TextInput_Proxy::CancelCompositionText(PP_Instance instance) {
73 dispatcher()->Send(new PpapiHostMsg_PPBTextInput_CancelCompositionText(
74 INTERFACE_ID_PPB_TEXTINPUT, instance));
75 }
76
77 bool PPB_TextInput_Proxy::OnMessageReceived(const IPC::Message& msg) {
78 bool handled = true;
79 IPC_BEGIN_MESSAGE_MAP(PPB_TextInput_Proxy, msg)
80 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_SetTextInputType,
81 OnMsgSetTextInputType)
82 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_UpdateCaretPosition,
83 OnMsgUpdateCaretPosition)
84 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_ConfirmCompositionText,
85 OnMsgConfirmCompositionText)
86 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_CancelCompositionText,
87 OnMsgCancelCompositionText)
88 IPC_MESSAGE_UNHANDLED(handled = false)
89 IPC_END_MESSAGE_MAP()
90 return handled;
91 }
92
93 void PPB_TextInput_Proxy::OnMsgSetTextInputType(PP_Instance instance,
94 PP_TextInput_Type type) {
95 EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance, true);
96 if (enter.succeeded())
97 enter.functions()->SetTextInputType(instance, type);
98 }
99
100 void PPB_TextInput_Proxy::OnMsgUpdateCaretPosition(PP_Instance instance,
101 PP_Rect caret,
102 PP_Rect boundingBox) {
103 EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance, true);
104 if (enter.succeeded())
105 enter.functions()->UpdateCaretPosition(instance, caret, boundingBox);
106 }
107
108 void PPB_TextInput_Proxy::OnMsgConfirmCompositionText(PP_Instance instance) {
109 EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance, true);
110 if (enter.succeeded())
111 enter.functions()->ConfirmCompositionText(instance);
112 }
113
114 void PPB_TextInput_Proxy::OnMsgCancelCompositionText(PP_Instance instance) {
115 EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance, true);
116 if (enter.succeeded())
117 enter.functions()->CancelCompositionText(instance);
118 }
119
120 } // namespace proxy
121 } // 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