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" | |
10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 9 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
11 #include "webkit/plugins/ppapi/plugin_module.h" | 10 #include "webkit/plugins/ppapi/plugin_module.h" |
12 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 11 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
13 #include "webkit/plugins/ppapi/resource_tracker.h" | 12 #include "webkit/plugins/ppapi/resource_tracker.h" |
14 | 13 |
15 namespace webkit { | 14 namespace webkit { |
16 namespace ppapi { | 15 namespace ppapi { |
17 | 16 |
18 // static | 17 // static |
19 PluginInstance* ResourceHelper::GetPluginInstance( | 18 PluginInstance* ResourceHelper::GetPluginInstance( |
20 const ::ppapi::Resource* resource) { | 19 const ::ppapi::Resource* resource) { |
21 ResourceTracker* tracker = HostGlobals::Get()->host_resource_tracker(); | 20 ResourceTracker* tracker = ResourceTracker::Get(); |
22 return tracker->GetInstance(resource->pp_instance()); | 21 return tracker->GetInstance(resource->pp_instance()); |
23 } | 22 } |
24 | 23 |
25 PluginModule* ResourceHelper::GetPluginModule( | 24 PluginModule* ResourceHelper::GetPluginModule( |
26 const ::ppapi::Resource* resource) { | 25 const ::ppapi::Resource* resource) { |
27 PluginInstance* instance = GetPluginInstance(resource); | 26 PluginInstance* instance = GetPluginInstance(resource); |
28 return instance ? instance->module() : NULL; | 27 return instance ? instance->module() : NULL; |
29 } | 28 } |
30 | 29 |
31 PluginDelegate* ResourceHelper::GetPluginDelegate( | 30 PluginDelegate* ResourceHelper::GetPluginDelegate( |
32 const ::ppapi::Resource* resource) { | 31 const ::ppapi::Resource* resource) { |
33 PluginInstance* instance = GetPluginInstance(resource); | 32 PluginInstance* instance = GetPluginInstance(resource); |
34 return instance ? instance->delegate() : NULL; | 33 return instance ? instance->delegate() : NULL; |
35 } | 34 } |
36 | 35 |
37 } // namespace ppapi | 36 } // namespace ppapi |
38 } // namespace webkit | 37 } // namespace webkit |
39 | 38 |
OLD | NEW |