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