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 // Note that the single accessor, Module::Get(), is not actually implemented | 5 // Note that the single accessor, Module::Get(), is not actually implemented |
6 // in this file. This is an intentional hook that allows users of ppapi's | 6 // in this file. This is an intentional hook that allows users of ppapi's |
7 // C++ wrapper objects to provide difference semantics for how the singleton | 7 // C++ wrapper objects to provide difference semantics for how the singleton |
8 // object is accessed. | 8 // object is accessed. |
9 // | 9 // |
10 // In general, users of ppapi will also link in ppp_entrypoints.cc, which | 10 // In general, users of ppapi will also link in ppp_entrypoints.cc, which |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "ppapi/c/pp_var.h" | 29 #include "ppapi/c/pp_var.h" |
30 #include "ppapi/c/ppp_input_event.h" | 30 #include "ppapi/c/ppp_input_event.h" |
31 #include "ppapi/c/ppp_instance.h" | 31 #include "ppapi/c/ppp_instance.h" |
32 #include "ppapi/c/ppp_messaging.h" | 32 #include "ppapi/c/ppp_messaging.h" |
33 #include "ppapi/cpp/input_event.h" | 33 #include "ppapi/cpp/input_event.h" |
34 #include "ppapi/cpp/instance.h" | 34 #include "ppapi/cpp/instance.h" |
35 #include "ppapi/cpp/rect.h" | 35 #include "ppapi/cpp/rect.h" |
36 #include "ppapi/cpp/resource.h" | 36 #include "ppapi/cpp/resource.h" |
37 #include "ppapi/cpp/url_loader.h" | 37 #include "ppapi/cpp/url_loader.h" |
38 #include "ppapi/cpp/var.h" | 38 #include "ppapi/cpp/var.h" |
| 39 #include "ppapi/cpp/view.h" |
39 | 40 |
40 namespace pp { | 41 namespace pp { |
41 | 42 |
42 // PPP_InputEvent implementation ----------------------------------------------- | 43 // PPP_InputEvent implementation ----------------------------------------------- |
43 | 44 |
44 PP_Bool InputEvent_HandleEvent(PP_Instance pp_instance, PP_Resource resource) { | 45 PP_Bool InputEvent_HandleEvent(PP_Instance pp_instance, PP_Resource resource) { |
45 Module* module_singleton = Module::Get(); | 46 Module* module_singleton = Module::Get(); |
46 if (!module_singleton) | 47 if (!module_singleton) |
47 return PP_FALSE; | 48 return PP_FALSE; |
48 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); | 49 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if (found == module_singleton->current_instances_.end()) | 83 if (found == module_singleton->current_instances_.end()) |
83 return; | 84 return; |
84 | 85 |
85 // Remove it from the map before deleting to try to catch reentrancy. | 86 // Remove it from the map before deleting to try to catch reentrancy. |
86 Instance* obj = found->second; | 87 Instance* obj = found->second; |
87 module_singleton->current_instances_.erase(found); | 88 module_singleton->current_instances_.erase(found); |
88 delete obj; | 89 delete obj; |
89 } | 90 } |
90 | 91 |
91 void Instance_DidChangeView(PP_Instance pp_instance, | 92 void Instance_DidChangeView(PP_Instance pp_instance, |
92 const PP_Rect* position, | 93 PP_Resource view_resource) { |
93 const PP_Rect* clip) { | |
94 Module* module_singleton = Module::Get(); | 94 Module* module_singleton = Module::Get(); |
95 if (!module_singleton) | 95 if (!module_singleton) |
96 return; | 96 return; |
97 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); | 97 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); |
98 if (!instance) | 98 if (!instance) |
99 return; | 99 return; |
100 instance->DidChangeView(*position, *clip); | 100 instance->DidChangeView(View(view_resource)); |
101 } | 101 } |
102 | 102 |
103 void Instance_DidChangeFocus(PP_Instance pp_instance, PP_Bool has_focus) { | 103 void Instance_DidChangeFocus(PP_Instance pp_instance, PP_Bool has_focus) { |
104 Module* module_singleton = Module::Get(); | 104 Module* module_singleton = Module::Get(); |
105 if (!module_singleton) | 105 if (!module_singleton) |
106 return; | 106 return; |
107 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); | 107 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); |
108 if (!instance) | 108 if (!instance) |
109 return; | 109 return; |
110 instance->DidChangeFocus(PP_ToBool(has_focus)); | 110 instance->DidChangeFocus(PP_ToBool(has_focus)); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface( | 210 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface( |
211 PPB_CORE_INTERFACE)); | 211 PPB_CORE_INTERFACE)); |
212 if (!core) | 212 if (!core) |
213 return false; | 213 return false; |
214 core_ = new Core(core); | 214 core_ = new Core(core); |
215 | 215 |
216 return Init(); | 216 return Init(); |
217 } | 217 } |
218 | 218 |
219 } // namespace pp | 219 } // namespace pp |
OLD | NEW |