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