Avi Drissman | 4e1b7bc | 2022-09-15 14:03:50 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
brettw@chromium.org | 970bead | 2012-07-03 20:36:25 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ |
| 6 | #define CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ |
| 7 | |
Kalvin Lee | bc3754ae | 2023-10-01 22:37:34 | [diff] [blame] | 8 | #include "base/memory/raw_ptr.h" |
jam@chromium.org | 20790a22 | 2013-07-25 02:23:05 | [diff] [blame] | 9 | #include "content/renderer/pepper/resource_creation_impl.h" |
brettw@chromium.org | 93df81e | 2012-08-10 22:22:46 | [diff] [blame] | 10 | #include "ppapi/proxy/connection.h" |
brettw@chromium.org | 970bead | 2012-07-03 20:36:25 | [diff] [blame] | 11 | |
brettw@chromium.org | 970bead | 2012-07-03 20:36:25 | [diff] [blame] | 12 | namespace content { |
| 13 | |
brettw@chromium.org | 93df81e | 2012-08-10 22:22:46 | [diff] [blame] | 14 | class RendererPpapiHostImpl; |
| 15 | |
brettw@chromium.org | 970bead | 2012-07-03 20:36:25 | [diff] [blame] | 16 | // This class provides creation functions for the new resources with IPC |
| 17 | // backends that live in content/renderer/pepper. |
| 18 | // |
brettw@chromium.org | 93df81e | 2012-08-10 22:22:46 | [diff] [blame] | 19 | // (See pepper_in_process_router.h for more information.) |
| 20 | // |
brettw@chromium.org | 970bead | 2012-07-03 20:36:25 | [diff] [blame] | 21 | // This is a bit confusing. The "old-style" resources live in |
jam@chromium.org | 20790a22 | 2013-07-25 02:23:05 | [diff] [blame] | 22 | // content/renderer/pepper and are created by the ResourceCreationImpl in that |
brettw@chromium.org | 970bead | 2012-07-03 20:36:25 | [diff] [blame] | 23 | // directory. The "new-style" IPC-only resources are in ppapi/proxy and are |
| 24 | // created by the RessourceCreationProxy in that directory. |
| 25 | // |
brettw@chromium.org | 93df81e | 2012-08-10 22:22:46 | [diff] [blame] | 26 | // This class allows us to run new-style IPC-only resources in-process. We use |
| 27 | // the PepperInProcessRouter to run it in process. But then we have a problem |
| 28 | // with allocating the resources since src/webkit can't depend on IPC or see |
| 29 | // our IPC backend in content. This class overrides the normal in-process |
| 30 | // resource creation and adds in the resources that we implement in |
| 31 | // ppapi/proxy. |
brettw@chromium.org | 970bead | 2012-07-03 20:36:25 | [diff] [blame] | 32 | // |
| 33 | // When we convert all resources to use the new-style, we can just use the |
| 34 | // ResourceCreationProxy for all resources. This class is just glue to manage |
| 35 | // the temporary "two different cases." |
jam@chromium.org | adab233 | 2013-07-25 18:04:32 | [diff] [blame] | 36 | class PepperInProcessResourceCreation : public ResourceCreationImpl { |
brettw@chromium.org | 970bead | 2012-07-03 20:36:25 | [diff] [blame] | 37 | public: |
brettw@chromium.org | 93df81e | 2012-08-10 22:22:46 | [diff] [blame] | 38 | PepperInProcessResourceCreation(RendererPpapiHostImpl* host_impl, |
jam@chromium.org | adab233 | 2013-07-25 18:04:32 | [diff] [blame] | 39 | PepperPluginInstanceImpl* instance); |
Peter Boström | 828b902 | 2021-09-21 02:28:43 | [diff] [blame] | 40 | |
| 41 | PepperInProcessResourceCreation(const PepperInProcessResourceCreation&) = |
| 42 | delete; |
| 43 | PepperInProcessResourceCreation& operator=( |
| 44 | const PepperInProcessResourceCreation&) = delete; |
| 45 | |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 46 | ~PepperInProcessResourceCreation() override; |
brettw@chromium.org | 970bead | 2012-07-03 20:36:25 | [diff] [blame] | 47 | |
brettw@chromium.org | eccf8031 | 2012-07-14 15:43:42 | [diff] [blame] | 48 | // ResourceCreation_API implementation. |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 49 | PP_Resource CreateBrowserFont( |
victorhsieh@chromium.org | d437530b | 2012-11-27 08:39:31 | [diff] [blame] | 50 | PP_Instance instance, |
mohan.reddy | ee0b42a | 2014-10-08 04:53:14 | [diff] [blame] | 51 | const PP_BrowserFont_Trusted_Description* description) override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 52 | PP_Resource CreateFileChooser(PP_Instance instance, |
| 53 | PP_FileChooserMode_Dev mode, |
| 54 | const PP_Var& accept_types) override; |
| 55 | PP_Resource CreateFileIO(PP_Instance instance) override; |
| 56 | PP_Resource CreateFileRef( |
| 57 | PP_Instance instance, |
| 58 | const ppapi::FileRefCreateInfo& create_info) override; |
| 59 | PP_Resource CreateFileSystem(PP_Instance instance, |
| 60 | PP_FileSystemType type) override; |
| 61 | PP_Resource CreateGraphics2D(PP_Instance pp_instance, |
| 62 | const PP_Size* size, |
| 63 | PP_Bool is_always_opaque) override; |
| 64 | PP_Resource CreatePrinting(PP_Instance instance) override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 65 | PP_Resource CreateURLLoader(PP_Instance instance) override; |
| 66 | PP_Resource CreateURLRequestInfo(PP_Instance instance) override; |
| 67 | PP_Resource CreateWebSocket(PP_Instance instance) override; |
raymes@chromium.org | e9cb0b79 | 2012-09-07 07:11:06 | [diff] [blame] | 68 | |
brettw@chromium.org | 970bead | 2012-07-03 20:36:25 | [diff] [blame] | 69 | private: |
brettw@chromium.org | 93df81e | 2012-08-10 22:22:46 | [diff] [blame] | 70 | // Non-owning pointer to the host for the current plugin. |
Kalvin Lee | bc3754ae | 2023-10-01 22:37:34 | [diff] [blame] | 71 | raw_ptr<RendererPpapiHostImpl, ExperimentalRenderer> host_impl_; |
brettw@chromium.org | 970bead | 2012-07-03 20:36:25 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | } // namespace content |
| 75 | |
| 76 | #endif // CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_ |