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

Side by Side Diff: content/renderer/pepper/pepper_webplugin_impl.cc

Issue 537483002: Revert of Replace NPObject usage in ppapi with gin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/pepper/pepper_webplugin_impl.h" 5 #include "content/renderer/pepper/pepper_webplugin_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "content/public/common/page_zoom.h" 11 #include "content/public/common/page_zoom.h"
12 #include "content/public/renderer/content_renderer_client.h" 12 #include "content/public/renderer/content_renderer_client.h"
13 #include "content/renderer/pepper/message_channel.h" 13 #include "content/renderer/pepper/message_channel.h"
14 #include "content/renderer/pepper/npobject_var.h"
14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 15 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
15 #include "content/renderer/pepper/plugin_module.h" 16 #include "content/renderer/pepper/plugin_module.h"
16 #include "content/renderer/pepper/v8object_var.h"
17 #include "content/renderer/render_frame_impl.h" 17 #include "content/renderer/render_frame_impl.h"
18 #include "ppapi/shared_impl/ppapi_globals.h" 18 #include "ppapi/shared_impl/ppapi_globals.h"
19 #include "ppapi/shared_impl/var_tracker.h" 19 #include "ppapi/shared_impl/var_tracker.h"
20 #include "third_party/WebKit/public/platform/WebPoint.h" 20 #include "third_party/WebKit/public/platform/WebPoint.h"
21 #include "third_party/WebKit/public/platform/WebRect.h" 21 #include "third_party/WebKit/public/platform/WebRect.h"
22 #include "third_party/WebKit/public/platform/WebSize.h" 22 #include "third_party/WebKit/public/platform/WebSize.h"
23 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" 23 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
24 #include "third_party/WebKit/public/web/WebBindings.h" 24 #include "third_party/WebKit/public/web/WebBindings.h"
25 #include "third_party/WebKit/public/web/WebDocument.h" 25 #include "third_party/WebKit/public/web/WebDocument.h"
26 #include "third_party/WebKit/public/web/WebElement.h" 26 #include "third_party/WebKit/public/web/WebElement.h"
27 #include "third_party/WebKit/public/web/WebFrame.h" 27 #include "third_party/WebKit/public/web/WebFrame.h"
28 #include "third_party/WebKit/public/web/WebPluginContainer.h" 28 #include "third_party/WebKit/public/web/WebPluginContainer.h"
29 #include "third_party/WebKit/public/web/WebPluginParams.h" 29 #include "third_party/WebKit/public/web/WebPluginParams.h"
30 #include "third_party/WebKit/public/web/WebPrintParams.h" 30 #include "third_party/WebKit/public/web/WebPrintParams.h"
31 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" 31 #include "third_party/WebKit/public/web/WebPrintScalingOption.h"
32 #include "url/gurl.h" 32 #include "url/gurl.h"
33 33
34 using ppapi::V8ObjectVar; 34 using ppapi::NPObjectVar;
35 using blink::WebCanvas; 35 using blink::WebCanvas;
36 using blink::WebPlugin; 36 using blink::WebPlugin;
37 using blink::WebPluginContainer; 37 using blink::WebPluginContainer;
38 using blink::WebPluginParams; 38 using blink::WebPluginParams;
39 using blink::WebPoint; 39 using blink::WebPoint;
40 using blink::WebPrintParams; 40 using blink::WebPrintParams;
41 using blink::WebRect; 41 using blink::WebRect;
42 using blink::WebSize; 42 using blink::WebSize;
43 using blink::WebString; 43 using blink::WebString;
44 using blink::WebURL; 44 using blink::WebURL;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (instance_.get()) { 119 if (instance_.get()) {
120 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_); 120 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_);
121 instance_object_ = PP_MakeUndefined(); 121 instance_object_ = PP_MakeUndefined();
122 instance_->Delete(); 122 instance_->Delete();
123 instance_ = NULL; 123 instance_ = NULL;
124 } 124 }
125 125
126 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 126 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
127 } 127 }
128 128
129 v8::Local<v8::Object> PepperWebPluginImpl::v8ScriptableObject( 129 NPObject* PepperWebPluginImpl::scriptableObject() {
130 v8::Isolate* isolate) {
131 // Call through the plugin to get its instance object. The plugin should pass 130 // Call through the plugin to get its instance object. The plugin should pass
132 // us a reference which we release in destroy(). 131 // us a reference which we release in destroy().
133 if (instance_object_.type == PP_VARTYPE_UNDEFINED) 132 if (instance_object_.type == PP_VARTYPE_UNDEFINED)
134 instance_object_ = instance_->GetInstanceObject(isolate); 133 instance_object_ = instance_->GetInstanceObject();
135 // GetInstanceObject talked to the plugin which may have removed the instance 134 // GetInstanceObject talked to the plugin which may have removed the instance
136 // from the DOM, in which case instance_ would be NULL now. 135 // from the DOM, in which case instance_ would be NULL now.
137 if (!instance_.get()) 136 if (!instance_.get())
138 return v8::Local<v8::Object>(); 137 return NULL;
139 138
140 scoped_refptr<V8ObjectVar> object_var( 139 scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(instance_object_));
141 V8ObjectVar::FromPPVar(instance_object_));
142 // If there's an InstanceObject, tell the Instance's MessageChannel to pass 140 // If there's an InstanceObject, tell the Instance's MessageChannel to pass
143 // any non-postMessage calls to it. 141 // any non-postMessage calls to it.
144 if (object_var.get()) 142 if (object.get()) {
145 instance_->message_channel()->SetPassthroughObject(object_var->GetHandle()); 143 instance_->message_channel().SetPassthroughObject(object->np_object());
144 }
145 NPObject* message_channel_np_object(instance_->message_channel().np_object());
146 // The object is expected to be retained before it is returned.
147 blink::WebBindings::retainObject(message_channel_np_object);
148 return message_channel_np_object;
149 }
146 150
147 v8::Handle<v8::Object> result = instance_->GetMessageChannelObject(); 151 NPP PepperWebPluginImpl::pluginNPP() { return instance_->instanceNPP(); }
148 return result;
149 }
150 152
151 bool PepperWebPluginImpl::getFormValue(WebString& value) { return false; } 153 bool PepperWebPluginImpl::getFormValue(WebString& value) { return false; }
152 154
153 void PepperWebPluginImpl::paint(WebCanvas* canvas, const WebRect& rect) { 155 void PepperWebPluginImpl::paint(WebCanvas* canvas, const WebRect& rect) {
154 if (!instance_->FlashIsFullscreenOrPending()) 156 if (!instance_->FlashIsFullscreenOrPending())
155 instance_->Paint(canvas, plugin_rect_, rect); 157 instance_->Paint(canvas, plugin_rect_, rect);
156 } 158 }
157 159
158 void PepperWebPluginImpl::updateGeometry( 160 void PepperWebPluginImpl::updateGeometry(
159 const WebRect& window_rect, 161 const WebRect& window_rect,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 271
270 bool PepperWebPluginImpl::canRotateView() { return instance_->CanRotateView(); } 272 bool PepperWebPluginImpl::canRotateView() { return instance_->CanRotateView(); }
271 273
272 void PepperWebPluginImpl::rotateView(RotationType type) { 274 void PepperWebPluginImpl::rotateView(RotationType type) {
273 instance_->RotateView(type); 275 instance_->RotateView(type);
274 } 276 }
275 277
276 bool PepperWebPluginImpl::isPlaceholder() { return false; } 278 bool PepperWebPluginImpl::isPlaceholder() { return false; }
277 279
278 } // namespace content 280 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_webplugin_impl.h ('k') | content/renderer/pepper/plugin_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698