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

Unified Diff: chrome/plugin/npobject_stub.cc

Issue 113823: Added support for constructor calls in the NPAPI (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 | « chrome/plugin/npobject_stub.h ('k') | webkit/port/bindings/v8/NPV8Object.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/plugin/npobject_stub.cc
===================================================================
--- chrome/plugin/npobject_stub.cc (revision 16974)
+++ chrome/plugin/npobject_stub.cc (working copy)
@@ -64,6 +64,7 @@
IPC_MESSAGE_HANDLER(NPObjectMsg_RemoveProperty, OnRemoveProperty);
IPC_MESSAGE_HANDLER(NPObjectMsg_Invalidate, OnInvalidate);
IPC_MESSAGE_HANDLER(NPObjectMsg_Enumeration, OnEnumeration);
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Construct, OnConstruct);
IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Evaluate, OnEvaluate);
IPC_MESSAGE_HANDLER(NPObjectMsg_SetException, OnSetException);
IPC_MESSAGE_UNHANDLED_ERROR()
@@ -267,6 +268,45 @@
NPN_MemFree(value_np);
}
+void NPObjectStub::OnConstruct(const std::vector<NPVariant_Param>& args,
+ IPC::Message* reply_msg) {
+ scoped_refptr<PluginChannelBase> local_channel = channel_;
+ bool return_value = false;
+ NPVariant_Param result_param;
+ NPVariant result_var;
+
+ VOID_TO_NPVARIANT(result_var);
+
+ int arg_count = static_cast<int>(args.size());
+ NPVariant* args_var = new NPVariant[arg_count];
+ for (int i = 0; i < arg_count; ++i) {
+ CreateNPVariant(
+ args[i], local_channel, &(args_var[i]), modal_dialog_event_);
+ }
+
+ if (IsPluginProcess()) {
+ if (npobject_->_class->construct) {
+ return_value = npobject_->_class->construct(
+ npobject_, args_var, arg_count, &result_var);
+ } else {
+ return_value = false;
+ }
+ } else {
+ return_value = NPN_Construct(
+ 0, npobject_, args_var, arg_count, &result_var);
+ }
+
+ for (int i = 0; i < arg_count; ++i)
+ NPN_ReleaseVariantValue(&(args_var[i]));
+
+ delete[] args_var;
+
+ CreateNPVariantParam(
+ result_var, local_channel, &result_param, true, modal_dialog_event_);
+ NPObjectMsg_Invoke::WriteReplyParams(reply_msg, result_param, return_value);
+ local_channel->Send(reply_msg);
+}
+
void NPObjectStub::OnEvaluate(const std::string& script,
bool popups_allowed,
IPC::Message* reply_msg) {
« no previous file with comments | « chrome/plugin/npobject_stub.h ('k') | webkit/port/bindings/v8/NPV8Object.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698