OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ppb_proxy_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_proxy_impl.h" |
6 | 6 |
7 #include "ppapi/c/private/ppb_proxy_private.h" | 7 #include "ppapi/c/private/ppb_proxy_private.h" |
8 #include "webkit/plugins/ppapi/plugin_module.h" | 8 #include "webkit/plugins/ppapi/plugin_module.h" |
| 9 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 10 #include "webkit/plugins/ppapi/resource.h" |
9 #include "webkit/plugins/ppapi/resource_tracker.h" | 11 #include "webkit/plugins/ppapi/resource_tracker.h" |
10 | 12 |
11 namespace webkit { | 13 namespace webkit { |
12 namespace ppapi { | 14 namespace ppapi { |
13 | 15 |
14 namespace { | 16 namespace { |
15 | 17 |
16 void PluginCrashed(PP_Module module) { | 18 void PluginCrashed(PP_Module module) { |
17 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module); | 19 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module); |
18 if (plugin_module) | 20 if (plugin_module) |
19 plugin_module->PluginCrashed(); | 21 plugin_module->PluginCrashed(); |
20 } | 22 } |
21 | 23 |
| 24 PP_Instance GetInstanceForResource(PP_Resource resource) { |
| 25 scoped_refptr<Resource> obj(ResourceTracker::Get()->GetResource(resource)); |
| 26 if (!obj) |
| 27 return 0; |
| 28 return obj->instance()->pp_instance(); |
| 29 } |
| 30 |
22 const PPB_Proxy_Private ppb_proxy = { | 31 const PPB_Proxy_Private ppb_proxy = { |
23 &PluginCrashed | 32 &PluginCrashed, |
| 33 &GetInstanceForResource |
24 }; | 34 }; |
25 | 35 |
26 } // namespace | 36 } // namespace |
27 | 37 |
28 // static | 38 // static |
29 const PPB_Proxy_Private* PPB_Proxy_Impl::GetInterface() { | 39 const PPB_Proxy_Private* PPB_Proxy_Impl::GetInterface() { |
30 return &ppb_proxy; | 40 return &ppb_proxy; |
31 } | 41 } |
32 | 42 |
33 } // namespace ppapi | 43 } // namespace ppapi |
34 } // namespace webkit | 44 } // namespace webkit |
OLD | NEW |