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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // host impl should outlive the returned pointer. Since the resource | 78 // host impl should outlive the returned pointer. Since the resource |
78 // creation object is associated with the instance, this will generally | 79 // creation object is associated with the instance, this will generally |
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; |
| 88 virtual webkit::ppapi::PluginDelegate::PlatformGraphics2D* |
| 89 GetPlatformGraphics2D(PP_Resource resource) OVERRIDE; |
87 virtual RenderView* GetRenderViewForInstance( | 90 virtual RenderView* GetRenderViewForInstance( |
88 PP_Instance instance) const OVERRIDE; | 91 PP_Instance instance) const OVERRIDE; |
89 virtual WebKit::WebPluginContainer* GetContainerForInstance( | 92 virtual WebKit::WebPluginContainer* GetContainerForInstance( |
90 PP_Instance instance) const OVERRIDE; | 93 PP_Instance instance) const OVERRIDE; |
91 virtual bool HasUserGesture(PP_Instance instance) const OVERRIDE; | 94 virtual bool HasUserGesture(PP_Instance instance) const OVERRIDE; |
| 95 virtual bool IsRunningInProcess() const OVERRIDE; |
92 | 96 |
93 private: | 97 private: |
94 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, | 98 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, |
95 ppapi::proxy::HostDispatcher* dispatcher, | 99 ppapi::proxy::HostDispatcher* dispatcher, |
96 const ppapi::PpapiPermissions& permissions); | 100 const ppapi::PpapiPermissions& permissions); |
97 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, | 101 RendererPpapiHostImpl(webkit::ppapi::PluginModule* module, |
98 const ppapi::PpapiPermissions& permissions); | 102 const ppapi::PpapiPermissions& permissions); |
99 | 103 |
100 // Retrieves the plugin instance object associated with the given PP_Instance | 104 // Retrieves the plugin instance object associated with the given PP_Instance |
101 // and validates that it is one of the instances associated with our module. | 105 // and validates that it is one of the instances associated with our module. |
102 // Returns NULL on failure. | 106 // Returns NULL on failure. |
103 // | 107 // |
104 // We use this to security check the PP_Instance values sent from a plugin to | 108 // We use this to security check the PP_Instance values sent from a plugin to |
105 // make sure it's not trying to spoof another instance. | 109 // make sure it's not trying to spoof another instance. |
106 webkit::ppapi::PluginInstance* GetAndValidateInstance( | 110 webkit::ppapi::PluginInstance* GetAndValidateInstance( |
107 PP_Instance instance) const; | 111 PP_Instance instance) const; |
108 | 112 |
109 webkit::ppapi::PluginModule* module_; // Non-owning pointer. | 113 webkit::ppapi::PluginModule* module_; // Non-owning pointer. |
110 | 114 |
111 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_; | 115 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_; |
112 | 116 |
113 // Null when running out-of-process. | 117 // Null when running out-of-process. |
114 scoped_ptr<PepperInProcessRouter> in_process_router_; | 118 scoped_ptr<PepperInProcessRouter> in_process_router_; |
115 | 119 |
| 120 // Whether the plugin is running in process. |
| 121 bool is_running_in_process_; |
| 122 |
116 DISALLOW_COPY_AND_ASSIGN(RendererPpapiHostImpl); | 123 DISALLOW_COPY_AND_ASSIGN(RendererPpapiHostImpl); |
117 }; | 124 }; |
118 | 125 |
119 } // namespace content | 126 } // namespace content |
120 | 127 |
121 #endif // CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ | 128 #endif // CONTENT_RENDERER_PEPPER_RENDERER_PPAPI_HOST_IMPL_H_ |
OLD | NEW |