| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "webkit/plugins/ppapi/resource_helper.h" | 5 #include "webkit/plugins/ppapi/resource_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ppapi/shared_impl/resource.h" | 8 #include "ppapi/shared_impl/resource.h" |
| 9 #include "webkit/plugins/ppapi/host_globals.h" | 9 #include "webkit/plugins/ppapi/host_globals.h" |
| 10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 11 #include "webkit/plugins/ppapi/plugin_module.h" | 11 #include "webkit/plugins/ppapi/plugin_module.h" |
| 12 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 12 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 13 | 13 |
| 14 namespace webkit { | 14 namespace webkit { |
| 15 namespace ppapi { | 15 namespace ppapi { |
| 16 | 16 |
| 17 // static | 17 // static |
| 18 PluginInstance* ResourceHelper::GetPluginInstance( | 18 PluginInstance* ResourceHelper::GetPluginInstance( |
| 19 const ::ppapi::Resource* resource) { | 19 const ::ppapi::Resource* resource) { |
| 20 return HostGlobals::Get()->GetInstance(resource->pp_instance()); | 20 return PPInstanceToPluginInstance(resource->pp_instance()); |
| 21 } |
| 22 |
| 23 PluginInstance* ResourceHelper::PPInstanceToPluginInstance( |
| 24 PP_Instance instance) { |
| 25 return HostGlobals::Get()->GetInstance(instance); |
| 21 } | 26 } |
| 22 | 27 |
| 23 PluginModule* ResourceHelper::GetPluginModule( | 28 PluginModule* ResourceHelper::GetPluginModule( |
| 24 const ::ppapi::Resource* resource) { | 29 const ::ppapi::Resource* resource) { |
| 25 PluginInstance* instance = GetPluginInstance(resource); | 30 PluginInstance* instance = GetPluginInstance(resource); |
| 26 return instance ? instance->module() : NULL; | 31 return instance ? instance->module() : NULL; |
| 27 } | 32 } |
| 28 | 33 |
| 29 PluginDelegate* ResourceHelper::GetPluginDelegate( | 34 PluginDelegate* ResourceHelper::GetPluginDelegate( |
| 30 const ::ppapi::Resource* resource) { | 35 const ::ppapi::Resource* resource) { |
| 31 PluginInstance* instance = GetPluginInstance(resource); | 36 PluginInstance* instance = GetPluginInstance(resource); |
| 32 return instance ? instance->delegate() : NULL; | 37 return instance ? instance->delegate() : NULL; |
| 33 } | 38 } |
| 34 | 39 |
| 35 } // namespace ppapi | 40 } // namespace ppapi |
| 36 } // namespace webkit | 41 } // namespace webkit |
| 37 | 42 |
| OLD | NEW |