| 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_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_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/renderer/pepper/pepper_instance_state_accessor_impl.h" | 10 #include "ppapi/proxy/connection.h" |
| 11 #include "webkit/plugins/ppapi/resource_creation_impl.h" | 11 #include "webkit/plugins/ppapi/resource_creation_impl.h" |
| 12 | 12 |
| 13 class RenderViewImpl; | |
| 14 | |
| 15 namespace ppapi { | |
| 16 class PpapiPermissions; | |
| 17 } | |
| 18 | |
| 19 namespace content { | 13 namespace content { |
| 20 | 14 |
| 15 class RendererPpapiHostImpl; |
| 16 |
| 21 // This class provides creation functions for the new resources with IPC | 17 // This class provides creation functions for the new resources with IPC |
| 22 // backends that live in content/renderer/pepper. | 18 // backends that live in content/renderer/pepper. |
| 23 // | 19 // |
| 20 // (See pepper_in_process_router.h for more information.) |
| 21 // |
| 24 // This is a bit confusing. The "old-style" resources live in | 22 // This is a bit confusing. The "old-style" resources live in |
| 25 // webkit/plugins/ppapi and are created by the ResourceCreationImpl in that | 23 // webkit/plugins/ppapi and are created by the ResourceCreationImpl in that |
| 26 // directory. The "new-style" IPC-only resources are in ppapi/proxy and are | 24 // directory. The "new-style" IPC-only resources are in ppapi/proxy and are |
| 27 // created by the RessourceCreationProxy in that directory. | 25 // created by the RessourceCreationProxy in that directory. |
| 28 // | 26 // |
| 29 // This class allows us to run new-style IPC-only resources in-process. We have | 27 // This class allows us to run new-style IPC-only resources in-process. We use t
he |
| 30 // an IPC reflector to run it in process. But then we have a problem with | 28 // PepperInProcessRouter to run it in process. But then we have a problem with |
| 31 // allocating the resources since src/webkit can't depend on IPC or see our IPC | 29 // allocating the resources since src/webkit can't depend on IPC or see our IPC |
| 32 // backend in content. This class overrides the normal in-process resource | 30 // backend in content. This class overrides the normal in-process resource |
| 33 // creation and adds in the resources that we implement in ppapi/proxy. | 31 // creation and adds in the resources that we implement in ppapi/proxy. |
| 34 // | 32 // |
| 35 // When we convert all resources to use the new-style, we can just use the | 33 // When we convert all resources to use the new-style, we can just use the |
| 36 // ResourceCreationProxy for all resources. This class is just glue to manage | 34 // ResourceCreationProxy for all resources. This class is just glue to manage |
| 37 // the temporary "two different cases." | 35 // the temporary "two different cases." |
| 38 class PepperInProcessResourceCreation | 36 class PepperInProcessResourceCreation |
| 39 : public webkit::ppapi::ResourceCreationImpl { | 37 : public webkit::ppapi::ResourceCreationImpl { |
| 40 public: | 38 public: |
| 41 PepperInProcessResourceCreation(RenderViewImpl* render_view, | 39 PepperInProcessResourceCreation(RendererPpapiHostImpl* host_impl, |
| 42 webkit::ppapi::PluginInstance* instance, | 40 webkit::ppapi::PluginInstance* instance); |
| 43 const ppapi::PpapiPermissions& perms); | |
| 44 virtual ~PepperInProcessResourceCreation(); | 41 virtual ~PepperInProcessResourceCreation(); |
| 45 | 42 |
| 46 // ResourceCreation_API implementation. | 43 // ResourceCreation_API implementation. |
| 47 virtual PP_Resource CreateFileChooser( | 44 virtual PP_Resource CreateFileChooser( |
| 48 PP_Instance instance, | 45 PP_Instance instance, |
| 49 PP_FileChooserMode_Dev mode, | 46 PP_FileChooserMode_Dev mode, |
| 50 const char* accept_types) OVERRIDE; | 47 const char* accept_types) OVERRIDE; |
| 51 | 48 |
| 52 private: | 49 private: |
| 53 PepperInstanceStateAccessorImpl instance_state_; | 50 // Non-owning pointer to the host for the current plugin. |
| 54 | 51 RendererPpapiHostImpl* host_impl_; |
| 55 class HostToPluginRouter; | |
| 56 scoped_ptr<HostToPluginRouter> host_to_plugin_router_; | |
| 57 | |
| 58 class PluginToHostRouter; | |
| 59 scoped_ptr<PluginToHostRouter> plugin_to_host_router_; | |
| 60 | 52 |
| 61 DISALLOW_COPY_AND_ASSIGN(PepperInProcessResourceCreation); | 53 DISALLOW_COPY_AND_ASSIGN(PepperInProcessResourceCreation); |
| 62 }; | 54 }; |
| 63 | 55 |
| 64 } // namespace content | 56 } // namespace content |
| 65 | 57 |
| 66 #endif // CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ | 58 #endif // CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ |
| OLD | NEW |