| 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 IPC::PlatformFileForTransit ShareHandleWithRemote( | 97 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( |
| 95 base::PlatformFile handle, | 98 base::PlatformFile handle, |
| 96 bool should_close_source) OVERRIDE; | 99 bool should_close_source) OVERRIDE; |
| 100 virtual bool IsRunningInProcess() const OVERRIDE; |
| 97 | 101 |
| 98 private: | 102 private: |
| 99 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, | 103 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, |
| 100 ppapi::proxy::HostDispatcher* dispatcher, | 104 ppapi::proxy::HostDispatcher* dispatcher, |
| 101 const ppapi::PpapiPermissions& permissions); | 105 const ppapi::PpapiPermissions& permissions); |
| 102 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, | 106 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, |
| 103 const ppapi::PpapiPermissions& permissions); | 107 const ppapi::PpapiPermissions& permissions); |
| 104 | 108 |
| 105 // Retrieves the plugin instance object associated with the given PP_Instance | 109 // Retrieves the plugin instance object associated with the given PP_Instance |
| 106 // and validates that it is one of the instances associated with our module. | 110 // and validates that it is one of the instances associated with our module. |
| 107 // Returns NULL on failure. | 111 // Returns NULL on failure. |
| 108 // | 112 // |
| 109 // We use this to security check the PP_Instance values sent from a plugin to | 113 // We use this to security check the PP_Instance values sent from a plugin to |
| 110 // make sure it's not trying to spoof another instance. | 114 // make sure it's not trying to spoof another instance. |
| 111 webkit::ppapi::PluginInstance* GetAndValidateInstance( | 115 webkit::ppapi::PluginInstance* GetAndValidateInstance( |
| 112 PP_Instance instance) const; | 116 PP_Instance instance) const; |
| 113 | 117 |
| 114 webkit::ppapi::PluginModule* module_; // Non-owning pointer. | 118 webkit::ppapi::PluginModule* module_; // Non-owning pointer. |
| 115 | 119 |
| 116 ppapi::proxy::HostDispatcher* dispatcher_; // Non-owning pointer. | 120 ppapi::proxy::HostDispatcher* dispatcher_; // Non-owning pointer. |
| 117 | 121 |
| 118 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_; | 122 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_; |
| 119 | 123 |
| 120 // Null when running out-of-process. | 124 // Null when running out-of-process. |
| 121 scoped_ptr<PepperInProcessRouter> in_process_router_; | 125 scoped_ptr<PepperInProcessRouter> in_process_router_; |
| 122 | 126 |
| 127 // Whether the plugin is running in process. |
| 128 bool is_running_in_process_; |
| 129 |
| 123 DISALLOW_COPY_AND_ASSIGN(RendererPpapiHostImpl); | 130 DISALLOW_COPY_AND_ASSIGN(RendererPpapiHostImpl); |
| 124 }; | 131 }; |
| 125 | 132 |
| 126 } // namespace content | 133 } // namespace content |
| 127 | 134 |
| 128 #endif // CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ | 135 #endif // CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ |
| OLD | NEW |