[Release] wrt-plugins-common_0.3.94 submit/tizen_2.2/20130606.111255
authorJihoon Chung <jihoon.chung@samsung.com>
Thu, 6 Jun 2013 11:12:20 +0000 (20:12 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Thu, 6 Jun 2013 11:12:20 +0000 (20:12 +0900)
34 files changed:
CMakeLists.txt
accesses.d/wrt-popup-ace-runtime.rule
accesses.d/wrt-popup-wrt-runtime.rule
packaging/wrt-plugins-common.spec
pkgconfigs/wrt-dispatch-event.pc.in [new file with mode: 0644]
src/CMakeLists.txt
src/Commons/JSObjectDeclaration.cpp [changed mode: 0644->0755]
src/dispatch-event/CMakeLists.txt [new file with mode: 0644]
src/dispatch-event/dispatch_event_support.cpp [new file with mode: 0644]
src/dispatch-event/dispatch_event_support.h [new file with mode: 0644]
src/js-overlay/CMakeLists.txt
src/js-overlay/deprecated/JSClass/JSSoftKeyboardChangeEvent.cpp [moved from src/js-overlay/JSClass/JSSoftKeyboardChangeEvent.cpp with 100% similarity]
src/js-overlay/deprecated/JSClass/JSSoftKeyboardChangeEvent.h [moved from src/js-overlay/JSClass/JSSoftKeyboardChangeEvent.h with 100% similarity]
src/js-overlay/deprecated/JSClass/JSStorageEvent.cpp [moved from src/js-overlay/JSClass/JSStorageEvent.cpp with 100% similarity]
src/js-overlay/deprecated/JSClass/JSStorageEvent.h [moved from src/js-overlay/JSClass/JSStorageEvent.h with 100% similarity]
src/js-overlay/deprecated/JSClass/JSTizenServiceEvent.cpp [moved from src/js-overlay/JSClass/JSTizenServiceEvent.cpp with 100% similarity]
src/js-overlay/deprecated/JSClass/JSTizenServiceEvent.h [moved from src/js-overlay/JSClass/JSTizenServiceEvent.h with 100% similarity]
src/js-overlay/deprecated/js_iframe_support.cpp [moved from src/js-overlay/js_iframe_support.cpp with 100% similarity, mode: 0755]
src/js-overlay/deprecated/js_iframe_support.h [moved from src/js-overlay/js_iframe_support.h with 100% similarity, mode: 0755]
src/js-overlay/deprecated/js_overlay_addEventListener.cpp [moved from src/js-overlay/js_overlay_addEventListener.cpp with 100% similarity, mode: 0755]
src/js-overlay/deprecated/js_overlay_addEventListener.h [moved from src/js-overlay/js_overlay_addEventListener.h with 100% similarity, mode: 0755]
src/js-overlay/js_function_manager.cpp
src/plugin-loading/explorer.cpp
src/plugin-loading/plugin.cpp
src/plugin-loading/plugin_container_support.cpp
src/plugin-loading/plugin_logic.cpp
src/plugins-ipc-message/ipc_message_support.cpp
src/plugins-ipc-message/ipc_message_support.h
src/standards/W3C/Widget/CMakeLists.txt
src/standards/W3C/Widget/JSPreferences.cpp
src/standards/W3C/Widget/JSWidget.cpp
src/standards/W3C/Widget/plugin_initializer.cpp
wrt-popup-ace-runtime.rule
wrt-popup-wrt-runtime.rule

index 3536d7a..8777310 100644 (file)
@@ -35,7 +35,8 @@ include_directories(
   ${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
@@ -153,6 +154,7 @@ configure_and_install_pkg(wrt-popup-ace-runner.pc)
 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
index 882693c..105b2d3 100644 (file)
@@ -1,7 +1,7 @@
 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---
index 892fcf2..09a1e0a 100644 (file)
@@ -1,7 +1,7 @@
 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---
index 7d84f44..9454329 100644 (file)
@@ -1,7 +1,7 @@
-#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
diff --git a/pkgconfigs/wrt-dispatch-event.pc.in b/pkgconfigs/wrt-dispatch-event.pc.in
new file mode 100644 (file)
index 0000000..937bcaf
--- /dev/null
@@ -0,0 +1,12 @@
+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}
index 259b2da..5152f7e 100644 (file)
@@ -56,6 +56,7 @@ add_subdirectory(plugin-loading)
 add_subdirectory(js-overlay)
 add_subdirectory(Commons)
 add_subdirectory(CommonsJavaScript)
+add_subdirectory(dispatch-event)
 add_subdirectory(modules)
 add_subdirectory(standards)
 add_subdirectory(wrt-popup)
old mode 100644 (file)
new mode 100755 (executable)
index 2ca8c9e..09f5ff8
@@ -35,7 +35,6 @@ JSObjectDeclaration::JSObjectDeclaration(js_entity_definition_ptr_t classD) :
         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));
     }
 }
