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

Side by Side Diff: ppapi/proxy/ppb_ime_control_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
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_ime_control_proxy.h"
6
7 #include "ppapi/c/dev/ppb_ime_control_dev.h"
8 #include "ppapi/proxy/plugin_dispatcher.h"
9 #include "ppapi/proxy/plugin_resource_tracker.h"
10 #include "ppapi/proxy/ppapi_messages.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/thunk.h"
13 #include <stdio.h>
14
15 using ppapi::thunk::EnterFunctionNoLock;
16 using ppapi::thunk::PPB_IMEControl_FunctionAPI;
17
18 namespace ppapi {
19 namespace proxy {
20
21 namespace {
22
23 InterfaceProxy* CreateIMEControlProxy(Dispatcher* dispatcher,
24 const void* target_interface) {
25 return new PPB_IMEControl_Proxy(dispatcher, target_interface);
26 }
27
28 } // namespace
29
30 PPB_IMEControl_Proxy::PPB_IMEControl_Proxy(Dispatcher* dispatcher,
31 const void* target_interface)
32 : InterfaceProxy(dispatcher, target_interface) {
33 }
34
35 PPB_IMEControl_Proxy::~PPB_IMEControl_Proxy() {
36 }
37
38 // static
39 const InterfaceProxy::Info* PPB_IMEControl_Proxy::GetInfo() {
40 static const Info info = {
41 thunk::GetPPB_IMEControl_Thunk(),
42 PPB_IMECONTROL_DEV_INTERFACE,
43 INTERFACE_ID_PPB_IMECONTROL,
44 false,
45 &CreateIMEControlProxy,
46 };
47 return &info;
48 }
49
50 ppapi::thunk::PPB_IMEControl_FunctionAPI*
51 PPB_IMEControl_Proxy::AsPPB_IMEControl_FunctionAPI() {
52 return this;
53 }
54
55 void PPB_IMEControl_Proxy::SetTextInputType(PP_Instance instance,
56 PP_TextInput_Type type) {
57 dispatcher()->Send(new PpapiHostMsg_PPBIMEControl_SetTextInputType(
58 INTERFACE_ID_PPB_IMECONTROL, instance, type));
59 }
60
61 void PPB_IMEControl_Proxy::UpdateCaretPosition(PP_Instance instance,
62 PP_Rect caret,
63 PP_Rect boundingBox) {
64 dispatcher()->Send(new PpapiHostMsg_PPBIMEControl_UpdateCaretPosition(
65 INTERFACE_ID_PPB_IMECONTROL, instance, caret, boundingBox));
66 }
67
68 void PPB_IMEControl_Proxy::ConfirmCompositionText(PP_Instance instance) {
69 dispatcher()->Send(new PpapiHostMsg_PPBIMEControl_ConfirmCompositionText(
70 INTERFACE_ID_PPB_IMECONTROL, instance));
71 }
72
73 void PPB_IMEControl_Proxy::CancelCompositionText(PP_Instance instance) {
74 dispatcher()->Send(new PpapiHostMsg_PPBIMEControl_CancelCompositionText(
75 INTERFACE_ID_PPB_IMECONTROL, instance));
76 }
77
78 bool PPB_IMEControl_Proxy::OnMessageReceived(const IPC::Message& msg) {
79 bool handled = true;
80 IPC_BEGIN_MESSAGE_MAP(PPB_IMEControl_Proxy, msg)
81 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBIMEControl_SetTextInputType,
82 OnMsgSetTextInputType)
83 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBIMEControl_UpdateCaretPosition,
84 OnMsgUpdateCaretPosition)
85 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBIMEControl_ConfirmCompositionText,
86 OnMsgConfirmCompositionText)
87 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBIMEControl_CancelCompositionText,
88 OnMsgCancelCompositionText)
89 IPC_MESSAGE_UNHANDLED(handled = false)
90 IPC_END_MESSAGE_MAP()
91 return handled;
92 }
93
94 void PPB_IMEControl_Proxy::OnMsgSetTextInputType(PP_Instance instance,
95 PP_TextInput_Type type) {
96 EnterFunctionNoLock<PPB_IMEControl_FunctionAPI> enter(instance, true);
97 if (enter.succeeded())
98 enter.functions()->SetTextInputType(instance, type);
99 }
100
101 void PPB_IMEControl_Proxy::OnMsgUpdateCaretPosition(PP_Instance instance,
102 PP_Rect caret,
103 PP_Rect boundingBox) {
104 EnterFunctionNoLock<PPB_IMEControl_FunctionAPI> enter(instance, true);
105 if (enter.succeeded())
106 enter.functions()->UpdateCaretPosition(instance, caret,boundingBox);
107 }
108
109 void PPB_IMEControl_Proxy::OnMsgConfirmCompositionText(PP_Instance instance) {
110 EnterFunctionNoLock<PPB_IMEControl_FunctionAPI> enter(instance, true);
111 if (enter.succeeded())
112 enter.functions()->ConfirmCompositionText(instance);
113 }
114
115 void PPB_IMEControl_Proxy::OnMsgCancelCompositionText(PP_Instance instance) {
116 EnterFunctionNoLock<PPB_IMEControl_FunctionAPI> enter(instance, true);
117 if (enter.succeeded())
118 enter.functions()->CancelCompositionText(instance);
119 }
120
121 } // namespace proxy
122 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698