#include <algorithm>
#include <dpl/foreach.h>
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
#include "explorer.h"
#include "plugin_property_support.h"
// JS overlay
-#include <js_overlay_support.h>
#include <js_overlay_types.h>
-#include <js_overlay_addEventListener.h>
-#include <TizenServiceEvent/ITizenServiceEvent.h>
-#include <TizenServiceEvent/TizenServiceEvent.h>
-#include <SoftKeyboardChangeEvent/ISoftKeyboardChangeEvent.h>
-#include <SoftKeyboardChangeEvent/SoftKeyboardChangeEvent.h>
-#include <JSClass/JSTizenServiceEvent.h>
-#include <JSClass/JSSoftKeyboardChangeEvent.h>
namespace {
//const char* SEPARATOR = ".";
m_context(context)
{
if (!context) {
- LogError("Context is NULL");
+ _W("Context is NULL");
return;
}
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);
}
const string& requestedProperty,
JSObjectPtr providedObject)
{
- LogDebug("Requested Property: " << requestedProperty);
+ _D("Requested Property: %s", requestedProperty.c_str());
if (!providedObject) {
- LogError("Provided object is empty");
+ _W("Provided object is empty");
return JSObjectPtr();
}
currentObjectName = currentPropertyRequested.substr(0, pos);
if (currentPropertyRequested.size() <= pos + 1) {
- LogError("Wrong name of requested property");
+ _W("Wrong name of requested property");
return JSObjectPtr();
}
currentPropertyRequested = currentPropertyRequested.substr(pos + 1);
currentObject = getJSObjectProperty(currentObjectName, currentObject);
if (!currentObject) {
- LogError("Failed to get property: " << currentObjectName);
+ _W("Failed to get property: %s", currentObjectName.c_str());
return JSObjectPtr();
}
}
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 (string::npos != pos) {
- LogError("ParentName not allowed");
+ _W("ParentName not allowed");
return false;
}
auto masterObject = getJSObjectProperty(masterName, m_globalObject);
}
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(
- "Register object. Provided object name: '" << providedObjectName
- <<
- "', registration of: '" << declaration->getName() << "'");
-
+ _D("%s <- %s", providedObjectName.c_str(), declaration->getName().c_str());
std::string fullParentName = declaration->getParentName();
- LogDebug("Parent name: " << declaration->getParentName());
if (fullParentName == providedObjectName) {
- LogDebug("Provided object match equaly to requested parent");
+ \r_D("Provided object was matched!!");
return register_(declaration, providedObject, context);
}
//check if object exists in fullParentName
auto pos = fullParentName.find(providedObjectName);
if (pos == string::npos) {
- LogError(
- "Object: " << declaration->getName()
- << " should be child of: " <<
- declaration->getParentName()
- << " but you provided object: " <<
- providedObjectName);
-
+ _W("Object: %s should be child of: %s but you provided object: %s",
+ declaration->getName().c_str(),
+ declaration->getParentName().c_str(),
+ providedObjectName.c_str());
return false;
}
if (fullParentName.size() <= pos + providedObjectName.size() + 1) {
- LogError("Invalid object name");
+ _W("Invalid object name");
return false;
}
currentRequesteProperty, providedObject);
if (!jsObject->getObject()) {
- LogError(
- "Object: '" << declaration->getName()
- << "' should be child of: '" <<
- declaration->getParentName()
- << "'. you provided object: '" <<
- providedObjectName
- << "' but object is null");
-
+ _W("Object: %s should be child of: %s. you provided object: %s but object is null",
+ declaration->getName().c_str(),
+ declaration->getParentName().c_str(),
+ providedObjectName.c_str());
return false;
}
JSObjectPtr parent,
JSGlobalContextRef context)
{
- LogInfo("Registration object: " << declaration->getParentName() <<
- "<-" << declaration->getName());
-
+ _D("Registration object: %s <- %s",
+ declaration->getParentName().c_str(),
+ declaration->getName().c_str());
Assert(parent && "parent object is NULL");
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(),
- newObject);
+ objectInstance);
//notice
if (declaration->getOptions() &&
JSGlobalContextRef context)
{
if (declaration->getParentName() == GLOBAL_OBJECT_NAME) {
- LogDebug("Connect to Global object of IFRAME");
+ _D("Connect to Global object of IFRAME");
register_(declaration, frameObject, context);
return;
}
//PIM SUPPORT
{
- LogWarning("Connect to NOT global object of IFRAME");
+ _D("Connect to NOT global object of IFRAME");
//it should be master object name
string masterName = declaration->getParentName();
auto pos = masterName.find(".");
if (string::npos != pos) {
- LogError("ParentName not allowed");
+ _W("ParentName not allowed");
return;
}
auto masterObject = getJSObjectProperty(masterName, frameObject);
if (!masterObject->getObject()) {
- LogError("Object not exist in frame");
+ _W("Object not exist in frame");
return;
}
register_(declaration, masterObject, context);
void Explorer::loadFrame(JSGlobalContextRef context)
{
- LogDebug("Frame attached");
-
JSObjectPtr frameObject =
JavaScriptInterfaceSingleton::Instance().getGlobalObject(context);
- LogDebug("Register main frame");
- //register main frame;
-
if (frameObject->getObject() == m_globalObject->getObject()) {
// Main page was already loaded from constructor
- LogDebug("Main page loaded");
+ _W("Main page loaded");
return;
}
FOREACH(object, iframeObjects)
{
- LogDebug("Register object: " << (*object)->getName() );
-
+ _D("Register object: %s", (*object)->getName().c_str());
registerObjectIntoIframe(*object, frameObject, context);
}
}
void Explorer::unloadFrame(JSGlobalContextRef context)
{
- LogDebug("Frame detached");
-
JSObjectPtr frameObject =
JavaScriptInterfaceSingleton::Instance().getGlobalObject(context);
-
- AddEventListenerSupport::RemoveIFrame(frameObject);
m_iframeSupport.unregisterIframe(frameObject);
}
void Explorer::removePluginsFromIframes()
{
- LogDebug("Remove plugins from iframes");
-
if (m_iframeSupport.hasIframes()) {
- LogDebug("Removing iframes");
JavaScriptInterfaceSingleton::Instance().removeIframes(m_context);
}
}
void Explorer::deregisterObject(const JSObjectDeclarationPtr& declaration)
{
- LogDebug("Deregister object " << declaration->getName());
-
if (GLOBAL_OBJECT_NAME != declaration->getParentName()) {
- LogWarning("Ignored remove property " << declaration->getName());
+ _W("Ignored remove property %s", declaration->getName().c_str());
return;
}
void Explorer::cleanIframesData()
{
- LogDebug("Clean iframes data");
m_iframeSupport.clean();
}
-void Explorer::callEventListeners(CustomEventType eventType, void* data)
+void Explorer::callEventListeners(CustomEventType /*eventType*/, void* /*data*/)
{
+#if 0 // deprecated
using namespace WrtPlugins::Tizen;
// get iframe objects from javascript global context
JavaScriptInterface::ObjectsListPtr frameLists =
args->state,
args->width,
args->height));
- LogInfo("softkeyboard event's state: " << args->state);
+ LogDebug("softkeyboard event's state: " << args->state);
// call js callback function for 'softkeyboardchange' js event on each
// frame
frame, eventType, eventObject);
}
} else {
- LogInfo("Not supported custom event type");
+ LogDebug("Not supported custom event type");
return;
}
+#endif
}
WindowPropertySupport* Explorer::getWindowPropertySupport()