| 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 #ifndef CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/public/renderer/renderer_ppapi_host.h" | 10 #include "content/public/renderer/renderer_ppapi_host.h" |
| 11 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" | 11 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" |
| 12 #include "ppapi/host/ppapi_host.h" | 12 #include "ppapi/host/ppapi_host.h" |
| 13 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 13 #include "webkit/plugins/ppapi/plugin_module.h" | 14 #include "webkit/plugins/ppapi/plugin_module.h" |
| 14 | 15 |
| 15 namespace IPC { | 16 namespace IPC { |
| 16 class Sender; | 17 class Sender; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace ppapi { | 20 namespace ppapi { |
| 20 | 21 |
| 21 namespace proxy { | 22 namespace proxy { |
| 22 class HostDispatcher; | 23 class HostDispatcher; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // happen automatically. | 80 // happen automatically. |
| 80 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> | 81 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> |
| 81 CreateInProcessResourceCreationAPI( | 82 CreateInProcessResourceCreationAPI( |
| 82 webkit::ppapi::PluginInstance* instance); | 83 webkit::ppapi::PluginInstance* instance); |
| 83 | 84 |
| 84 // RendererPpapiHost. | 85 // RendererPpapiHost. |
| 85 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE; | 86 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE; |
| 86 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE; | 87 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE; |
| 87 virtual webkit::ppapi::PluginInstance* GetPluginInstance( | 88 virtual webkit::ppapi::PluginInstance* GetPluginInstance( |
| 88 PP_Instance instance) const OVERRIDE; | 89 PP_Instance instance) const OVERRIDE; |
| 90 virtual webkit::ppapi::PluginDelegate::PlatformGraphics2D* |
| 91 GetPlatformGraphics2D(PP_Resource resource) OVERRIDE; |
| 89 virtual RenderView* GetRenderViewForInstance( | 92 virtual RenderView* GetRenderViewForInstance( |
| 90 PP_Instance instance) const OVERRIDE; | 93 PP_Instance instance) const OVERRIDE; |
| 91 virtual WebKit::WebPluginContainer* GetContainerForInstance( | 94 virtual WebKit::WebPluginContainer* GetContainerForInstance( |
| 92 PP_Instance instance) const OVERRIDE; | 95 PP_Instance instance) const OVERRIDE; |
| 93 virtual bool HasUserGesture(PP_Instance instance) const OVERRIDE; | 96 virtual bool HasUserGesture(PP_Instance instance) const OVERRIDE; |
| 94 virtual int GetRoutingIDForWidget(PP_Instance instance) const OVERRIDE; | 97 virtual int GetRoutingIDForWidget(PP_Instance instance) const OVERRIDE; |
| 95 virtual gfx::Point PluginPointToRenderView( | 98 virtual gfx::Point PluginPointToRenderView( |
| 96 PP_Instance instance, | 99 PP_Instance instance, |
| 97 const gfx::Point& pt) const OVERRIDE; | 100 const gfx::Point& pt) const OVERRIDE; |
| 98 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( | 101 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( |
| 99 base::PlatformFile handle, | 102 base::PlatformFile handle, |
| 100 bool should_close_source) OVERRIDE; | 103 bool should_close_source) OVERRIDE; |
| 104 virtual bool IsRunningInProcess() const OVERRIDE; |
| 101 | 105 |
| 102 private: | 106 private: |
| 103 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, | 107 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, |
| 104 ppapi::proxy::HostDispatcher* dispatcher, | 108 ppapi::proxy::HostDispatcher* dispatcher, |
| 105 const ppapi::PpapiPermissions& permissions); | 109 const ppapi::PpapiPermissions& permissions); |
| 106 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, | 110 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, |
| 107 const ppapi::PpapiPermissions& permissions); | 111 const ppapi::PpapiPermissions& permissions); |
| 108 | 112 |
| 109 // Retrieves the plugin instance object associated with the given PP_Instance | 113 // Retrieves the plugin instance object associated with the given PP_Instance |
| 110 // and validates that it is one of the instances associated with our module. | 114 // and validates that it is one of the instances associated with our module. |
| 111 // Returns NULL on failure. | 115 // Returns NULL on failure. |
| 112 // | 116 // |
| 113 // We use this to security check the PP_Instance values sent from a plugin to | 117 // We use this to security check the PP_Instance values sent from a plugin to |
| 114 // make sure it's not trying to spoof another instance. | 118 // make sure it's not trying to spoof another instance. |
| 115 webkit::ppapi::PluginInstance* GetAndValidateInstance( | 119 webkit::ppapi::PluginInstance* GetAndValidateInstance( |
| 116 PP_Instance instance) const; | 120 PP_Instance instance) const; |
| 117 | 121 |
| 118 webkit::ppapi::PluginModule* module_; // Non-owning pointer. | 122 webkit::ppapi::PluginModule* module_; // Non-owning pointer. |
| 119 | 123 |
| 120 ppapi::proxy::HostDispatcher* dispatcher_; // Non-owning pointer. | 124 ppapi::proxy::HostDispatcher* dispatcher_; // Non-owning pointer. |
| 121 | 125 |
| 122 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_; | 126 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_; |
| 123 | 127 |
| 124 // Null when running out-of-process. | 128 // Null when running out-of-process. |
| 125 scoped_ptr<PepperInProcessRouter> in_process_router_; | 129 scoped_ptr<PepperInProcessRouter> in_process_router_; |
| 126 | 130 |
| 131 // Whether the plugin is running in process. |
| 132 bool is_running_in_process_; |
| 133 |
| 127 DISALLOW_COPY_AND_ASSIGN(RendererPpapiHostImpl); | 134 DISALLOW_COPY_AND_ASSIGN(RendererPpapiHostImpl); |
| 128 }; | 135 }; |
| 129 | 136 |
| 130 } // namespace content | 137 } // namespace content |
| 131 | 138 |
| 132 #endif // CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ | 139 #endif // CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ |
| OLD | NEW |