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_resource.h" |
| 10 |
| 11 namespace ppapi { |
| 12 class Resource; |
| 13 } |
| 14 |
| 15 namespace webkit { |
| 16 namespace ppapi { |
| 17 |
| 18 class PluginInstance; |
| 19 class PluginModule; |
| 20 class PluginDelegate; |
| 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 PluginInstance* GetPluginInstance(const ::ppapi::Resource* resource); |
| 32 |
| 33 // Returns the module for the given resource, or NULL if the resource has |
| 34 // outlived its instance. |
| 35 static PluginModule* GetPluginModule(const ::ppapi::Resource* resource); |
| 36 |
| 37 // Returns the plugin delegate for the given resource, or NULL if the |
| 38 // resource has outlived its instance. |
| 39 static PluginDelegate* GetPluginDelegate(const ::ppapi::Resource* resource); |
| 40 |
| 41 private: |
| 42 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceHelper); |
| 43 }; |
| 44 |
| 45 } // namespace ppapi |
| 46 } // namespace webkit |
| 47 |
| 48 #endif // WEBKIT_PLUGINS_PPAPI_RESOURCE_IMPL_HELPER_H_ |
OLD | NEW |