diff options
author | ericcheng@google.com <ericcheng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-26 01:27:35 +0000 |
---|---|---|
committer | ericcheng@google.com <ericcheng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-26 01:27:35 +0000 |
commit | 1cc87964e944939380107ed86107868344adb304 (patch) | |
tree | 0ea2ec036516062e51da919edb3af0604f6e2a3f /webkit/glue/cpp_variant.cc | |
parent | f3bb0346579cd4eb431c45e43041e139876015e8 (diff) | |
download | chromium_src-1cc87964e944939380107ed86107868344adb304.zip chromium_src-1cc87964e944939380107ed86107868344adb304.tar.gz chromium_src-1cc87964e944939380107ed86107868344adb304.tar.bz2 |
Some more glue code for the personalization module.
Added ability to invoke a method on an NPObject wrapped in
a CppVariant.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/cpp_variant.cc')
-rw-r--r-- | webkit/glue/cpp_variant.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/webkit/glue/cpp_variant.cc b/webkit/glue/cpp_variant.cc index a33986d..efa90e7 100644 --- a/webkit/glue/cpp_variant.cc +++ b/webkit/glue/cpp_variant.cc @@ -250,3 +250,17 @@ std::vector<std::wstring> CppVariant::ToStringVector() const { return wstring_vector; } +bool CppVariant::Invoke(const std::string& method, const CppVariant* args, + uint32 arg_count, CppVariant& result) const { + DCHECK(isObject()); + NPIdentifier method_name = NPN_GetStringIdentifier(method.c_str()); + NPObject* np_object = value.objectValue; + if (NPN_HasMethod(NULL, np_object, method_name)) { + NPVariant r; + bool status = NPN_Invoke(NULL, np_object, method_name, args, arg_count, &r); + result.Set(r); + return status; + } else { + return false; + } +} |