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_input_event_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_input_event_impl.h" |
6 | 6 |
7 #include "ppapi/shared_impl/var.h" | 7 #include "ppapi/shared_impl/var.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" | 9 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 10 #include "webkit/plugins/ppapi/resource_helper.h" |
10 | 11 |
11 using ppapi::InputEventData; | 12 using ppapi::InputEventData; |
12 using ppapi::InputEventImpl; | 13 using ppapi::InputEventImpl; |
13 using ppapi::StringVar; | 14 using ppapi::StringVar; |
14 using ppapi::thunk::PPB_InputEvent_API; | 15 using ppapi::thunk::PPB_InputEvent_API; |
15 | 16 |
16 namespace webkit { | 17 namespace webkit { |
17 namespace ppapi { | 18 namespace ppapi { |
18 | 19 |
19 PPB_InputEvent_Impl::PPB_InputEvent_Impl(PluginInstance* instance, | 20 PPB_InputEvent_Impl::PPB_InputEvent_Impl(PP_Instance instance, |
20 const InputEventData& data) | 21 const InputEventData& data) |
21 : Resource(instance), | 22 : Resource(instance), |
22 InputEventImpl(data) { | 23 InputEventImpl(data) { |
23 } | 24 } |
24 | 25 |
25 // static | |
26 PP_Resource PPB_InputEvent_Impl::Create(PluginInstance* instance, | |
27 const InputEventData& data) { | |
28 return (new PPB_InputEvent_Impl(instance, data))->GetReference(); | |
29 } | |
30 | |
31 PPB_InputEvent_API* PPB_InputEvent_Impl::AsPPB_InputEvent_API() { | 26 PPB_InputEvent_API* PPB_InputEvent_Impl::AsPPB_InputEvent_API() { |
32 return this; | 27 return this; |
33 } | 28 } |
34 | 29 |
35 PP_Var PPB_InputEvent_Impl::StringToPPVar(const std::string& str) { | 30 PP_Var PPB_InputEvent_Impl::StringToPPVar(const std::string& str) { |
36 return StringVar::StringToPPVar(instance()->module()->pp_module(), str); | 31 PluginModule* plugin_module = ResourceHelper::GetPluginModule(this); |
| 32 if (!plugin_module) |
| 33 return PP_MakeUndefined(); |
| 34 return StringVar::StringToPPVar(plugin_module->pp_module(), str); |
37 } | 35 } |
38 | 36 |
39 } // namespace ppapi | 37 } // namespace ppapi |
40 } // namespace webkit | 38 } // namespace webkit |
OLD | NEW |