| 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" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // Creates the in-process resource creation API wrapper for the given | 76 // Creates the in-process resource creation API wrapper for the given |
| 77 // plugin instance. This object will reference the host impl, so the | 77 // plugin instance. This object will reference the host impl, so the |
| 78 // host impl should outlive the returned pointer. Since the resource | 78 // host impl should outlive the returned pointer. Since the resource |
| 79 // creation object is associated with the instance, this will generally | 79 // creation object is associated with the instance, this will generally |
| 80 // happen automatically. | 80 // happen automatically. |
| 81 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> | 81 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> |
| 82 CreateInProcessResourceCreationAPI( | 82 CreateInProcessResourceCreationAPI( |
| 83 webkit::ppapi::PluginInstance* instance); | 83 webkit::ppapi::PluginInstance* instance); |
| 84 | 84 |
| 85 // RendererPpapiHost. | 85 // RendererPpapiHost implementation. |
| 86 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE; | 86 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE; |
| 87 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE; | 87 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE; |
| 88 virtual webkit::ppapi::PluginInstance* GetPluginInstance( | 88 virtual webkit::ppapi::PluginInstance* GetPluginInstance( |
| 89 PP_Instance instance) const OVERRIDE; | 89 PP_Instance instance) const OVERRIDE; |
| 90 virtual webkit::ppapi::PluginDelegate::PlatformGraphics2D* | 90 virtual webkit::ppapi::PluginDelegate::PlatformGraphics2D* |
| 91 GetPlatformGraphics2D(PP_Resource resource) OVERRIDE; | 91 GetPlatformGraphics2D(PP_Resource resource) OVERRIDE; |
| 92 virtual RenderView* GetRenderViewForInstance( | 92 virtual RenderView* GetRenderViewForInstance( |
| 93 PP_Instance instance) const OVERRIDE; | 93 PP_Instance instance) const OVERRIDE; |
| 94 virtual WebKit::WebPluginContainer* GetContainerForInstance( | 94 virtual WebKit::WebPluginContainer* GetContainerForInstance( |
| 95 PP_Instance instance) const OVERRIDE; | 95 PP_Instance instance) const OVERRIDE; |
| 96 virtual base::ProcessId GetPluginPID() const OVERRIDE; |
| 96 virtual bool HasUserGesture(PP_Instance instance) const OVERRIDE; | 97 virtual bool HasUserGesture(PP_Instance instance) const OVERRIDE; |
| 97 virtual int GetRoutingIDForWidget(PP_Instance instance) const OVERRIDE; | 98 virtual int GetRoutingIDForWidget(PP_Instance instance) const OVERRIDE; |
| 98 virtual gfx::Point PluginPointToRenderView( | 99 virtual gfx::Point PluginPointToRenderView( |
| 99 PP_Instance instance, | 100 PP_Instance instance, |
| 100 const gfx::Point& pt) const OVERRIDE; | 101 const gfx::Point& pt) const OVERRIDE; |
| 101 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( | 102 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( |
| 102 base::PlatformFile handle, | 103 base::PlatformFile handle, |
| 103 bool should_close_source) OVERRIDE; | 104 bool should_close_source) OVERRIDE; |
| 104 virtual bool IsRunningInProcess() const OVERRIDE; | 105 virtual bool IsRunningInProcess() const OVERRIDE; |
| 105 | 106 |
| 106 private: | 107 private: |
| 107 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, | 108 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, |
| 108 ppapi::proxy::HostDispatcher* dispatcher, | 109 ppapi::proxy::HostDispatcher* dispatcher, |
| 109 const ppapi::PpapiPermissions& permissions); | 110 const ppapi::PpapiPermissions& permissions); |
| 110 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, | 111 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, |
| 111 const ppapi::PpapiPermissions& permissions); | 112 const ppapi::PpapiPermissions& permissions); |
| 112 | 113 |
| 113 // Retrieves the plugin instance object associated with the given PP_Instance | 114 // Retrieves the plugin instance object associated with the given PP_Instance |
| 114 // and validates that it is one of the instances associated with our module. | 115 // and validates that it is one of the instances associated with our module. |
| 115 // Returns NULL on failure. | 116 // Returns NULL on failure. |
| 116 // | 117 // |
| 117 // We use this to security check the PP_Instance values sent from a plugin to | 118 // We use this to security check the PP_Instance values sent from a plugin to |
| 118 // make sure it's not trying to spoof another instance. | 119 // make sure it's not trying to spoof another instance. |
| 119 webkit::ppapi::PluginInstance* GetAndValidateInstance( | 120 webkit::ppapi::PluginInstance* GetAndValidateInstance( |
| 120 PP_Instance instance) const; | 121 PP_Instance instance) const; |
| 121 | 122 |
| 122 webkit::ppapi::PluginModule* module_; // Non-owning pointer. | 123 webkit::ppapi::PluginModule* module_; // Non-owning pointer. |
| 123 | 124 |
| 124 ppapi::proxy::HostDispatcher* dispatcher_; // Non-owning pointer. | 125 // The dispatcher we use to send messagse when the plugin is out-of-process. |
| 126 // Will be null when running in-process. Non-owning pointer. |
| 127 ppapi::proxy::HostDispatcher* dispatcher_; |
| 125 | 128 |
| 126 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_; | 129 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_; |
| 127 | 130 |
| 128 // Null when running out-of-process. | 131 // Null when running out-of-process. |
| 129 scoped_ptr<PepperInProcessRouter> in_process_router_; | 132 scoped_ptr<PepperInProcessRouter> in_process_router_; |
| 130 | 133 |
| 131 // Whether the plugin is running in process. | 134 // Whether the plugin is running in process. |
| 132 bool is_running_in_process_; | 135 bool is_running_in_process_; |
| 133 | 136 |
| 134 DISALLOW_COPY_AND_ASSIGN(RendererPpapiHostImpl); | 137 DISALLOW_COPY_AND_ASSIGN(RendererPpapiHostImpl); |
| 135 }; | 138 }; |
| 136 | 139 |
| 137 } // namespace content | 140 } // namespace content |
| 138 | 141 |
| 139 #endif // CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ | 142 #endif // CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ |
| OLD | NEW |