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