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