| OLD | NEW |
| 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_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV)) | 1367 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV)) |
| 1368 return false; | 1368 return false; |
| 1369 if (!plugin_print_interface_) { | 1369 if (!plugin_print_interface_) { |
| 1370 plugin_print_interface_ = static_cast<const PPP_Printing_Dev*>( | 1370 plugin_print_interface_ = static_cast<const PPP_Printing_Dev*>( |
| 1371 module_->GetPluginInterface(PPP_PRINTING_DEV_INTERFACE)); | 1371 module_->GetPluginInterface(PPP_PRINTING_DEV_INTERFACE)); |
| 1372 } | 1372 } |
| 1373 return !!plugin_print_interface_; | 1373 return !!plugin_print_interface_; |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 bool PepperPluginInstanceImpl::LoadPrivateInterface() { | 1376 bool PepperPluginInstanceImpl::LoadPrivateInterface() { |
| 1377 // If this is a NaCl app, we want to talk to the trusted NaCl plugin to |
| 1378 // call GetInstanceObject. This is necessary to ensure that the properties |
| 1379 // the trusted plugin exposes (readyState and lastError) work properly. Note |
| 1380 // that untrusted NaCl apps are not allowed to provide PPP_InstancePrivate, |
| 1381 // so it's correct to never look up PPP_InstancePrivate for them. |
| 1382 // |
| 1383 // If this is *not* a NaCl plugin, original_module_ will never be set; we talk |
| 1384 // to the "real" module. |
| 1385 scoped_refptr<PluginModule> module = original_module_ ? original_module_ : |
| 1386 module_; |
| 1377 // Only check for the interface if the plugin has private permission. | 1387 // Only check for the interface if the plugin has private permission. |
| 1378 if (!module_->permissions().HasPermission(ppapi::PERMISSION_PRIVATE)) | 1388 if (!module->permissions().HasPermission(ppapi::PERMISSION_PRIVATE)) |
| 1379 return false; | 1389 return false; |
| 1380 if (!plugin_private_interface_) { | 1390 if (!plugin_private_interface_) { |
| 1381 plugin_private_interface_ = static_cast<const PPP_Instance_Private*>( | 1391 plugin_private_interface_ = static_cast<const PPP_Instance_Private*>( |
| 1382 module_->GetPluginInterface(PPP_INSTANCE_PRIVATE_INTERFACE)); | 1392 module->GetPluginInterface(PPP_INSTANCE_PRIVATE_INTERFACE)); |
| 1383 } | 1393 } |
| 1384 | 1394 |
| 1385 return !!plugin_private_interface_; | 1395 return !!plugin_private_interface_; |
| 1386 } | 1396 } |
| 1387 | 1397 |
| 1388 bool PepperPluginInstanceImpl::LoadSelectionInterface() { | 1398 bool PepperPluginInstanceImpl::LoadSelectionInterface() { |
| 1389 if (!plugin_selection_interface_) { | 1399 if (!plugin_selection_interface_) { |
| 1390 plugin_selection_interface_ = | 1400 plugin_selection_interface_ = |
| 1391 static_cast<const PPP_Selection_Dev*>(module_->GetPluginInterface( | 1401 static_cast<const PPP_Selection_Dev*>(module_->GetPluginInterface( |
| 1392 PPP_SELECTION_DEV_INTERFACE)); | 1402 PPP_SELECTION_DEV_INTERFACE)); |
| (...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2659 bool PepperPluginInstanceImpl::IsValidInstanceOf(PluginModule* module) { | 2669 bool PepperPluginInstanceImpl::IsValidInstanceOf(PluginModule* module) { |
| 2660 DCHECK(module); | 2670 DCHECK(module); |
| 2661 return module == module_.get() || | 2671 return module == module_.get() || |
| 2662 module == original_module_.get(); | 2672 module == original_module_.get(); |
| 2663 } | 2673 } |
| 2664 | 2674 |
| 2665 NPP PepperPluginInstanceImpl::instanceNPP() { | 2675 NPP PepperPluginInstanceImpl::instanceNPP() { |
| 2666 return npp_.get(); | 2676 return npp_.get(); |
| 2667 } | 2677 } |
| 2668 | 2678 |
| 2669 v8::Isolate* PepperPluginInstanceImpl::GetIsolate() const { | |
| 2670 return isolate_; | |
| 2671 } | |
| 2672 | |
| 2673 PepperPluginInstance* PepperPluginInstance::Get(PP_Instance instance_id) { | 2679 PepperPluginInstance* PepperPluginInstance::Get(PP_Instance instance_id) { |
| 2674 return HostGlobals::Get()->GetInstance(instance_id); | 2680 return HostGlobals::Get()->GetInstance(instance_id); |
| 2675 } | 2681 } |
| 2676 | 2682 |
| 2677 RenderView* PepperPluginInstanceImpl::GetRenderView() { | 2683 RenderView* PepperPluginInstanceImpl::GetRenderView() { |
| 2678 return render_view_; | 2684 return render_view_; |
| 2679 } | 2685 } |
| 2680 | 2686 |
| 2681 WebKit::WebPluginContainer* PepperPluginInstanceImpl::GetContainer() { | 2687 WebKit::WebPluginContainer* PepperPluginInstanceImpl::GetContainer() { |
| 2682 return container_; | 2688 return container_; |
| 2683 } | 2689 } |
| 2684 | 2690 |
| 2691 v8::Isolate* PepperPluginInstanceImpl::GetIsolate() const { |
| 2692 return isolate_; |
| 2693 } |
| 2694 |
| 2685 ppapi::VarTracker* PepperPluginInstanceImpl::GetVarTracker() { | 2695 ppapi::VarTracker* PepperPluginInstanceImpl::GetVarTracker() { |
| 2686 return HostGlobals::Get()->GetVarTracker(); | 2696 return HostGlobals::Get()->GetVarTracker(); |
| 2687 } | 2697 } |
| 2688 | 2698 |
| 2689 const GURL& PepperPluginInstanceImpl::GetPluginURL() { | 2699 const GURL& PepperPluginInstanceImpl::GetPluginURL() { |
| 2690 return plugin_url_; | 2700 return plugin_url_; |
| 2691 } | 2701 } |
| 2692 | 2702 |
| 2693 base::FilePath PepperPluginInstanceImpl::GetModulePath() { | 2703 base::FilePath PepperPluginInstanceImpl::GetModulePath() { |
| 2694 return module_->path(); | 2704 return module_->path(); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2996 // Running out-of-process. Initiate an IPC call to notify the plugin | 3006 // Running out-of-process. Initiate an IPC call to notify the plugin |
| 2997 // process. | 3007 // process. |
| 2998 ppapi::proxy::HostDispatcher* dispatcher = | 3008 ppapi::proxy::HostDispatcher* dispatcher = |
| 2999 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3009 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
| 3000 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3010 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
| 3001 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3011 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
| 3002 } | 3012 } |
| 3003 } | 3013 } |
| 3004 | 3014 |
| 3005 } // namespace content | 3015 } // namespace content |
| OLD | NEW |