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 "content/renderer/pepper/resource_helper.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "content/renderer/pepper/host_globals.h" | |
9 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | |
10 #include "content/renderer/pepper/plugin_module.h" | |
11 #include "ppapi/shared_impl/resource.h" | |
12 | |
13 namespace content { | |
14 | |
15 // static | |
16 PepperPluginInstanceImpl* ResourceHelper::GetPluginInstance( | |
17 const ::ppapi::Resource* resource) { | |
18 return PPInstanceToPluginInstance(resource->pp_instance()); | |
19 } | |
20 | |
21 PepperPluginInstanceImpl* ResourceHelper::PPInstanceToPluginInstance( | |
22 PP_Instance instance) { | |
23 return HostGlobals::Get()->GetInstance(instance); | |
24 } | |
25 | |
26 PluginModule* ResourceHelper::GetPluginModule( | |
27 const ::ppapi::Resource* resource) { | |
28 PepperPluginInstanceImpl* instance = GetPluginInstance(resource); | |
29 return instance ? instance->module() : NULL; | |
30 } | |
31 | |
32 PepperHelperImpl* ResourceHelper::GetHelper(const ::ppapi::Resource* resource) { | |
33 PepperPluginInstanceImpl* instance = GetPluginInstance(resource); | |
34 return instance ? instance->helper() : NULL; | |
35 } | |
36 | |
37 } // namespace content | |
38 | |
OLD | NEW |