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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 7362012: Remove untrusted scripting support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DCHECK(MessageLoop::current()) failure for serialized var test Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 PluginModule* module, 190 PluginModule* module,
191 const void* ppp_instance_if_0_5) { 191 const void* ppp_instance_if_0_5) {
192 const PPP_Instance_0_5* interface = 192 const PPP_Instance_0_5* interface =
193 static_cast<const PPP_Instance_0_5*>(ppp_instance_if_0_5); 193 static_cast<const PPP_Instance_0_5*>(ppp_instance_if_0_5);
194 return new PluginInstance( 194 return new PluginInstance(
195 delegate, 195 delegate,
196 module, 196 module,
197 new ::ppapi::PPP_Instance_Combined(*interface)); 197 new ::ppapi::PPP_Instance_Combined(*interface));
198 } 198 }
199 199
200 // static
201 PluginInstance* PluginInstance::Create0_4(PluginDelegate* delegate,
202 PluginModule* module,
203 const void* ppp_instance_if_0_4) {
204 const PPP_Instance_0_4* interface =
205 static_cast<const PPP_Instance_0_4*>(ppp_instance_if_0_4);
206 return new PluginInstance(
207 delegate,
208 module,
209 new ::ppapi::PPP_Instance_Combined(*interface));
210 }
211
212 PluginInstance::PluginInstance( 200 PluginInstance::PluginInstance(
213 PluginDelegate* delegate, 201 PluginDelegate* delegate,
214 PluginModule* module, 202 PluginModule* module,
215 ::ppapi::PPP_Instance_Combined* instance_interface) 203 ::ppapi::PPP_Instance_Combined* instance_interface)
216 : delegate_(delegate), 204 : delegate_(delegate),
217 module_(module), 205 module_(module),
218 instance_interface_(instance_interface), 206 instance_interface_(instance_interface),
219 pp_instance_(0), 207 pp_instance_(0),
220 container_(NULL), 208 container_(NULL),
221 full_frame_(false), 209 full_frame_(false),
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 scoped_refptr<PluginInstance> ref(this); 482 scoped_refptr<PluginInstance> ref(this);
495 if (!LoadMessagingInterface()) 483 if (!LoadMessagingInterface())
496 return; 484 return;
497 plugin_messaging_interface_->HandleMessage(pp_instance(), message); 485 plugin_messaging_interface_->HandleMessage(pp_instance(), message);
498 } 486 }
499 487
500 PP_Var PluginInstance::GetInstanceObject() { 488 PP_Var PluginInstance::GetInstanceObject() {
501 // Keep a reference on the stack. See NOTE above. 489 // Keep a reference on the stack. See NOTE above.
502 scoped_refptr<PluginInstance> ref(this); 490 scoped_refptr<PluginInstance> ref(this);
503 491
504 // Try the private interface first. If it is not supported, we fall back to 492 // If the plugin supports the private instance interface, try to retrieve its
505 // looking in the older version of the PPP_Instance interface for 493 // instance object.
506 // GetInstanceObject. If all that fails, return an undefined Var.
507 // TODO(dmichael): Remove support for PPP_Instance.GetInstanceObject
508 if (LoadPrivateInterface()) 494 if (LoadPrivateInterface())
509 return plugin_private_interface_->GetInstanceObject(pp_instance()); 495 return plugin_private_interface_->GetInstanceObject(pp_instance());
510 else if (instance_interface_->GetInstanceObject_0_4)
511 return instance_interface_->GetInstanceObject_0_4(pp_instance());
512 return PP_MakeUndefined(); 496 return PP_MakeUndefined();
513 } 497 }
514 498
515 void PluginInstance::ViewChanged(const gfx::Rect& position, 499 void PluginInstance::ViewChanged(const gfx::Rect& position,
516 const gfx::Rect& clip) { 500 const gfx::Rect& clip) {
517 fullscreen_ = (fullscreen_container_ != NULL); 501 fullscreen_ = (fullscreen_container_ != NULL);
518 position_ = position; 502 position_ = position;
519 503
520 if (clip.IsEmpty()) { 504 if (clip.IsEmpty()) {
521 // WebKit can give weird (x,y) positions for empty clip rects (since the 505 // WebKit can give weird (x,y) positions for empty clip rects (since the
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 } 1536 }
1553 delegate()->ZoomLimitsChanged(minimum_factor, maximium_factor); 1537 delegate()->ZoomLimitsChanged(minimum_factor, maximium_factor);
1554 } 1538 }
1555 1539
1556 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { 1540 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) {
1557 message_channel_->PostMessageToJavaScript(message); 1541 message_channel_->PostMessageToJavaScript(message);
1558 } 1542 }
1559 1543
1560 } // namespace ppapi 1544 } // namespace ppapi
1561 } // namespace webkit 1545 } // namespace webkit
OLDNEW
« ppapi/proxy/ppapi_proxy_test.h ('K') | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698