OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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. | |
4 | |
5 #ifndef CONTENT_RENDERER_PEPPER_RESOURCE_HELPER_H_ | |
6 #define CONTENT_RENDERER_PEPPER_RESOURCE_HELPER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "ppapi/c/pp_instance.h" | |
10 #include "ppapi/c/pp_resource.h" | |
11 | |
12 namespace ppapi { | |
13 class Resource; | |
14 } | |
15 | |
16 namespace content { | |
17 | |
18 class PepperHelperImpl; | |
19 class PepperPluginInstanceImpl; | |
20 class PluginModule; | |
21 | |
22 // Helper functions for Resoruce implementations. | |
23 // | |
24 // This is specifically not designed to be a base class that derives from | |
25 // ppapi::Resource to avoid diamond inheritance if most of a resource class | |
26 // is implemented in the shared_impl (to share code with the proxy). | |
27 class ResourceHelper { | |
28 public: | |
29 // Returns the instance implementation object for the given resource, or NULL | |
30 // if the resource has outlived its instance. | |
31 static PepperPluginInstanceImpl* GetPluginInstance( | |
32 const ::ppapi::Resource* resource); | |
33 | |
34 // Returns the module for the given resource, or NULL if the resource has | |
35 // outlived its instance. | |
36 static PluginModule* GetPluginModule(const ::ppapi::Resource* resource); | |
37 | |
38 // Returns the plugin delegate for the given resource, or NULL if the | |
39 // resource has outlived its instance. | |
40 static PepperHelperImpl* GetHelper(const ::ppapi::Resource* resource); | |
41 | |
42 // Returns the instance implementation object for the pp_instance. | |
43 static PepperPluginInstanceImpl* PPInstanceToPluginInstance( | |
44 PP_Instance instance); | |
45 | |
46 private: | |
47 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceHelper); | |
48 }; | |
49 | |
50 } // namespace content | |
51 | |
52 #endif // CONTENT_RENDERER_PEPPER_RESOURCE_IMPL_HELPER_H_ | |
OLD | NEW |