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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/proxy/ppb_ime_control_proxy.cc
diff --git a/ppapi/proxy/ppb_ime_control_proxy.cc b/ppapi/proxy/ppb_ime_control_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1cf4d8f4363e2c191173953d9fe00fc0c01dcbab
--- /dev/null
+++ b/ppapi/proxy/ppb_ime_control_proxy.cc
@@ -0,0 +1,122 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/ppb_ime_control_proxy.h"
+
+#include "ppapi/c/dev/ppb_ime_control_dev.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/plugin_resource_tracker.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+#include <stdio.h>
+
+using ppapi::thunk::EnterFunctionNoLock;
+using ppapi::thunk::PPB_IMEControl_FunctionAPI;
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+InterfaceProxy* CreateIMEControlProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_IMEControl_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
+PPB_IMEControl_Proxy::PPB_IMEControl_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_IMEControl_Proxy::~PPB_IMEControl_Proxy() {
+}
+
+// static
+const InterfaceProxy::Info* PPB_IMEControl_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_IMEControl_Thunk(),
+ PPB_IMECONTROL_DEV_INTERFACE,
+ INTERFACE_ID_PPB_IMECONTROL,
+ false,
+ &CreateIMEControlProxy,
+ };
+ return &info;
+}
+
+ppapi::thunk::PPB_IMEControl_FunctionAPI*
+PPB_IMEControl_Proxy::AsPPB_IMEControl_FunctionAPI() {
+ return this;
+}
+
+void PPB_IMEControl_Proxy::SetTextInputType(PP_Instance instance,
+ PP_TextInput_Type type) {
+ dispatcher()->Send(new PpapiHostMsg_PPBIMEControl_SetTextInputType(
+ INTERFACE_ID_PPB_IMECONTROL, instance, type));
+}
+
+void PPB_IMEControl_Proxy::UpdateCaretPosition(PP_Instance instance,
+ PP_Rect caret,
+ PP_Rect boundingBox) {
+ dispatcher()->Send(new PpapiHostMsg_PPBIMEControl_UpdateCaretPosition(
+ INTERFACE_ID_PPB_IMECONTROL, instance, caret, boundingBox));
+}
+
+void PPB_IMEControl_Proxy::ConfirmCompositionText(PP_Instance instance) {
+ dispatcher()->Send(new PpapiHostMsg_PPBIMEControl_ConfirmCompositionText(
+ INTERFACE_ID_PPB_IMECONTROL, instance));
+}
+
+void PPB_IMEControl_Proxy::CancelCompositionText(PP_Instance instance) {
+ dispatcher()->Send(new PpapiHostMsg_PPBIMEControl_CancelCompositionText(
+ INTERFACE_ID_PPB_IMECONTROL, instance));
+}
+
+bool PPB_IMEControl_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(PPB_IMEControl_Proxy, msg)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBIMEControl_SetTextInputType,
+ OnMsgSetTextInputType)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBIMEControl_UpdateCaretPosition,
+ OnMsgUpdateCaretPosition)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBIMEControl_ConfirmCompositionText,
+ OnMsgConfirmCompositionText)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBIMEControl_CancelCompositionText,
+ OnMsgCancelCompositionText)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void PPB_IMEControl_Proxy::OnMsgSetTextInputType(PP_Instance instance,
+ PP_TextInput_Type type) {
+ EnterFunctionNoLock<PPB_IMEControl_FunctionAPI> enter(instance, true);
+ if (enter.succeeded())
+ enter.functions()->SetTextInputType(instance, type);
+}
+
+void PPB_IMEControl_Proxy::OnMsgUpdateCaretPosition(PP_Instance instance,
+ PP_Rect caret,
+ PP_Rect boundingBox) {
+ EnterFunctionNoLock<PPB_IMEControl_FunctionAPI> enter(instance, true);
+ if (enter.succeeded())
+ enter.functions()->UpdateCaretPosition(instance, caret,boundingBox);
+}
+
+void PPB_IMEControl_Proxy::OnMsgConfirmCompositionText(PP_Instance instance) {
+ EnterFunctionNoLock<PPB_IMEControl_FunctionAPI> enter(instance, true);
+ if (enter.succeeded())
+ enter.functions()->ConfirmCompositionText(instance);
+}
+
+void PPB_IMEControl_Proxy::OnMsgCancelCompositionText(PP_Instance instance) {
+ EnterFunctionNoLock<PPB_IMEControl_FunctionAPI> enter(instance, true);
+ if (enter.succeeded())
+ enter.functions()->CancelCompositionText(instance);
+}
+
+} // namespace proxy
+} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698