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