summaryrefslogtreecommitdiffstats
path: root/content/plugin
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-04 10:39:23 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-04 10:39:23 +0000
commite6ae0f6c421776ee0a22af793469bd892876f9ee (patch)
tree4f43ac40627e7d8f7feb8b7ef84df057a70cc1e4 /content/plugin
parent75a82ff9193029ffc228b2ce0a5cdecc5ce728f3 (diff)
downloadchromium_src-e6ae0f6c421776ee0a22af793469bd892876f9ee.zip
chromium_src-e6ae0f6c421776ee0a22af793469bd892876f9ee.tar.gz
chromium_src-e6ae0f6c421776ee0a22af793469bd892876f9ee.tar.bz2
Send IME events to windowless plug-ins (Chromium side)
This change adds a new class WebPluginIMEWin that converts the platform-independent IME data sent from a renderer process (or WebKit) to the Win32 IME messages and send them to a plug-in. To allow the plug-in to retrieve the IME data with IMM32 function calls, this change also adds a patch to GetProcessAddress(). (Flash seems to retrieve the pointers to IMM32 function with this function.) This change also sends IME status retrieved from the plug-in to a browser process (via a renderer process). BUG=82507 TEST=manual Review URL: http://codereview.chromium.org/7082034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103869 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/plugin')
-rw-r--r--content/plugin/webplugin_delegate_stub.cc25
-rw-r--r--content/plugin/webplugin_delegate_stub.h7
-rw-r--r--content/plugin/webplugin_proxy.cc13
-rw-r--r--content/plugin/webplugin_proxy.h8
4 files changed, 53 insertions, 0 deletions
diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc
index dce1058..2d1037c 100644
--- a/content/plugin/webplugin_delegate_stub.cc
+++ b/content/plugin/webplugin_delegate_stub.cc
@@ -110,6 +110,12 @@ bool WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PluginMsg_SendJavaScriptStream,
OnSendJavaScriptStream)
IPC_MESSAGE_HANDLER(PluginMsg_SetContentAreaFocus, OnSetContentAreaFocus)
+#if defined(OS_WIN)
+ IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionUpdated,
+ OnImeCompositionUpdated)
+ IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionCompleted,
+ OnImeCompositionCompleted)
+#endif
#if defined(OS_MACOSX)
IPC_MESSAGE_HANDLER(PluginMsg_SetWindowFocus, OnSetWindowFocus)
IPC_MESSAGE_HANDLER(PluginMsg_ContainerHidden, OnContainerHidden)
@@ -324,6 +330,25 @@ void WebPluginDelegateStub::OnSetContentAreaFocus(bool has_focus) {
delegate_->SetContentAreaHasFocus(has_focus);
}
+#if defined(OS_WIN)
+void WebPluginDelegateStub::OnImeCompositionUpdated(
+ const string16& text,
+ const std::vector<int>& clauses,
+ const std::vector<int>& target,
+ int cursor_position) {
+ if (delegate_)
+ delegate_->ImeCompositionUpdated(text, clauses, target, cursor_position);
+#if defined(OS_WIN)
+ webplugin_->UpdateIMEStatus();
+#endif
+}
+
+void WebPluginDelegateStub::OnImeCompositionCompleted(const string16& text) {
+ if (delegate_)
+ delegate_->ImeCompositionCompleted(text);
+}
+#endif
+
#if defined(OS_MACOSX)
void WebPluginDelegateStub::OnSetWindowFocus(bool has_focus) {
if (delegate_)
diff --git a/content/plugin/webplugin_delegate_stub.h b/content/plugin/webplugin_delegate_stub.h
index 4a12b9a..a3be8a0 100644
--- a/content/plugin/webplugin_delegate_stub.h
+++ b/content/plugin/webplugin_delegate_stub.h
@@ -81,6 +81,13 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
void OnGetFormValue(string16* value, bool* success);
void OnSetContentAreaFocus(bool has_focus);
+#if defined(OS_WIN)
+ void OnImeCompositionUpdated(const string16& text,
+ const std::vector<int>& clauses,
+ const std::vector<int>& target,
+ int cursor_position);
+ void OnImeCompositionCompleted(const string16& text);
+#endif
#if defined(OS_MACOSX)
void OnSetWindowFocus(bool has_focus);
void OnContainerHidden();
diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc
index 2f7ef5f..4b167e1 100644
--- a/content/plugin/webplugin_proxy.cc
+++ b/content/plugin/webplugin_proxy.cc
@@ -747,3 +747,16 @@ void WebPluginProxy::ResourceClientDeleted(
void WebPluginProxy::URLRedirectResponse(bool allow, int resource_id) {
Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id));
}
+
+#if defined(OS_WIN)
+void WebPluginProxy::UpdateIMEStatus() {
+ // Retrieve the IME status from a plug-in and send it to a renderer process
+ // when the plug-in has updated it.
+ int input_type;
+ gfx::Rect caret_rect;
+ if (!delegate_->GetIMEStatus(&input_type, &caret_rect))
+ return;
+
+ Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect));
+}
+#endif
diff --git a/content/plugin/webplugin_proxy.h b/content/plugin/webplugin_proxy.h
index b6e3175..54f8894 100644
--- a/content/plugin/webplugin_proxy.h
+++ b/content/plugin/webplugin_proxy.h
@@ -168,6 +168,14 @@ class WebPluginProxy : public webkit::npapi::WebPlugin {
virtual void URLRedirectResponse(bool allow, int resource_id);
+#if defined(OS_WIN)
+ // Retrieves the IME status from a windowless plug-in and sends it to a
+ // renderer process. A renderer process will convert the coordinates from
+ // local to the window coordinates and send the converted coordinates to a
+ // browser process.
+ void UpdateIMEStatus();
+#endif
+
private:
bool Send(IPC::Message* msg);