#include "plugin_property_support.h"
// JS overlay
+#include <js_overlay_support.h>
#include <js_overlay_types.h>
namespace {
m_globalObject =
JavaScriptInterfaceSingleton::Instance().getGlobalObject(context);
+ LogDebug("Register main frame");
//register main frame;
m_iframeSupport.registerIframe(m_globalObject);
JSObjectPtr Explorer::getJSObjectProperty(const std::string& propertyName,
JSObjectPtr object)
{
+ LogDebug("Get object property " << propertyName);
return JavaScriptInterfaceSingleton::Instance().getJSObjectProperty(
m_context, object, propertyName);
}
bool Explorer::registerObject(const JSObjectDeclarationPtr& declaration,
JSGlobalContextRef context)
{
+ LogDebug("Register to global object");
+
bool retValue;
if (declaration->getParentName() == GLOBAL_OBJECT_NAME) {
+ LogDebug("Connect to Global object");
retValue = register_(declaration, m_globalObject, context);
} else { //PIM support
+ LogDebug("Connect to NOT global object");
//it should be master object name
string masterName = declaration->getParentName();
auto pos = masterName.find(".");
}
if (declaration->checkIframesSupported()) {
+ LogDebug("Iframe supported");
m_iframeSupport.registerDeclaration(declaration);
// m_iframeSupport.invokeCallbackForMainFrame(m_context,
// declaration,
// newObject);
+ } else {
+ LogDebug("Iframe NOT supported");
}
return retValue;
JSObjectPtr providedObject,
JSGlobalContextRef context)
{
- LogDebug("'" << providedObjectName << "' <- '" << declaration->getName() << "'");
+ LogDebug(
+ "Register object. Provided object name: '" << providedObjectName
+ <<
+ "', registration of: '" << declaration->getName() << "'");
std::string fullParentName = declaration->getParentName();
+ LogDebug("Parent name: " << declaration->getParentName());
if (fullParentName == providedObjectName) {
+ LogDebug("Provided object match equaly to requested parent");
return register_(declaration, providedObject, context);
}
- LogDebug("Provided object was not matched!!");
-
//check if object exists in fullParentName
auto pos = fullParentName.find(providedObjectName);
if (pos == string::npos) {
typedef JSObjectDeclaration::Options JO;
JSGlobalContextRef gContext = (context == NULL) ? m_context : context;
+ JSObjectPtr newObject;
+
JSObjectPtr objectInstance = JavaScriptInterfaceSingleton::Instance().
createObject(gContext, declaration);
+ //function creation
+ if (declaration->getOptions() &&
+ declaration->getOptions()->getType() == JO::ClassType::Function)
+ {
+ LogDebug("Loading function object " << declaration->getName());
+
+ auto type = declaration->getOptions()->getIframeOverlay();
+ if (JO::IFrameOverlay::OverlayedBeforeOriginal == type) {
+ LogDebug("Create overlayed function");
+ JSObjectPtr original =
+ JavaScriptInterfaceSingleton::Instance().
+ getJSObjectProperty(gContext,
+ parent,
+ declaration->getName());
+ newObject = JSOverlaySupport::
+ createWrappedFunction(gContext,
+ original,
+ objectInstance,
+ declaration->getName());
+ } else {
+ LogDebug("create normal function");
+ newObject = objectInstance;
+ }
+ } else { //object creation
+ newObject = objectInstance;
+ }
+
JavaScriptInterfaceSingleton::Instance().setObjectProperty(
gContext,
parent,
declaration->getName(),
- objectInstance);
+ newObject);
//notice
if (declaration->getOptions() &&
m_iframeSupport.clean();
}
-void Explorer::callEventListeners(CustomEventType /*eventType*/, void* /*data*/)
+void Explorer::callEventListeners(CustomEventType eventType, void* data)
{
#if 0 // deprecated
using namespace WrtPlugins::Tizen;