[go: nahoru, domu]

blob: 9ba4fc0d73004e072348588bd15bc1f6b3d29601 [file] [log] [blame]
Avi Drissman4e1b7bc2022-09-15 14:03:501// Copyright 2012 The Chromium Authors
brettw@chromium.org970bead2012-07-03 20:36:252// 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 Leebc3754ae2023-10-01 22:37:348#include "base/memory/raw_ptr.h"
jam@chromium.org20790a222013-07-25 02:23:059#include "content/renderer/pepper/resource_creation_impl.h"
brettw@chromium.org93df81e2012-08-10 22:22:4610#include "ppapi/proxy/connection.h"
brettw@chromium.org970bead2012-07-03 20:36:2511
brettw@chromium.org970bead2012-07-03 20:36:2512namespace content {
13
brettw@chromium.org93df81e2012-08-10 22:22:4614class RendererPpapiHostImpl;
15
brettw@chromium.org970bead2012-07-03 20:36:2516// This class provides creation functions for the new resources with IPC
17// backends that live in content/renderer/pepper.
18//
brettw@chromium.org93df81e2012-08-10 22:22:4619// (See pepper_in_process_router.h for more information.)
20//
brettw@chromium.org970bead2012-07-03 20:36:2521// This is a bit confusing. The "old-style" resources live in
jam@chromium.org20790a222013-07-25 02:23:0522// content/renderer/pepper and are created by the ResourceCreationImpl in that
brettw@chromium.org970bead2012-07-03 20:36:2523// directory. The "new-style" IPC-only resources are in ppapi/proxy and are
24// created by the RessourceCreationProxy in that directory.
25//
brettw@chromium.org93df81e2012-08-10 22:22:4626// 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.org970bead2012-07-03 20:36:2532//
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.orgadab2332013-07-25 18:04:3236class PepperInProcessResourceCreation : public ResourceCreationImpl {
brettw@chromium.org970bead2012-07-03 20:36:2537 public:
brettw@chromium.org93df81e2012-08-10 22:22:4638 PepperInProcessResourceCreation(RendererPpapiHostImpl* host_impl,
jam@chromium.orgadab2332013-07-25 18:04:3239 PepperPluginInstanceImpl* instance);
Peter Boström828b9022021-09-21 02:28:4340
41 PepperInProcessResourceCreation(const PepperInProcessResourceCreation&) =
42 delete;
43 PepperInProcessResourceCreation& operator=(
44 const PepperInProcessResourceCreation&) = delete;
45
dcheng6d18e402014-10-21 12:32:5246 ~PepperInProcessResourceCreation() override;
brettw@chromium.org970bead2012-07-03 20:36:2547
brettw@chromium.orgeccf80312012-07-14 15:43:4248 // ResourceCreation_API implementation.
dcheng6d18e402014-10-21 12:32:5249 PP_Resource CreateBrowserFont(
victorhsieh@chromium.orgd437530b2012-11-27 08:39:3150 PP_Instance instance,
mohan.reddyee0b42a2014-10-08 04:53:1451 const PP_BrowserFont_Trusted_Description* description) override;
dcheng6d18e402014-10-21 12:32:5252 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;
dcheng6d18e402014-10-21 12:32:5265 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.orge9cb0b792012-09-07 07:11:0668
brettw@chromium.org970bead2012-07-03 20:36:2569 private:
brettw@chromium.org93df81e2012-08-10 22:22:4670 // Non-owning pointer to the host for the current plugin.
Kalvin Leebc3754ae2023-10-01 22:37:3471 raw_ptr<RendererPpapiHostImpl, ExperimentalRenderer> host_impl_;
brettw@chromium.org970bead2012-07-03 20:36:2572};
73
74} // namespace content
75
76#endif // CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_