diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-30 00:35:33 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-30 00:35:33 +0000 |
commit | a3929294e9176abc6085d87cb2c6f8f8417b58f3 (patch) | |
tree | 82db7bd5e99b1ddcc4ab0efb9c43decf3698b92c /chrome/renderer | |
parent | 2da90e5f4e6deae2902ea1de2f4a76544885e1d8 (diff) | |
download | chromium_src-a3929294e9176abc6085d87cb2c6f8f8417b58f3.zip chromium_src-a3929294e9176abc6085d87cb2c6f8f8417b58f3.tar.gz chromium_src-a3929294e9176abc6085d87cb2c6f8f8417b58f3.tar.bz2 |
Continue eliminating direct NPN_ function calls that go from Chromium code to WebKit code. The long-term goal is to be able to link WebKit as a DLL.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/160310
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/external_host_bindings.cc | 30 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 6 |
2 files changed, 20 insertions, 16 deletions
diff --git a/chrome/renderer/external_host_bindings.cc b/chrome/renderer/external_host_bindings.cc index 108ee34..7aaf139 100644 --- a/chrome/renderer/external_host_bindings.cc +++ b/chrome/renderer/external_host_bindings.cc @@ -6,8 +6,11 @@ #include "base/values.h" #include "chrome/common/render_messages.h" +#include "webkit/api/public/WebBindings.h" #include "webkit/glue/webframe.h" +using WebKit::WebBindings; + ExternalHostBindings::ExternalHostBindings() : frame_(NULL) { BindMethod("postMessage", &ExternalHostBindings::postMessage); BindProperty("onmessage", &on_message_handler_); @@ -96,7 +99,7 @@ bool ExternalHostBindings::ForwardMessageFromExternalHost( NOTREACHED() << "CreateMessageEvent failed"; } else { NPIdentifier init_message_event = - NPN_GetStringIdentifier("initMessageEvent"); + WebBindings::getStringIdentifier("initMessageEvent"); NPVariant init_args[8]; STRINGN_TO_NPVARIANT("message", sizeof("message") - 1, init_args[0]); // type @@ -112,22 +115,23 @@ bool ExternalHostBindings::ForwardMessageFromExternalHost( NPVariant result; NULL_TO_NPVARIANT(result); - status = NPN_Invoke(NULL, event_obj, init_message_event, init_args, - arraysize(init_args), &result); + status = WebBindings::invoke(NULL, event_obj, init_message_event, init_args, + arraysize(init_args), &result); DCHECK(status) << "Failed to initialize MessageEvent"; - NPN_ReleaseVariantValue(&result); + WebBindings::releaseVariantValue(&result); if (status) { NPVariant event_arg; OBJECT_TO_NPVARIANT(event_obj, event_arg); - status = NPN_InvokeDefault(NULL, on_message_handler_.value.objectValue, - &event_arg, 1, &result); + status = WebBindings::invokeDefault(NULL, + on_message_handler_.value.objectValue, + &event_arg, 1, &result); // Don't DCHECK here in case the reason for the failure is a script error. DLOG_IF(ERROR, !status) << "NPN_InvokeDefault failed"; - NPN_ReleaseVariantValue(&result); + WebBindings::releaseVariantValue(&result); } - NPN_ReleaseObject(event_obj); + WebBindings::releaseObject(event_obj); } return status; @@ -149,11 +153,11 @@ bool ExternalHostBindings::CreateMessageEvent(NPObject** message_event) { }; NPIdentifier identifiers[arraysize(identifier_names)] = {0}; - NPN_GetStringIdentifiers(identifier_names, arraysize(identifier_names), - identifiers); + WebBindings::getStringIdentifiers(identifier_names, + arraysize(identifier_names), identifiers); CppVariant document; - bool ok = NPN_GetProperty(NULL, window, identifiers[0], &document); + bool ok = WebBindings::getProperty(NULL, window, identifiers[0], &document); DCHECK(document.isObject()); bool success = false; @@ -161,8 +165,8 @@ bool ExternalHostBindings::CreateMessageEvent(NPObject** message_event) { NPVariant result, event_type; STRINGN_TO_NPVARIANT("MessageEvent", sizeof("MessageEvent") - 1, \ event_type); - success = NPN_Invoke(NULL, document.value.objectValue, identifiers[1], - &event_type, 1, &result); + success = WebBindings::invoke(NULL, document.value.objectValue, + identifiers[1], &event_type, 1, &result); DCHECK(!success || result.type == NPVariantType_Object); if (result.type != NPVariantType_Object) { DCHECK(success == false); diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 5e6ba7a..868be43 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -194,7 +194,7 @@ void WebPluginDelegateProxy::PluginDestroyed() { // When we destroy the plugin instance, the NPObjectStub NULLs out its // pointer to the npobject (see NPObjectStub::OnChannelError). Therefore, // we release the object before destroying the instance to avoid leaking. - NPN_ReleaseObject(npobject_); + WebBindings::releaseObject(npobject_); npobject_ = NULL; } @@ -636,7 +636,7 @@ void WebPluginDelegateProxy::Print(gfx::NativeDrawingContext context) { NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { if (npobject_) - return NPN_RetainObject(npobject_); + return WebBindings::retainObject(npobject_); int route_id = MSG_ROUTING_NONE; intptr_t npobject_ptr; @@ -649,7 +649,7 @@ NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { channel_host_.get(), route_id, npobject_ptr, render_view_->modal_dialog_event(), page_url_); - return NPN_RetainObject(npobject_); + return WebBindings::retainObject(npobject_); } void WebPluginDelegateProxy::DidFinishLoadWithReason(NPReason reason) { |