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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/renderer/pepper/resource_creation_impl.h"
11 #include "ppapi/proxy/connection.h"
15 class RendererPpapiHostImpl
;
17 // This class provides creation functions for the new resources with IPC
18 // backends that live in content/renderer/pepper.
20 // (See pepper_in_process_router.h for more information.)
22 // This is a bit confusing. The "old-style" resources live in
23 // content/renderer/pepper and are created by the ResourceCreationImpl in that
24 // directory. The "new-style" IPC-only resources are in ppapi/proxy and are
25 // created by the RessourceCreationProxy in that directory.
27 // This class allows us to run new-style IPC-only resources in-process. We use
28 // the PepperInProcessRouter to run it in process. But then we have a problem
29 // with allocating the resources since src/webkit can't depend on IPC or see
30 // our IPC backend in content. This class overrides the normal in-process
31 // resource creation and adds in the resources that we implement in
34 // When we convert all resources to use the new-style, we can just use the
35 // ResourceCreationProxy for all resources. This class is just glue to manage
36 // the temporary "two different cases."
37 class PepperInProcessResourceCreation
: public ResourceCreationImpl
{
39 PepperInProcessResourceCreation(RendererPpapiHostImpl
* host_impl
,
40 PepperPluginInstanceImpl
* instance
);
41 ~PepperInProcessResourceCreation() override
;
43 // ResourceCreation_API implementation.
44 PP_Resource
CreateBrowserFont(
46 const PP_BrowserFont_Trusted_Description
* description
) override
;
47 PP_Resource
CreateFileChooser(PP_Instance instance
,
48 PP_FileChooserMode_Dev mode
,
49 const PP_Var
& accept_types
) override
;
50 PP_Resource
CreateFileIO(PP_Instance instance
) override
;
51 PP_Resource
CreateFileRef(
53 const ppapi::FileRefCreateInfo
& create_info
) override
;
54 PP_Resource
CreateFileSystem(PP_Instance instance
,
55 PP_FileSystemType type
) override
;
56 PP_Resource
CreateGraphics2D(PP_Instance pp_instance
,
58 PP_Bool is_always_opaque
) override
;
59 PP_Resource
CreatePrinting(PP_Instance instance
) override
;
60 PP_Resource
CreateTrueTypeFont(
62 const struct PP_TrueTypeFontDesc_Dev
* desc
) override
;
63 PP_Resource
CreateURLLoader(PP_Instance instance
) override
;
64 PP_Resource
CreateURLRequestInfo(PP_Instance instance
) override
;
65 PP_Resource
CreateWebSocket(PP_Instance instance
) override
;
68 // Non-owning pointer to the host for the current plugin.
69 RendererPpapiHostImpl
* host_impl_
;
71 DISALLOW_COPY_AND_ASSIGN(PepperInProcessResourceCreation
);
74 } // namespace content
76 #endif // CONTENT_RENDERER_PEPPER_PEPPER_IN_PROCESS_RESOURCE_CREATION_H_