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 |
30 // an IPC reflector to run it in process. But then we have a problem with | 28 // the PepperInProcessRouter to run it in process. But then we have a problem |
31 // allocating the resources since src/webkit can't depend on IPC or see our IPC | 29 // with allocating the resources since src/webkit can't depend on IPC or see |
32 // backend in content. This class overrides the normal in-process resource | 30 // our IPC backend in content. This class overrides the normal in-process |
33 // creation and adds in the resources that we implement in ppapi/proxy. | 31 // resource creation and adds in the resources that we implement in |
| 32 // ppapi/proxy. |
34 // | 33 // |
35 // When we convert all resources to use the new-style, we can just use the | 34 // 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 | 35 // ResourceCreationProxy for all resources. This class is just glue to manage |
37 // the temporary "two different cases." | 36 // the temporary "two different cases." |
38 class PepperInProcessResourceCreation | 37 class PepperInProcessResourceCreation |
39 : public webkit::ppapi::ResourceCreationImpl { | 38 : public webkit::ppapi::ResourceCreationImpl { |
40 public: | 39 public: |
41 PepperInProcessResourceCreation(RenderViewImpl* render_view, | 40 PepperInProcessResourceCreation(RendererPpapiHostImpl* host_impl, |
42 webkit::ppapi::PluginInstance* instance, | 41 webkit::ppapi::PluginInstance* instance); |
43 const ppapi::PpapiPermissions& perms); | |
44 virtual ~PepperInProcessResourceCreation(); | 42 virtual ~PepperInProcessResourceCreation(); |
45 | 43 |
46 // ResourceCreation_API implementation. | 44 // ResourceCreation_API implementation. |
47 virtual PP_Resource CreateFileChooser( | 45 virtual PP_Resource CreateFileChooser( |
48 PP_Instance instance, | 46 PP_Instance instance, |
49 PP_FileChooserMode_Dev mode, | 47 PP_FileChooserMode_Dev mode, |
50 const char* accept_types) OVERRIDE; | 48 const char* accept_types) OVERRIDE; |
51 | 49 |
52 private: | 50 private: |
53 PepperInstanceStateAccessorImpl instance_state_; | 51 // Non-owning pointer to the host for the current plugin. |
54 | 52 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 | 53 |
61 DISALLOW_COPY_AND_ASSIGN(PepperInProcessResourceCreation); | 54 DISALLOW_COPY_AND_ASSIGN(PepperInProcessResourceCreation); |
62 }; | 55 }; |
63 | 56 |
64 } // namespace content | 57 } // namespace content |
65 | 58 |
66 #endif // CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ | 59 #endif // CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ |
OLD | NEW |