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" | |
11 #include "ppapi/proxy/connection.h" | 10 #include "ppapi/proxy/connection.h" |
12 #include "webkit/plugins/ppapi/resource_creation_impl.h" | 11 #include "webkit/plugins/ppapi/resource_creation_impl.h" |
13 | 12 |
14 class RenderViewImpl; | 13 namespace content { |
15 | 14 |
16 namespace ppapi { | 15 class RendererPpapiHostImpl; |
17 class PpapiPermissions; | |
18 } | |
19 | |
20 namespace content { | |
21 | 16 |
22 // This class provides creation functions for the new resources with IPC | 17 // This class provides creation functions for the new resources with IPC |
23 // backends that live in content/renderer/pepper. | 18 // backends that live in content/renderer/pepper. |
24 // | 19 // |
20 // (See pepper_in_process_router.h for more information.) | |
21 // | |
25 // This is a bit confusing. The "old-style" resources live in | 22 // This is a bit confusing. The "old-style" resources live in |
26 // webkit/plugins/ppapi and are created by the ResourceCreationImpl in that | 23 // webkit/plugins/ppapi and are created by the ResourceCreationImpl in that |
27 // 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 |
28 // created by the RessourceCreationProxy in that directory. | 25 // created by the RessourceCreationProxy in that directory. |
29 // | 26 // |
30 // 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 |
raymes
2012/07/25 16:53:22
long line
| |
31 // 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 |
32 // 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 |
33 // backend in content. This class overrides the normal in-process resource | 30 // backend in content. This class overrides the normal in-process resource |
34 // 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. |
35 // | 32 // |
36 // 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 |
37 // ResourceCreationProxy for all resources. This class is just glue to manage | 34 // ResourceCreationProxy for all resources. This class is just glue to manage |
38 // the temporary "two different cases." | 35 // the temporary "two different cases." |
39 class PepperInProcessResourceCreation | 36 class PepperInProcessResourceCreation |
40 : public webkit::ppapi::ResourceCreationImpl { | 37 : public webkit::ppapi::ResourceCreationImpl { |
41 public: | 38 public: |
42 PepperInProcessResourceCreation(RenderViewImpl* render_view, | 39 PepperInProcessResourceCreation(RendererPpapiHostImpl* host_impl, |
43 webkit::ppapi::PluginInstance* instance, | 40 webkit::ppapi::PluginInstance* instance); |
44 const ppapi::PpapiPermissions& perms); | |
45 virtual ~PepperInProcessResourceCreation(); | 41 virtual ~PepperInProcessResourceCreation(); |
46 | 42 |
47 // ResourceCreation_API implementation. | 43 // ResourceCreation_API implementation. |
48 virtual PP_Resource CreateFileChooser( | 44 virtual PP_Resource CreateFileChooser( |
49 PP_Instance instance, | 45 PP_Instance instance, |
50 PP_FileChooserMode_Dev mode, | 46 PP_FileChooserMode_Dev mode, |
51 const char* accept_types) OVERRIDE; | 47 const char* accept_types) OVERRIDE; |
52 | 48 |
53 private: | 49 private: |
54 ppapi::proxy::Connection GetConnection(); | 50 // Non-owning pointer to the host for the current plugin. |
55 | 51 RendererPpapiHostImpl* host_impl_; |
56 PepperInstanceStateAccessorImpl instance_state_; | |
57 | |
58 // Fake channel to the browser for resource constructors. | |
59 class DummyBrowserChannel; | |
60 scoped_ptr<DummyBrowserChannel> dummy_browser_channel_; | |
61 | |
62 // Renderer -> plugin channel. | |
63 class HostToPluginRouter; | |
64 scoped_ptr<HostToPluginRouter> host_to_plugin_router_; | |
65 | |
66 // Plugin -> renderer channel. | |
67 class PluginToHostRouter; | |
68 scoped_ptr<PluginToHostRouter> plugin_to_host_router_; | |
69 | 52 |
70 DISALLOW_COPY_AND_ASSIGN(PepperInProcessResourceCreation); | 53 DISALLOW_COPY_AND_ASSIGN(PepperInProcessResourceCreation); |
71 }; | 54 }; |
72 | 55 |
73 } // namespace content | 56 } // namespace content |
74 | 57 |
75 #endif // CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ | 58 #endif // CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ |
OLD | NEW |