${CMAKE_CURRENT_SOURCE_DIR}/src/plugin-loading
${CMAKE_CURRENT_SOURCE_DIR}/src/js-overlay
${CMAKE_CURRENT_SOURCE_DIR}/src/wrt-popup/ace/popup-runner
- ${CMAKE_CURRENT_SOURCE_DIR}/src/plugins_ipc_message)
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/plugins_ipc_message
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/dispatch-event)
##############################################################################
# Build type
configure_and_install_pkg(wrt-popup-wrt-runner.pc)
configure_and_install_pkg(wrt-plugins-api-support.pc)
configure_and_install_pkg(wrt-plugins-ipc-message.pc)
+configure_and_install_pkg(wrt-dispatch-event.pc)
################################################################################
# Cache
wrt-popup-ace-runtime system::homedir rwx--
wrt-popup-ace-runtime device::app_logging -w---
wrt-popup-ace-runtime ail::db rw---
-wrt-popup-ace-runtime xorg -wx--
+wrt-popup-ace-runtime xorg rwx--
wrt-popup-ace-runtime isf r-x--
wrt-popup-ace-runtime system::vconf rwx--
wrt-popup-ace-runtime sound_server rw---
wrt-popup-wrt-runtime system::homedir rwx--
wrt-popup-wrt-runtime device::app_logging -w---
wrt-popup-wrt-runtime ail::db rw---
-wrt-popup-wrt-runtime xorg -wx--
+wrt-popup-wrt-runtime xorg rwx--
wrt-popup-wrt-runtime isf r-x--
wrt-popup-wrt-runtime system::vconf rwx--
wrt-popup-wrt-runtime sound_server rw---
-#git:framework/web/wrt-plugins-common wrt-plugins-common_0.3.86.2
+#git:framework/web/wrt-plugins-common
Name: wrt-plugins-common
Summary: wrt-plugins common library
-Version: 0.3.86.2
+Version: 0.3.94
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
--- /dev/null
+prefix=/usr
+project_name=@CMAKE_PROJECT_NAME@
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include/wrt-dispatch-event
+
+Name: wrt dispatch event support
+Description: Support to dispatch DOM event
+Version: @CMAKE_PROJECT_VERSION@
+Requires: dpl-efl ewebkit2
+Libs: -L${libdir} -lwrt-dispatch-event
+Cflags: -I${includedir}
add_subdirectory(js-overlay)
add_subdirectory(Commons)
add_subdirectory(CommonsJavaScript)
+add_subdirectory(dispatch-event)
add_subdirectory(modules)
add_subdirectory(standards)
add_subdirectory(wrt-popup)
m_classTemplate = classD->js_class_template_getter_fun();
}
if (classD->class_options) {
- LogDebug("class options is not a null");
m_options = OptionsPtr(new Options(classD->class_options));
}
}
--- /dev/null
+# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# @file CMakeLists.txt
+# @author Tae-Jeong Lee (taejeong.lee@samsung.com)
+# @version 1.0
+#
+
+pkg_search_module(webkit2 REQUIRED ewebkit2)
+pkg_search_module(dpl REQUIRED dpl-efl)
+
+SET(TARGET_NAME wrt-dispatch-event)
+
+SET(SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/dispatch_event_support.cpp
+)
+
+INCLUDE_DIRECTORIES(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${webkit2_INCLUDE_DIRS}
+ ${dpl_INCLUDE_DIRS}
+)
+
+ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
+
+TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ ${webkit2_LIBRARIES}
+ ${dpl_LIBRARIES}
+)
+
+SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ COMPILE_FLAGS -fPIC
+ LINK_FLAGS "-Wl,--as-needed -Wl,--hash-style=both"
+)
+
+SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ SOVERSION ${CMAKE_PROJECT_API_VERSION}
+ VERSION ${CMAKE_PROJECT_VERSION}
+)
+
+INSTALL(TARGETS ${TARGET_NAME}
+ DESTINATION ${DESTINATION_LIB_PREFIX}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+)
+
+INSTALL(FILES dispatch_event_support.h DESTINATION include/wrt-dispatch-event)
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ *
+ * @file dispatch_event_support.cpp
+ * @author Tae-Jeong Lee (taejeong.lee@samsung.com)
+ * @version 0.1
+ * @brief
+ */
+
+#ifndef _DISPATCH_EVENT_SUPPORT_CPP_
+#define _DISPATCH_EVENT_SUPPORT_CPP_
+
+#include <string>
+#include <JavaScriptCore/JavaScript.h>
+#include <dpl/log/log.h>
+
+#include "dispatch_event_support.h"
+
+namespace DispatchEventSupport {
+
+static std::string getExceptionString(JSContextRef context, JSValueRef exception)
+{
+ if (exception)
+ {
+ JSStringRef jsString = JSValueToStringCopy(context, exception, NULL);
+ size_t bufSize = JSStringGetMaximumUTF8CStringSize(jsString);
+
+ char* buf = new char[bufSize];
+ JSStringGetUTF8CString(jsString, buf, bufSize);
+ JSStringRelease(jsString);
+
+ std::string ret = buf;
+ delete[] buf;
+
+ return ret;
+ }
+ else
+ {
+ return "NULL";
+ }
+}
+
+void dispatchAppServiceEvent(JSContextRef context, const float scale, const std::string bundle)
+{
+ LogDebug("DispatchTizenServiceEvent(" << context << ", " << scale << ", " << bundle << ")");
+
+ if (context != NULL)
+ {
+ std::stringstream script;
+
+ script << "var __event = document.createEvent(\"CustomEvent\");\n"
+ << "__event.initCustomEvent(\"appservice\", true, true);\n"
+ << "__event.scale = " << scale << ";\n"
+ << "__event.__bundle = \"" << bundle << "\";\n"
+ << "document.dispatchEvent(__event);\n"
+ << "\n"
+ << "for (var i=0; i < window.frames.length; i++)\n"
+ << "{ window.frames[i].document.dispatchEvent(__event); }";
+
+ // just for debugging
+ // LogDebug("script :\n" << script.str());
+
+ JSValueRef exception = NULL, ret = NULL;
+ JSStringRef jsScript = JSStringCreateWithUTF8CString(script.str().c_str());
+
+ ret = JSEvaluateScript(context, jsScript, NULL, NULL, 1, &exception);
+
+ JSStringRelease(jsScript);
+
+ LogDebug("JSEvaluateScript() - ret:" << ret << ", exception:" << exception << " (" << getExceptionString(context, exception) << ")");
+ }
+}
+
+void dispatchSoftKeyboardChangeEvent(JSContextRef context, const std::string state, const int width, const int height)
+{
+ LogDebug("dispatchSoftKeyboardChangeEvent(" << context << ", " << state << ", " << width << ", " << height << ")");
+
+ if (context != NULL)
+ {
+ std::stringstream script;
+
+ script << "var __event = document.createEvent(\"CustomEvent\");\n"
+ << "__event.initCustomEvent(\"softkeyboardchange\", true, true);\n"
+ << "__event.state = \"" << state << "\";\n"
+ << "__event.width = " << width << ";\n"
+ << "__event.height = " << height << ";\n"
+ << "document.dispatchEvent(__event);\n"
+ << "\n"
+ << "for (var i=0; i < window.frames.length; i++)\n"
+ << "{ window.frames[i].document.dispatchEvent(__event); }";
+
+ // just for debugging
+ // LogDebug("script :\n" << script.str());
+
+ JSValueRef exception = NULL, ret = NULL;
+ JSStringRef jsScript = JSStringCreateWithUTF8CString(script.str().c_str());
+
+ ret = JSEvaluateScript(context, jsScript, NULL, NULL, 1, &exception);
+
+ JSStringRelease(jsScript);
+
+ LogDebug("JSEvaluateScript() - ret:" << ret << ", exception:" << exception << " (" << getExceptionString(context, exception) << ")");
+ }
+}
+
+void dispatchStorageEvent(JSContextRef context, const std::string key, const std::string oldValue, const std::string newValue, const std::string url)
+{
+ LogDebug("dispatchStorageEvent(" << context << ", " << key << ", " << oldValue << ", " << newValue << ", " << url << ")");
+
+ if (context != NULL)
+ {
+ std::stringstream script;
+
+ script << "var __event = document.createEvent(\"CustomEvent\");\n"
+ << "__event.initCustomEvent(\"storage\", true, true);\n"
+ << "__event.key = \"" << key << "\";\n"
+ << "__event.oldValue = \"" << oldValue << "\";\n"
+ << "__event.newValue = \"" << newValue << "\";\n"
+ << "__event.url = \"" << url << "\";\n"
+ << "__event.storageArea = widget.preferences;\n"
+ << "document.dispatchEvent(__event);\n"
+ << "\n"
+ << "for (var i=0; i < window.frames.length; i++)\n"
+ << "{ window.frames[i].document.dispatchEvent(__event); }";
+
+
+ // just for debugging
+ // LogDebug("script :\n" << script.str());
+
+ JSValueRef exception = NULL, ret = NULL;
+ JSStringRef jsScript = JSStringCreateWithUTF8CString(script.str().c_str());
+
+ ret = JSEvaluateScript(context, jsScript, NULL, NULL, 1, &exception);
+
+ JSStringRelease(jsScript);
+
+ LogDebug("JSEvaluateScript() - ret:" << ret << ", exception:" << exception << " (" << getExceptionString(context, exception) << ")");
+ }
+}
+
+}
+#endif //_DISPATCH_EVENT_SUPPORT_CPP_
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ *
+ * @file dispatch_event_support.h
+ * @author Tae-Jeong Lee (taejeong.lee@samsung.com)
+ * @version 0.1
+ * @brief
+ */
+
+#ifndef _DISPATCH_EVENT_SUPPORT_H_
+#define _DISPATCH_EVENT_SUPPORT_H_
+
+namespace DispatchEventSupport {
+
+void dispatchAppServiceEvent(JSContextRef context, const float scale, const std::string bundle);
+void dispatchSoftKeyboardChangeEvent(JSContextRef context, const std::string state, const int width, const int height);
+void dispatchStorageEvent(JSContextRef context, const std::string key, const std::string oldValue, const std::string newValue, const std::string url);
+
+}
+#endif //_DISPATCH_EVENT_SUPPORT_H_
SET(SRCS
${CMAKE_CURRENT_SOURCE_DIR}/js_overlay_support.cpp
${CMAKE_CURRENT_SOURCE_DIR}/js_function_manager.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/js_overlay_addEventListener.cpp
${CMAKE_CURRENT_SOURCE_DIR}/js_overlay_functions.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/js_iframe_support.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/JSClass/JSStorageEvent.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/JSClass/JSTizenServiceEvent.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/JSClass/JSSoftKeyboardChangeEvent.cpp
)
INCLUDE_DIRECTORIES(
#include <dpl/singleton_safe_impl.h>
#include <js_function_manager.h>
-#include <js_iframe_support.h>
#include <js_overlay_functions.h>
-#include <js_overlay_addEventListener.h>
#include <wrt_plugin_export.h>
-using namespace WrtPlugins::W3C;
-
IMPLEMENT_SAFE_SINGLETON(JsFunctionManager)
namespace {
const char* JSPRINT_NAME = "jsPrint";
const char* JSGLOBAL_OBJECT = "GLOBAL_OBJECT";
const char* JSHOOK_NAME = "jsHook";
-const char* ADD_EVENT_LISTENER_NAME = "addEventListener";
}
namespace JavaScriptFunctions {
reinterpret_cast<js_function_impl>(JSCFunctions::JavaScriptPrintProc)
};
-class_definition_options_t addEventListenerOptions = {
- JS_FUNCTION,
- CREATE_INSTANCE,
- ALWAYS_NOTICE,
- OVERLAYED_BEFORE_ORIGINAL,
- IFrameSupport::RegisterAddEventListener,
- NULL,
- reinterpret_cast<js_function_impl>(AddEventListenerSupport::
- AddEventListener)
-};
-
js_entity_definition_t jsPrint = {
JSGLOBAL_OBJECT,
JSPRINT_NAME,
&jsHookfunctionsOptions
};
-js_entity_definition_t addEventListener = {
- JSGLOBAL_OBJECT,
- ADD_EVENT_LISTENER_NAME,
- "",
- NULL,
- NULL,
- &addEventListenerOptions
-};
const js_entity_definition_ptr_t jsPrintPtr = &jsPrint;
const js_entity_definition_ptr_t jsHookPtr = &jsHook;
-const js_entity_definition_ptr_t addEventListenerPtr = &addEventListener;
}
bool JsFunctionManager::initialize()
JSObjectDeclarationPtr jsHookObj(
new JSObjectDeclaration(JavaScriptFunctions::jsHookPtr));
- JSObjectDeclarationPtr addEventListenerObj(
- new JSObjectDeclaration(JavaScriptFunctions::addEventListenerPtr));
-
m_functions.push_back(jsPrintObj);
m_functions.push_back(jsHookObj);
- m_functions.push_back(addEventListenerObj);
return true;
}
// 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 = ".";
JSObjectPtr frameObject =
JavaScriptInterfaceSingleton::Instance().getGlobalObject(context);
- AddEventListenerSupport::RemoveIFrame(frameObject);
m_iframeSupport.unregisterIframe(frameObject);
}
void Explorer::callEventListeners(CustomEventType eventType, void* data)
{
+#if 0 // deprecated
using namespace WrtPlugins::Tizen;
// get iframe objects from javascript global context
JavaScriptInterface::ObjectsListPtr frameLists =
LogInfo("Not supported custom event type");
return;
}
+#endif
}
WindowPropertySupport* Explorer::getWindowPropertySupport()
PluginPtr Plugin::LoadFromFile(const std::string& fileName)
{
+ static bool logEnable = (getenv("WRT_LOAD_PLUGINS_LOG_ENABLE") != NULL);
+
LogDebug("LoadFromFile" << fileName);
void *dllHandle;
if (getWidgetEntityMapProcPtr) {
rawClassList = (*getWidgetEntityMapProcPtr)();
- LogDebug(
+
+ if (logEnable)
+ {
+ LogDebug(
"rawClassList : " << rawClassList <<
"by getWidgetClassMapProcPtr()");
+ }
} else {
rawClassList =
static_cast<const js_entity_definition_t *>(dlsym(dllHandle,
PLUGIN_CLASS_MAP_NAME));
- LogDebug("rawClassList : " << rawClassList);
+ if (logEnable) { LogDebug("rawClassList : " << rawClassList); }
}
if (NULL == onWidgetStartProcPtr || NULL == onWidgetStopProcPtr ||
/*NULL == onWidgetInitProcPtr ||*/ NULL == rawClassList)
{
- LogWarning("#####");
- LogWarning(
- "##### Warning: The following plugin does not support new plugin API.");
- LogWarning(
- "##### Old plugin API is deprecated. Please update it to new API");
- LogWarning("#####");
- LogWarning(
- "##### Plugin: " << fileName <<
- " has got deprecated or invalid API");
- LogWarning("#####");
+ if (logEnable)
+ {
+ LogWarning("#####");
+ LogWarning(
+ "##### Warning: The following plugin does not support new plugin API.");
+ LogWarning(
+ "##### Old plugin API is deprecated. Please update it to new API");
+ LogWarning("#####");
+ LogWarning(
+ "##### Plugin: " << fileName <<
+ " has got deprecated or invalid API");
+ LogWarning("#####");
+ }
// Will not load plugin
dlclose(dllHandle);
return empty;
}
- LogInfo("#####");
- LogInfo("##### Plugin: " << fileName << " supports new plugin API");
- LogInfo("#####");
- LogInfo("##### $onWidgetStartProc: " << onWidgetStartProcPtr);
- LogInfo("##### $onWidgetInitProc: " << onWidgetInitProcPtr);
- LogInfo("##### $onWidgetStopProc " << onWidgetStopProcPtr);
- LogInfo("##### $onFrameLoadProc " << onFrameLoadProcPtr);
- LogInfo("##### $onFrameUnloadProc " << onFrameUnloadProcPtr);
- LogInfo("##### $classMap: " << reinterpret_cast<const void *>(rawClassList));
- LogInfo("##### ");
- LogInfo("##### Class map:");
+ if (logEnable)
+ {
+ LogInfo("#####");
+ LogInfo("##### Plugin: " << fileName << " supports new plugin API");
+ LogInfo("#####");
+ LogInfo("##### $onWidgetStartProc: " << onWidgetStartProcPtr);
+ LogInfo("##### $onWidgetInitProc: " << onWidgetInitProcPtr);
+ LogInfo("##### $onWidgetStopProc " << onWidgetStopProcPtr);
+ LogInfo("##### $onFrameLoadProc " << onFrameLoadProcPtr);
+ LogInfo("##### $onFrameUnloadProc " << onFrameUnloadProcPtr);
+ LogInfo("##### $classMap: " << reinterpret_cast<const void *>(rawClassList));
+ LogInfo("##### ");
+ LogInfo("##### Class map:");
+ }
const js_entity_definition_t *rawEntityListIterator = rawClassList;
ClassPtrList classList(new Plugin::ClassList());
while (rawEntityListIterator->parent_name != NULL &&
rawEntityListIterator->object_name != NULL)
{
- // Logging
- LogInfo("#####");
- LogInfo("##### [" << rawEntityListIterator->object_name << "]: ");
- LogInfo("##### Interface: " <<
- rawEntityListIterator->interface_name);
- LogInfo("##### Parent: " << rawEntityListIterator->parent_name);
+ if (logEnable)
+ {
+ // Logging
+ LogInfo("#####");
+ LogInfo("##### [" << rawEntityListIterator->object_name << "]: ");
+ LogInfo("##### Interface: " <<
+ rawEntityListIterator->interface_name);
+ LogInfo("##### Parent: " << rawEntityListIterator->parent_name);
+ }
// Register class
classList->push_back(ClassPtr(new Class(rawEntityListIterator)));
++rawEntityListIterator;
}
- LogInfo("#####");
-
// Load export table
LogDebug("Plugin successfuly loaded");
m_pluginModels.insert(model);
}
- void PluginContainerSupport::readRootPluginsList()
+void PluginContainerSupport::readRootPluginsList()
{
LogDebug("Reading root plugins list from so files...");
- PluginHandleList pluginHandleList =
- PluginDAOReadOnly::getPluginHandleList();
-
- FOREACH(it_pluginHandle, pluginHandleList)
- {
- PluginDAOReadOnly pluginDao(*it_pluginHandle);
- PluginHandleSetPtr retDependencies;
- retDependencies = pluginDao.getLibraryDependencies();
- if (retDependencies->empty()) {
- LogDebug("Root plugin Handle: " << *it_pluginHandle);
- m_rootPluginsList.push_back(*it_pluginHandle);
- }
- }
+ m_rootPluginsList = PluginDAOReadOnly::getRootPluginHandleList();
}
FeatureModelPtr
//add standard objects
LogDebug("Preload plugins so file");
- PluginContainerSupport::PluginsList pluginList =
- m_pluginsSupport->getPluginsList();
+ PluginContainerSupport::PluginsList rootPluginList =
+ m_pluginsSupport->getRootPlugins();
- FOREACH(it, pluginList)
+ FOREACH(it, rootPluginList)
{
PluginModelPtr& pluginModel = *it;
-
- if (!pluginModel->LibraryDependencies.Get()->empty()) {
- // Only Root Object
- continue;
- }
-
PluginPtr pluginLib = pluginModel->LibraryInstance.Get();
if (!pluginLib) {
#include <dpl/assert.h>
static WKBundleRef s_injectedBundleRef = NULL;
+static unsigned int s_xWindowHandle = 0;
namespace {
std::string toString(WKStringRef str)
s_injectedBundleRef = bundleRef;
}
+void IPCMessageSupport::setXwindowHandle(unsigned int handle)
+{
+ LogDebug("setXwindowHandle called");
+ s_xWindowHandle = handle;
+}
+
const char* IPCMessageSupport::sendMessageToUiProcess(
const char* name,
const char* body)
return NULL;
}
LogDebug("name = [" << name << "]");
- LogDebug("body = [" << body << "]");
+ if (body) {
+ LogDebug("body = [" << body << "]");
+ }
if (!name) {
return NULL;
}
+
+ if (!strcmp(name, "tizen://getWindowHandle")) {
+ if (s_xWindowHandle == 0) {
+ return NULL;
+ } else {
+ std::stringstream ss;
+ ss << s_xWindowHandle;
+ std::string ret = ss.str();
+ return strdup(ret.c_str());
+ }
+ }
+
WKStringRef bodyWKString = NULL;
WKStringRef nameWKString = WKStringCreateWithUTF8CString(name);
if (body) {
if (bodyWKString) {
WKRelease(bodyWKString);
}
- std::string retString = toString(static_cast<WKStringRef>(retWKType));
- WKRelease(retWKType);
-
- return strdup(retString.c_str());
+ if (retWKType) {
+ std::string retString = toString(static_cast<WKStringRef>(retWKType));
+ WKRelease(retWKType);
+ return strdup(retString.c_str());
+ } else {
+ return NULL;
+ }
+ return NULL;
}
namespace IPCMessageSupport {
void setWKBundleRef(WKBundleRef bundleRef);
+void setXwindowHandle(unsigned int handle);
const char* sendMessageToUiProcess(const char* name, const char* body);
}
${API_WIDGET_PATH}
${webkit2_INCLUDE_DIRS}
${plugin-types_INCLUDE_DIRS}
-# ${API_STORAGE_EVENT_PATH}
-# ${API_LOCALSTORAGE_PATH}
)
add_library(${TARGET_NAME} SHARED ${SRCS})
wrt-plugins-widget
wrt-plugins-localstorage
wrt-plugins-storageevent
+ wrt-dispatch-event
)
INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION /usr/lib/wrt-plugins/w3c-widget-interface)
#include <CommonsJavaScript/JSDOMExceptionFactory.h>
#include <StorageEvent/StorageEventMgr.h>
#include <StorageEvent/IStorageEvent.h>
-#include <js-overlay/js_iframe_support.h>
-#include <js-overlay/js_overlay_addEventListener.h>
+#include <dispatch-event/dispatch_event_support.h>
+
+// import temporarily from JSContextRefPrivate.h
+extern "C" JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx);
using namespace std;
using namespace WrtDeviceApis;
std::string key = converter.toString(arguments[0]);
- auto event = modifyItemAndCreateEvent(ModificationType::RemoveItem,
- thisObject,
- key);
-
- auto iframe = IFrameSupport::
- getIFrameObjectForWidget(getWidgetObject(thisObject));
+ DPL::Optional<std::string> oldValue = getIStorage(thisObject)->getValue(key);
+ getIStorage(thisObject)->removeItem(key);
+ DPL::Optional<std::string> newValue = getIStorage(thisObject)->getValue(key);
- Assert(iframe && "Iframe is NULL");
+ JSContextRef g_context = JSContextGetGlobalContext(context);
+ std::string oldValueStr = "";
+ std::string newValueStr = "";
- AddEventListenerSupport::
- CallStorageListenersFromDifferentIFrames(iframe, event);
+ if (!!oldValue) { oldValueStr = *oldValue; }
+ if (!!newValue) { newValueStr = *newValue; }
+
+ DispatchEventSupport::dispatchStorageEvent(g_context, key, oldValueStr, newValueStr, "");
LogDebug("end");
return JSValueMakeNull(context);
std::string key = converter.toString(arguments[0]);
std::string value = converter.tryString(arguments[1]);
- auto event = modifyItemAndCreateEvent(ModificationType::SetItem,
- thisObject,
- key,
- value);
+ DPL::Optional<std::string> oldValue = getIStorage(thisObject)->getValue(key);
+ getIStorage(thisObject)->setItem(key, value, false);
+ DPL::Optional<std::string> newValue = getIStorage(thisObject)->getValue(key);
- auto iframe = IFrameSupport::
- getIFrameObjectForWidget(getWidgetObject(thisObject));
- Assert(iframe && "Iframe is NULL");
+ JSContextRef g_context = JSContextGetGlobalContext(context);
+ std::string oldValueStr = "";
+ std::string newValueStr = "";
- AddEventListenerSupport::
- CallStorageListenersFromDifferentIFrames(iframe, event);
+ if (!!oldValue) { oldValueStr = *oldValue; }
+ if (!!newValue) { newValueStr = *newValue; }
+
+ DispatchEventSupport::dispatchStorageEvent(g_context, key, oldValueStr, newValueStr, "");
LogDebug("end");
Try {
getIStorage(thisObject)->clear(false);
- auto iframe = IFrameSupport::
- getIFrameObjectForWidget(getWidgetObject(thisObject));
-
- Assert(iframe && "Iframe is NULL");
-
- //create event object
- IStorageEventPtr storageEvent = getStorageEvent();
+ JSContextRef g_context = JSContextGetGlobalContext(context);
- AddEventListenerSupport::
- CallStorageListenersFromDifferentIFrames(iframe, storageEvent);
+ DispatchEventSupport::dispatchStorageEvent(g_context, "", "", "", "");
LogDebug("end");
std::string key = converter.toString(propertyName);
std::string value = converter.toString(jvalue);
- auto event = modifyItemAndCreateEvent(ModificationType::SetItem,
- object,
- key,
- value);
+ DPL::Optional<std::string> oldValue = getIStorage(object)->getValue(key);
+ getIStorage(object)->setItem(key, value, false);
+ DPL::Optional<std::string> newValue = getIStorage(object)->getValue(key);
- auto iframe = IFrameSupport::
- getIFrameObjectForWidget(getWidgetObject(object));
- Assert(iframe && "Iframe is NULL");
+ JSContextRef g_context = JSContextGetGlobalContext(context);
+ std::string oldValueStr = "";
+ std::string newValueStr = "";
- AddEventListenerSupport::
- CallStorageListenersFromDifferentIFrames(iframe, event);
+ if (!!oldValue) { oldValueStr = *oldValue; }
+ if (!!newValue) { newValueStr = *newValue; }
+
+ DispatchEventSupport::dispatchStorageEvent(g_context, key, oldValueStr, newValueStr, "");
LogDebug("end");
#include <Widget/IWidget.h>
#include <LocalStorage/LocalStorageMgr.h>
#include <Commons/WrtAccess/WrtAccess.h>
-#include <js-overlay/js_iframe_support.h>
#define CATCH_EXCEPTION_NO_MODIFABLE \
Catch(Commons::LocalStorageValueNoModifableException) { \
js_object_instance_t iframe,
js_object_instance_t object)
{
- IFrameSupport::RegisterWidget(global_context, iframe, object);
if (!m_globalContext) {
m_globalContext = static_cast<JSContextRef>(global_context);
LogInfo("Global context acquired.");
#include <Commons/plugin_initializer_def.h>
#include <Commons/WrtAccess/WrtAccess.h>
-#include <js-overlay/js_overlay_addEventListener.h>
-#include <js-overlay/js_iframe_support.h>
#include "JSWidget.h"
#include "JSPreferences.h"
class_definition_options_t WidgetOptions = {
JS_CLASS,
CREATE_INSTANCE,
- ALWAYS_NOTICE,
+ NONE_NOTICE,
USE_OVERLAYED, //ignored
- IFrameSupport::RegisterWidget,
+ NULL,
NULL,
NULL
};
wrt-popup-ace-runtime system::homedir rwx
wrt-popup-ace-runtime device::app_logging w
wrt-popup-ace-runtime ail::db rw
-wrt-popup-ace-runtime xorg wx
+wrt-popup-ace-runtime xorg rwx
wrt-popup-ace-runtime isf rx
wrt-popup-ace-runtime system::vconf rwx
wrt-popup-ace-runtime sound_server rw
wrt-popup-wrt-runtime system::homedir rwx
wrt-popup-wrt-runtime device::app_logging w
wrt-popup-wrt-runtime ail::db rw
-wrt-popup-wrt-runtime xorg wx
+wrt-popup-wrt-runtime xorg rwx
wrt-popup-wrt-runtime isf rx
wrt-popup-wrt-runtime system::vconf rwx
wrt-popup-wrt-runtime sound_server rw