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.
5 #include "webkit/plugins/ppapi/resource_helper.h"
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/ppapi_plugin_instance.h"
11 #include "webkit/plugins/ppapi/plugin_module.h"
12 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
18 PluginInstance
* ResourceHelper::GetPluginInstance(
19 const ::ppapi::Resource
* resource
) {
20 return PPInstanceToPluginInstance(resource
->pp_instance());
23 PluginInstance
* ResourceHelper::PPInstanceToPluginInstance(
24 PP_Instance instance
) {
25 return HostGlobals::Get()->GetInstance(instance
);
28 PluginModule
* ResourceHelper::GetPluginModule(
29 const ::ppapi::Resource
* resource
) {
30 PluginInstance
* instance
= GetPluginInstance(resource
);
31 return instance
? instance
->module() : NULL
;
34 PluginDelegate
* ResourceHelper::GetPluginDelegate(
35 const ::ppapi::Resource
* resource
) {
36 PluginInstance
* instance
= GetPluginInstance(resource
);
37 return instance
? instance
->delegate() : NULL
;