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

Unified Diff: webkit/plugins/npapi/webplugin_delegate_impl_win.cc

Issue 7082034: Send IME events to windowless plug-ins (Chromium side) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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
« no previous file with comments | « webkit/plugins/npapi/webplugin_delegate_impl.h ('k') | webkit/plugins/npapi/webplugin_ime_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/npapi/webplugin_delegate_impl_win.cc
===================================================================
--- webkit/plugins/npapi/webplugin_delegate_impl_win.cc (revision 103683)
+++ webkit/plugins/npapi/webplugin_delegate_impl_win.cc (working copy)
@@ -32,6 +32,7 @@
#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/npapi/plugin_stream_url.h"
#include "webkit/plugins/npapi/webplugin.h"
+#include "webkit/plugins/npapi/webplugin_ime_win.h"
using WebKit::WebCursorInfo;
using WebKit::WebKeyboardEvent;
@@ -86,6 +87,10 @@
base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_reg_enum_key_ex_w(
base::LINKER_INITIALIZED);
+// Helper object for patching the GetProcAddress API.
+base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_proc_address(
+ base::LINKER_INITIALIZED);
+
// Helper object for patching the GetKeyState API.
base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_key_state(
base::LINKER_INITIALIZED);
@@ -348,6 +353,7 @@
quirks_ |= PLUGIN_QUIRK_REPARENT_IN_BROWSER |
PLUGIN_QUIRK_PATCH_GETKEYSTATE;
}
+ quirks_ |= PLUGIN_QUIRK_EMULATE_IME;
} else if (filename == kAcrobatReaderPlugin) {
// Check for the version number above or equal 9.
int major_version = GetPluginMajorVersion(plugin_info);
@@ -488,6 +494,17 @@
WebPluginDelegateImpl::RegEnumKeyExWPatch);
}
+ // Flash retrieves the pointers to IMM32 functions with GetProcAddress() calls
+ // and use them to retrieve IME data. We add a patch to this function so we
+ // can dispatch these IMM32 calls to the WebPluginIMEWin class, which emulates
+ // IMM32 functions for Flash.
+ if (!g_iat_patch_get_proc_address.Pointer()->is_patched() &&
+ (quirks_ & PLUGIN_QUIRK_EMULATE_IME)) {
+ g_iat_patch_get_proc_address.Pointer()->Patch(
+ GetPluginPath().value().c_str(), "kernel32.dll", "GetProcAddress",
+ GetProcAddressPatch);
+ }
+
// Under UIPI the key state does not get forwarded properly to the child
// plugin window. So, instead we track the key state manually and intercept
// GetKeyState.
@@ -1482,6 +1499,41 @@
return rv;
}
+void WebPluginDelegateImpl::ImeCompositionUpdated(
+ const string16& text,
+ const std::vector<int>& clauses,
+ const std::vector<int>& target,
+ int cursor_position) {
+ if (!plugin_ime_.get())
+ plugin_ime_.reset(new WebPluginIMEWin);
+
+ plugin_ime_->CompositionUpdated(text, clauses, target, cursor_position);
+ plugin_ime_->SendEvents(instance());
+}
+
+void WebPluginDelegateImpl::ImeCompositionCompleted(const string16& text) {
+ if (!plugin_ime_.get())
+ plugin_ime_.reset(new WebPluginIMEWin);
+ plugin_ime_->CompositionCompleted(text);
+ plugin_ime_->SendEvents(instance());
+}
+
+bool WebPluginDelegateImpl::GetIMEStatus(int* input_type,
+ gfx::Rect* caret_rect) {
+ if (!plugin_ime_.get())
+ return false;
+ return plugin_ime_->GetStatus(input_type, caret_rect);
+}
+
+// static
+FARPROC WINAPI WebPluginDelegateImpl::GetProcAddressPatch(HMODULE module,
+ LPCSTR name) {
+ FARPROC imm_function = WebPluginIMEWin::GetProcAddress(name);
+ if (imm_function)
+ return imm_function;
+ return ::GetProcAddress(module, name);
+}
+
void WebPluginDelegateImpl::HandleCaptureForMessage(HWND window,
UINT message) {
if (!WebPluginDelegateImpl::IsPluginDelegateWindow(window))
« no previous file with comments | « webkit/plugins/npapi/webplugin_delegate_impl.h ('k') | webkit/plugins/npapi/webplugin_ime_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698