summaryrefslogtreecommitdiffstats
path: root/chrome/plugin/chrome_plugin_host.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/plugin/chrome_plugin_host.cc')
-rw-r--r--chrome/plugin/chrome_plugin_host.cc24
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;