Index: content/renderer/pepper/renderer_ppapi_host_impl.cc |
diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.cc b/content/renderer/pepper/renderer_ppapi_host_impl.cc |
index 87f553e4ae029e57091af3f97821d67a7f2b7c10..b1f5189ee4ab97c29b8a95ee31fce90b17ec0142 100644 |
--- a/content/renderer/pepper/renderer_ppapi_host_impl.cc |
+++ b/content/renderer/pepper/renderer_ppapi_host_impl.cc |
@@ -6,12 +6,15 @@ |
#include "base/file_path.h" |
#include "base/logging.h" |
+#include "content/renderer/pepper/pepper_graphics_2d_host.h" |
#include "content/renderer/pepper/pepper_in_process_resource_creation.h" |
#include "content/renderer/pepper/pepper_in_process_router.h" |
#include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
#include "content/renderer/render_view_impl.h" |
+#include "ppapi/host/ppapi_host.h" |
#include "ppapi/proxy/host_dispatcher.h" |
#include "webkit/plugins/ppapi/host_globals.h" |
+#include "webkit/plugins/ppapi/plugin_delegate.h" |
#include "webkit/plugins/ppapi/plugin_module.h" |
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
@@ -59,6 +62,7 @@ RendererPpapiHostImpl::RendererPpapiHostImpl( |
ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>( |
new ContentRendererPepperHostFactory(this))); |
dispatcher->AddFilter(ppapi_host_.get()); |
+ is_running_in_process_ = false; |
} |
// In-process constructor. |
@@ -72,6 +76,7 @@ RendererPpapiHostImpl::RendererPpapiHostImpl( |
in_process_router_->GetRendererToPluginSender(), permissions)); |
ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>( |
new ContentRendererPepperHostFactory(this))); |
+ is_running_in_process_ = true; |
} |
RendererPpapiHostImpl::~RendererPpapiHostImpl() { |
@@ -144,6 +149,18 @@ RenderView* RendererPpapiHostImpl::GetRenderViewForInstance( |
instance_object->delegate())->render_view(); |
} |
+webkit::ppapi::PluginDelegate::PlatformGraphics2D* |
+RendererPpapiHostImpl::GetPlatformGraphics2D( |
+ PP_Resource resource) { |
+ ppapi::host::ResourceHost* resource_host = |
+ GetPpapiHost()->GetResourceHost(resource); |
+ if (!resource_host || !resource_host->IsGraphics2DHost()) { |
+ LOG(ERROR) << "Resource is not Graphics2D"; |
brettw
2012/10/19 21:44:13
Let's do a DLOG here, I try hard to avoid non-debu
victorhsieh
2012/10/22 02:18:53
Done.
|
+ return NULL; |
+ } |
+ return static_cast<PepperGraphics2DHost*>(resource_host); |
+} |
+ |
bool RendererPpapiHostImpl::IsValidInstance( |
PP_Instance instance) const { |
return !!GetAndValidateInstance(instance); |
@@ -168,6 +185,10 @@ bool RendererPpapiHostImpl::HasUserGesture(PP_Instance instance) const { |
return instance_object->IsProcessingUserGesture(); |
} |
+bool RendererPpapiHostImpl::IsRunningInProcess() const { |
+ return is_running_in_process_; |
+} |
+ |
PluginInstance* RendererPpapiHostImpl::GetAndValidateInstance( |
PP_Instance pp_instance) const { |
PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); |