From a9f4d90f8a1643ccc27aba95cf60c4531b3db7b9 Mon Sep 17 00:00:00 2001 From: "zork@google.com" Date: Mon, 15 Sep 2008 23:43:42 +0000 Subject: Adding sync plugin messages, and plugin broadcasts to the renderer processes Review URL: http://codereview.chromium.org/2411 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2246 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/plugin/chrome_plugin_host.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'chrome/plugin') diff --git a/chrome/plugin/chrome_plugin_host.cc b/chrome/plugin/chrome_plugin_host.cc index 923b11f..ecc9418 100644 --- a/chrome/plugin/chrome_plugin_host.cc +++ b/chrome/plugin/chrome_plugin_host.cc @@ -492,6 +492,29 @@ CPError STDCALL CPB_SendMessage(CPID id, const void *data, uint32 data_len) { return CPERR_SUCCESS; } +CPError STDCALL CPB_SendSyncMessage(CPID id, const void *data, uint32 data_len, + void **retval, uint32 *retval_len) { + CHECK(ChromePluginLib::IsPluginThread()); + const uint8* data_ptr = static_cast(data); + std::vector v(data_ptr, data_ptr + data_len); + std::vector r; + if (!PluginThread::GetPluginThread()->Send( + new PluginProcessHostMsg_PluginSyncMessage(v, &r))) { + return CPERR_FAILURE; + } + + if (r.size()) { + *retval_len = static_cast(r.size()); + *retval = CPB_Alloc(*retval_len); + memcpy(*retval, &(r.at(0)), r.size()); + } else { + *retval = NULL; + *retval_len = 0; + } + + return CPERR_SUCCESS; +} + } // namespace CPBrowserFuncs* GetCPBrowserFuncsForPlugin() { @@ -520,6 +543,7 @@ CPBrowserFuncs* GetCPBrowserFuncsForPlugin() { browser_funcs.get_command_line_arguments = CPB_GetCommandLineArguments; browser_funcs.add_ui_command = CPB_AddUICommand; browser_funcs.handle_command = CPB_HandleCommand; + browser_funcs.send_sync_message = CPB_SendSyncMessage; browser_funcs.request_funcs = &request_funcs; browser_funcs.response_funcs = &response_funcs; -- cgit v1.1