diff options
author | zork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-15 23:43:42 +0000 |
---|---|---|
committer | zork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-15 23:43:42 +0000 |
commit | a9f4d90f8a1643ccc27aba95cf60c4531b3db7b9 (patch) | |
tree | 0f6069b618b1847b12cdba7d18e2ba8326073eed /chrome/plugin | |
parent | b2d85c6d595cd7b0b3807d2bb7849fee343d7394 (diff) | |
download | chromium_src-a9f4d90f8a1643ccc27aba95cf60c4531b3db7b9.zip chromium_src-a9f4d90f8a1643ccc27aba95cf60c4531b3db7b9.tar.gz chromium_src-a9f4d90f8a1643ccc27aba95cf60c4531b3db7b9.tar.bz2 |
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
Diffstat (limited to 'chrome/plugin')
-rw-r--r-- | chrome/plugin/chrome_plugin_host.cc | 24 |
1 files changed, 24 insertions, 0 deletions
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<const uint8*>(data); + std::vector<uint8> v(data_ptr, data_ptr + data_len); + std::vector<uint8> r; + if (!PluginThread::GetPluginThread()->Send( + new PluginProcessHostMsg_PluginSyncMessage(v, &r))) { + return CPERR_FAILURE; + } + + if (r.size()) { + *retval_len = static_cast<uint32>(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; |