| 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_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
| 10 #include "webkit/plugins/webkit_plugins_export.h" |
| 10 | 11 |
| 11 namespace ppapi { | 12 namespace ppapi { |
| 12 class Resource; | 13 class Resource; |
| 13 } | 14 } |
| 14 | 15 |
| 15 namespace webkit { | 16 namespace webkit { |
| 16 namespace ppapi { | 17 namespace ppapi { |
| 17 | 18 |
| 18 class PluginInstance; | 19 class PluginInstance; |
| 19 class PluginModule; | 20 class PluginModule; |
| 20 class PluginDelegate; | 21 class PluginDelegate; |
| 21 | 22 |
| 22 // Helper functions for Resoruce implementations. | 23 // Helper functions for Resoruce implementations. |
| 23 // | 24 // |
| 24 // 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 |
| 25 // 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 |
| 26 // 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). |
| 27 class ResourceHelper { | 28 class ResourceHelper { |
| 28 public: | 29 public: |
| 29 // Returns the instance implementation object for the given resource, or NULL | 30 // Returns the instance implementation object for the given resource, or NULL |
| 30 // if the resource has outlived its instance. | 31 // if the resource has outlived its instance. |
| 31 static PluginInstance* GetPluginInstance(const ::ppapi::Resource* resource); | 32 static PluginInstance* GetPluginInstance(const ::ppapi::Resource* resource); |
| 32 | 33 |
| 33 // Returns the module for the given resource, or NULL if the resource has | 34 // Returns the module for the given resource, or NULL if the resource has |
| 34 // outlived its instance. | 35 // outlived its instance. |
| 35 static PluginModule* GetPluginModule(const ::ppapi::Resource* resource); | 36 WEBKIT_PLUGINS_EXPORT static PluginModule* GetPluginModule( |
| 37 const ::ppapi::Resource* resource); |
| 36 | 38 |
| 37 // 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 |
| 38 // resource has outlived its instance. | 40 // resource has outlived its instance. |
| 39 static PluginDelegate* GetPluginDelegate(const ::ppapi::Resource* resource); | 41 static PluginDelegate* GetPluginDelegate(const ::ppapi::Resource* resource); |
| 40 | 42 |
| 41 private: | 43 private: |
| 42 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceHelper); | 44 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceHelper); |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 } // namespace ppapi | 47 } // namespace ppapi |
| 46 } // namespace webkit | 48 } // namespace webkit |
| 47 | 49 |
| 48 #endif // WEBKIT_PLUGINS_PPAPI_RESOURCE_IMPL_HELPER_H_ | 50 #endif // WEBKIT_PLUGINS_PPAPI_RESOURCE_IMPL_HELPER_H_ |
| OLD | NEW |