Index: content/renderer/pepper/pepper_webplugin_impl.cc |
diff --git a/content/renderer/pepper/pepper_webplugin_impl.cc b/content/renderer/pepper/pepper_webplugin_impl.cc |
index 828da7a3d87a5209ac1c1e2bceaa0cc7f19b6af1..737eff8b772b50cf559057e5c1b4bd5691159e4a 100644 |
--- a/content/renderer/pepper/pepper_webplugin_impl.cc |
+++ b/content/renderer/pepper/pepper_webplugin_impl.cc |
@@ -11,9 +11,9 @@ |
#include "content/public/common/page_zoom.h" |
#include "content/public/renderer/content_renderer_client.h" |
#include "content/renderer/pepper/message_channel.h" |
-#include "content/renderer/pepper/npobject_var.h" |
#include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
#include "content/renderer/pepper/plugin_module.h" |
+#include "content/renderer/pepper/v8object_var.h" |
#include "content/renderer/render_frame_impl.h" |
#include "ppapi/shared_impl/ppapi_globals.h" |
#include "ppapi/shared_impl/var_tracker.h" |
@@ -31,7 +31,7 @@ |
#include "third_party/WebKit/public/web/WebPrintScalingOption.h" |
#include "url/gurl.h" |
-using ppapi::NPObjectVar; |
+using ppapi::V8ObjectVar; |
using blink::WebCanvas; |
using blink::WebPlugin; |
using blink::WebPluginContainer; |
@@ -126,30 +126,32 @@ void PepperWebPluginImpl::destroy() { |
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
} |
-NPObject* PepperWebPluginImpl::scriptableObject() { |
+bool PepperWebPluginImpl::getScriptableObject(v8::Isolate* isolate, |
+ v8::Local<v8::Object>* object) { |
// Call through the plugin to get its instance object. The plugin should pass |
// us a reference which we release in destroy(). |
if (instance_object_.type == PP_VARTYPE_UNDEFINED) |
- instance_object_ = instance_->GetInstanceObject(); |
+ instance_object_ = instance_->GetInstanceObject(isolate); |
// GetInstanceObject talked to the plugin which may have removed the instance |
// from the DOM, in which case instance_ would be NULL now. |
if (!instance_.get()) |
- return NULL; |
+ return false; |
- scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(instance_object_)); |
+ scoped_refptr<V8ObjectVar> object_var( |
+ V8ObjectVar::FromPPVar(instance_object_)); |
// If there's an InstanceObject, tell the Instance's MessageChannel to pass |
// any non-postMessage calls to it. |
- if (object.get()) { |
- instance_->message_channel().SetPassthroughObject(object->np_object()); |
+ if (object_var.get()) { |
+ instance_->GetMessageChannel()->SetPassthroughObject( |
+ object_var->GetHandle()); |
} |
- NPObject* message_channel_np_object(instance_->message_channel().np_object()); |
- // The object is expected to be retained before it is returned. |
- blink::WebBindings::retainObject(message_channel_np_object); |
- return message_channel_np_object; |
+ v8::Handle<v8::Object> result = instance_->GetMessageChannelObject(); |
+ if (result.IsEmpty()) |
+ return false; |
+ *object = result; |
+ return true; |
} |
-NPP PepperWebPluginImpl::pluginNPP() { return instance_->instanceNPP(); } |
- |
bool PepperWebPluginImpl::getFormValue(WebString& value) { return false; } |
void PepperWebPluginImpl::paint(WebCanvas* canvas, const WebRect& rect) { |