diff --git a/src/dispatch-event/CMakeLists.txt b/src/dispatch-event/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3ba4072
--- /dev/null
@@ -0,0 +1,59 @@
+# 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
diff --git a/src/dispatch-event/dispatch_event_support.cpp b/src/dispatch-event/dispatch_event_support.cpp
new file mode 100644 (file)
index 0000000..b73a2fb
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * 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_
diff --git a/src/dispatch-event/dispatch_event_support.h b/src/dispatch-event/dispatch_event_support.h
new file mode 100644 (file)
index 0000000..a267e2c
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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_
index dd68584..5cbb0d8 100644 (file)
@@ -30,12 +30,7 @@ SET(TARGET_NAME ${TARGET_JS_OVERLAY})
 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(
old mode 100644 (file)
new mode 100755 (executable)
similarity index 100%
rename from src/js-overlay/js_iframe_support.h
rename to src/js-overlay/deprecated/js_iframe_support.h
index dfa55b2..388a3f0 100644 (file)
 
 #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 {
@@ -61,17 +56,6 @@ class_definition_options_t jsPrintfunctionsOptions = {
     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,
@@ -90,17 +74,8 @@ js_entity_definition_t jsHook = {
     &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()
@@ -112,12 +87,8 @@ 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;
 }
index 3a76b3a..1ecad15 100644 (file)
 // 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 = ".";
@@ -342,7 +335,6 @@ void Explorer::unloadFrame(JSGlobalContextRef context)
     JSObjectPtr frameObject =
         JavaScriptInterfaceSingleton::Instance().getGlobalObject(context);
 
-    AddEventListenerSupport::RemoveIFrame(frameObject);
     m_iframeSupport.unregisterIframe(frameObject);
 }
 
@@ -379,6 +371,7 @@ void Explorer::cleanIframesData()
 
 void Explorer::callEventListeners(CustomEventType eventType, void* data)
 {
+#if 0 // deprecated
     using namespace WrtPlugins::Tizen;
     // get iframe objects from javascript global context
     JavaScriptInterface::ObjectsListPtr frameLists =
@@ -450,6 +443,7 @@ void Explorer::callEventListeners(CustomEventType eventType, void* data)
         LogInfo("Not supported custom event type");
         return;
     }
+#endif
 }
 
 WindowPropertySupport* Explorer::getWindowPropertySupport()
index 3a7ab0d..16b92e6 100644 (file)
@@ -56,6 +56,8 @@ Plugin::~Plugin()
 
 PluginPtr Plugin::LoadFromFile(const std::string& fileName)
 {
+    static bool logEnable = (getenv("WRT_LOAD_PLUGINS_LOG_ENABLE") != NULL);
+
     LogDebug("LoadFromFile" << fileName);
 
     void *dllHandle;
@@ -103,29 +105,36 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
 
     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);
@@ -134,17 +143,20 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
         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());
@@ -153,12 +165,15 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
     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)));
@@ -167,8 +182,6 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
         ++rawEntityListIterator;
     }
 
-    LogInfo("#####");
-
     // Load export table
     LogDebug("Plugin successfuly loaded");
 
index 7eabd46..13dadd0 100644 (file)
@@ -167,23 +167,11 @@ void PluginContainerSupport::registerPluginModel(DbPluginHandle handle)
     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
index aef6950..1d96e96 100644 (file)
@@ -255,18 +255,12 @@ void PluginLogic::Impl::initSession(int widgetHandle)
     //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) {
index db1e8a8..fa36f8d 100644 (file)
@@ -30,6 +30,7 @@
 #include <dpl/assert.h>
 
 static WKBundleRef s_injectedBundleRef = NULL;
+static unsigned  int s_xWindowHandle = 0;
 
 namespace {
 std::string toString(WKStringRef str)
@@ -50,6 +51,12 @@ void IPCMessageSupport::setWKBundleRef(WKBundleRef bundleRef)
     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)
@@ -60,11 +67,25 @@ const char* IPCMessageSupport::sendMessageToUiProcess(
         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) {
@@ -79,8 +100,12 @@ const char* IPCMessageSupport::sendMessageToUiProcess(
     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;
 }
index 0bde70a..fa96e3f 100644 (file)
@@ -27,6 +27,7 @@
 
 namespace IPCMessageSupport {
 void setWKBundleRef(WKBundleRef bundleRef);
+void setXwindowHandle(unsigned int handle);
 const char* sendMessageToUiProcess(const char* name, const char* body);
 }
 
index 70ef116..fe0174f 100644 (file)
@@ -29,8 +29,6 @@ include_directories(
   ${API_WIDGET_PATH}
   ${webkit2_INCLUDE_DIRS}
   ${plugin-types_INCLUDE_DIRS}
-#  ${API_STORAGE_EVENT_PATH}
-#  ${API_LOCALSTORAGE_PATH}
 )
 
 add_library(${TARGET_NAME} SHARED ${SRCS})
@@ -42,6 +40,7 @@ target_link_libraries(${TARGET_NAME}
   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)
index 2f962f0..1f6326f 100644 (file)
 #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;
@@ -256,17 +258,18 @@ JSValueRef JSPreferences::removeItem(JSContextRef context,
 
         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);
@@ -295,17 +298,18 @@ JSValueRef JSPreferences::setItem(JSContextRef 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");
 
@@ -331,16 +335,9 @@ JSValueRef JSPreferences::clear(JSContextRef context,
     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");
 
@@ -516,17 +513,18 @@ bool JSPreferences::setProperty(JSContextRef context,
         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");
 
index 6dd18ba..162820f 100644 (file)
@@ -31,7 +31,6 @@
 #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) { \
@@ -302,7 +301,6 @@ void JSWidget::acquireGlobalContext(java_script_context_t global_context,
                                     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.");
index 6b64770..d296869 100644 (file)
@@ -25,8 +25,6 @@
 
 #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"
@@ -45,9 +43,9 @@ namespace Options {
 class_definition_options_t WidgetOptions = {
     JS_CLASS,
     CREATE_INSTANCE,
-    ALWAYS_NOTICE,
+    NONE_NOTICE,
     USE_OVERLAYED, //ignored
-    IFrameSupport::RegisterWidget,
+    NULL,
     NULL,
     NULL
 };
index c0b7d7c..af50ad6 100644 (file)
@@ -1,7 +1,7 @@
 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
index 9f68a1a..1ad6fbc 100644 (file)
@@ -1,7 +1,7 @@
 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