28 #include "ppapi/c/pp_instance.h"
29 #include "ppapi/c/pp_var.h"
30 #include "ppapi/c/ppp_input_event.h"
31 #include "ppapi/c/ppp_instance.h"
32 #include "ppapi/c/ppp_messaging.h"
47 if (!module_singleton)
67 if (!module_singleton)
73 module_singleton->current_instances_[pp_instance] = instance;
74 return PP_FromBool(instance->
Init(argc, argn, argv));
79 if (!module_singleton)
81 Module::InstanceMap::iterator found =
82 module_singleton->current_instances_.find(instance);
83 if (found == module_singleton->current_instances_.end())
88 module_singleton->current_instances_.erase(found);
95 if (!module_singleton)
105 if (!module_singleton)
116 if (!module_singleton)
136 if (!module_singleton)
163 if (strcmp(interface_name, PPP_INPUT_EVENT_INTERFACE) == 0)
165 if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0)
167 if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0)
171 InterfaceMap::const_iterator found = additional_interfaces_.find(
172 std::string(interface_name));
173 if (found != additional_interfaces_.end())
174 return found->second;
180 return get_browser_interface_(interface_name);
184 InstanceMap::iterator found = current_instances_.find(instance);
185 if (found == current_instances_.end())
187 return found->second;
191 const void* vtable) {
197 if (existing_interface) {
201 additional_interfaces_[interface_name] = vtable;
205 PPB_GetInterface get_browser_interface) {
211 PPB_CORE_INTERFACE));
214 core_ =
new Core(core);
virtual Instance * CreateInstance(PP_Instance instance)=0
PP_Bool InputEvent_HandleEvent(PP_Instance pp_instance, PP_Resource resource)
virtual bool Init(uint32_t argc, const char *argn[], const char *argv[])
virtual void DidChangeView(const View &view)
void Instance_DidChangeFocus(PP_Instance pp_instance, PP_Bool has_focus)
virtual bool HandleInputEvent(const pp::InputEvent &event)
virtual void HandleMessage(const Var &message)
const void * GetBrowserInterface(const char *interface_name)
void AddPluginInterface(const std::string &interface_name, const void *vtable)
PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance, PP_Resource pp_url_loader)
virtual void DidChangeFocus(bool has_focus)
static PPP_Instance instance_interface
bool InternalInit(PP_Module mod, PPB_GetInterface get_browser_interface)
const PPP_InputEvent input_event_interface
Instance * InstanceForPPInstance(PP_Instance instance)
void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var)
PP_Bool Instance_DidCreate(PP_Instance pp_instance, uint32_t argc, const char *argn[], const char *argv[])
void Instance_DidDestroy(PP_Instance instance)
void Instance_DidChangeView(PP_Instance pp_instance, PP_Resource view_resource)
PPB_GetInterface get_browser_interface() const
static PPP_Messaging instance_messaging_interface
A generic type used for passing data types between the module and the page.
APIs related to memory management, time, and threads.
virtual bool HandleDocumentLoad(const URLLoader &url_loader)
const void * GetPluginInterface(const char *interface_name)