[Release] wrt-plugins-common_0.3.83 submit/tizen_2.1/20130429.071849
authorTaejeong Lee <taejeong.lee@samsung.com>
Mon, 29 Apr 2013 07:18:25 +0000 (16:18 +0900)
committerTaejeong Lee <taejeong.lee@samsung.com>
Mon, 29 Apr 2013 07:18:25 +0000 (16:18 +0900)
Change-Id: I85049c2ac0233d41592c90fe778d539f5f7a3721

packaging/wrt-plugins-common.spec
src/plugin-loading/js_page_session.cpp
src/plugin-loading/plugin_logic.cpp
src/plugin-loading/plugin_logic.h
src/wrt-popup/wrt/popup-bin/InfoPopup.cpp
src/wrt-popup/wrt/popup-bin/YesNoCheckPopup.cpp
src/wrt-popup/wrt/popup-bin/YesNoPopup.cpp
src/wrt-popup/wrt/popup-runner/PopupInvoker.cpp
tests/dao/widgetdb_tests_prepare_db.sh

index e38118e..b27db42 100644 (file)
@@ -1,7 +1,7 @@
-#git:framework/web/wrt-plugins-common wrt-plugins-common_0.3.82
+#git:framework/web/wrt-plugins-common wrt-plugins-common_0.3.83
 Name:       wrt-plugins-common
 Summary:    wrt-plugins common library
-Version:    0.3.82
+Version:    0.3.83
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 8b2f7ab..24a3d49 100644 (file)
@@ -196,15 +196,15 @@ void JSPageSession::Impl::installRootPlugins()
 bool JSPageSession::Impl::installPlugin(PluginModelPtr plugin)
 {
     Assert(plugin && "Plugin Model is NULL");
-    auto library = loadLibrary(plugin);
-
-    LogInfo("Install Plugin '" << library->GetFileName());
+    PluginPtr library = loadLibrary(plugin);
 
     if (!library) {
         LogError("Loading library failed");
         return false;
     }
 
+    LogInfo("Install Plugin '" << library->GetFileName());
+
     // Register new class
     FOREACH(it, *(library->GetClassList()))
     {
@@ -307,15 +307,15 @@ bool JSPageSession::Impl::installPluginOnDemand(PluginModelPtr plugin,
                                                 JSGlobalContextRef context)
 {
     Assert(plugin && "Plugin Model is NULL");
-    auto library = loadLibrary(plugin);
-
-    LogInfo("Install Plugin '" << library->GetFileName());
+    PluginPtr library = loadLibrary(plugin);
 
     if (!library) {
         LogError("Loading library failed");
         return false;
     }
 
+    LogInfo("Install Plugin '" << library->GetFileName());
+
     if (!(parentObject.instance)) {
         LogError("NULL pointer value");
         return false;
index c3bf0fd..08d056a 100644 (file)
@@ -75,6 +75,7 @@ class PluginLogic::Impl
 
     typedef std::map<JSContextRef, JSPageSessionPtr> PagesSessionsSet;
     PagesSessionsSet m_sessions;
+    unsigned int m_windowHandle;
 
   public:
     Impl();
@@ -108,6 +109,9 @@ class PluginLogic::Impl
                                  CustomEventType eventType,
                                  void* data);
 
+    unsigned int windowHandle() const;
+    void setWindowHandle(unsigned int handle);
+
     static bool s_sanityCheck;
 };
 
@@ -122,7 +126,8 @@ bool PluginLogic::Impl::s_sanityCheck = false;
         return; \
     }
 
-PluginLogic::Impl::Impl()
+PluginLogic::Impl::Impl() :
+    m_windowHandle(0)
 {
     s_sanityCheck = true;
 
@@ -225,6 +230,16 @@ void PluginLogic::unloadFrame(JSGlobalContextRef context)
     m_impl->unloadFrame(context);
 }
 
+unsigned int PluginLogic::windowHandle() const
+{
+    return m_impl->windowHandle();
+}
+
+void PluginLogic::setWindowHandle(unsigned int handle)
+{
+    m_impl->setWindowHandle(handle);
+}
+
 PluginLogic::PluginLogic() : m_impl(new PluginLogic::Impl())
 {}
 
@@ -415,3 +430,16 @@ void PluginLogic::Impl::dispatchJavaScriptEvent(JSGlobalContextRef context,
 
     sessionIt->second->dispatchJavaScriptEvent(eventType, data);
 }
+
+unsigned int PluginLogic::Impl::windowHandle() const
+{
+    PLUGIN_LOGIC_SANITY_CHECK
+    return m_windowHandle;
+}
+
+void PluginLogic::Impl::setWindowHandle(unsigned int handle)
+{
+    PLUGIN_LOGIC_SANITY_CHECK
+    LogDebug("XWindow handle " << handle);
+    m_windowHandle = handle;
+}
index 10bcb08..fb965c5 100644 (file)
@@ -80,6 +80,9 @@ class PluginLogic : DPL::Noncopyable
                                  CustomEventType eventType,
                                  void* data);
 
+    unsigned int windowHandle() const;
+    void setWindowHandle(unsigned int handle);
+
   private:
     PluginLogic();
     ~PluginLogic();
index faa3807..4536350 100644 (file)
@@ -69,6 +69,7 @@ void InfoPopup::show(DPL::BinaryQueueAutoPtr data, WrtPopup* parent)
 void InfoPopup::responseCallback(const Renderer::AnswerCallbackData &answer)
 {
     DPL::BinaryQueue retValue;
+    PopupSerializer::appendArg(true, retValue);
     PopupSerializer::appendArg(answer.buttonAnswer, retValue);
     m_parent->response(retValue);
 }
index ea743a6..7cdbf73 100644 (file)
@@ -41,6 +41,7 @@ void YesNoCheckPopup::responseCallback(
 {
     bool result = (POPUP_YES_VALUE == answer.buttonAnswer);
     DPL::BinaryQueue retValue;
+    PopupSerializer::appendArg(true, retValue);
     PopupSerializer::appendArg(result, retValue);
     LogDebug("Check state: " << answer.chackState);
     PopupSerializer::appendArg(answer.chackState, retValue);
index f2953a8..a47d205 100644 (file)
@@ -51,6 +51,7 @@ void YesNoPopup::responseCallback(const Renderer::AnswerCallbackData &answer)
 {
     bool result = (POPUP_YES_VALUE == answer.buttonAnswer);
     DPL::BinaryQueue retValue;
+    PopupSerializer::appendArg(true, retValue);
     PopupSerializer::appendArg(result, retValue);
     m_parent->response(retValue);
 }
index 28f32a1..16cbace 100644 (file)
@@ -84,17 +84,24 @@ bool PopupInvoker::askYesNo(const std::string& title,
         //Result from popup application is available. Read it.
         DPL::BinaryQueueAutoPtr resultData =
             m_input.Read(std::numeric_limits<std::size_t>::max());
-        const int result = PopupSerializer::getIntArg(*resultData);
+        const int success = PopupSerializer::getIntArg(*resultData);
+        bool retVal = false;
+        if (success) {
+            const int result = PopupSerializer::getIntArg(*resultData);
 
-        LogDebug("Popup result is: " << result);
+            LogDebug("Popup result is: " << result);
 
-        Assert(resultData->Empty());
+            Assert(resultData->Empty());
+            retVal = (!!result);
+        } else {
+            LogWarning("Failed to show popup.");
+        }
 
         tmp.Close();
         m_input.Close();
         m_output.Close();
 
-        return (!!result);
+        return retVal;
     }
     Catch(DPL::Exception)
     {
@@ -122,7 +129,12 @@ void PopupInvoker::showInfo(const std::string& title,
         m_output.Write(data, data.Size());
 
         executePopup();
-
+        DPL::BinaryQueueAutoPtr resultData =
+            m_input.Read(std::numeric_limits<std::size_t>::max());
+        const int success = PopupSerializer::getIntArg(*resultData);
+        if (!success) {
+            LogWarning("Failed to show popup.");
+        }
         //ignore result
 
         tmp.Close();
@@ -157,29 +169,38 @@ PopupResponse PopupInvoker::askYesNoCheckbox(const std::string& title,
         //Result from popup application is available. Read it.
         DPL::BinaryQueueAutoPtr resultData =
             m_input.Read(std::numeric_limits<std::size_t>::max());
-        const int result = PopupSerializer::getIntArg(*resultData);
-        const int rememberResult = PopupSerializer::getIntArg(*resultData);
-
-        LogDebug(
-            "Popup result is: " << result << " remeber: " << rememberResult);
-
-        Assert(resultData->Empty());
-        tmp.Close();
-        m_input.Close();
-        m_output.Close();
-
-        if (1 == result) {
-            if (rememberResult == 1) {
-                return YES_DO_REMEMBER;
+        const int success = PopupSerializer::getIntArg(*resultData);
+        if (success) {
+            const int result = PopupSerializer::getIntArg(*resultData);
+            const int rememberResult = PopupSerializer::getIntArg(*resultData);
+
+            LogDebug(
+                "Popup result is: " << result << " remeber: " << rememberResult);
+
+            Assert(resultData->Empty());
+            tmp.Close();
+            m_input.Close();
+            m_output.Close();
+
+            if (1 == result) {
+                if (rememberResult == 1) {
+                    return YES_DO_REMEMBER;
+                } else {
+                    return YES_DONT_REMEMBER;
+                }
             } else {
-                return YES_DONT_REMEMBER;
+                if (rememberResult == 1) {
+                    return NO_DO_REMEMBER;
+                } else {
+                    return NO_DONT_REMEMBER;
+                }
             }
         } else {
-            if (rememberResult == 1) {
-                return NO_DO_REMEMBER;
-            } else {
-                return NO_DONT_REMEMBER;
-            }
+            LogWarning("Popup failed to execute.");
+            tmp.Close();
+            m_input.Close();
+            m_output.Close();
+            return NO_DONT_REMEMBER;
         }
     }
     Catch(DPL::Exception)
@@ -194,7 +215,7 @@ void PopupInvoker::executePopup()
     pid_t pid = fork();
     if (pid == -1) {
         //error occured
-        LogError("Cannot display popup!");
+        LogError("Failed to create popup process.");
         Assert(false);
     }
     if (pid == 0) {
@@ -206,7 +227,15 @@ void PopupInvoker::executePopup()
                         NULL);
         if (ret == -1) {
             //execl returns -1 on error
-            LogError("Cannot display popup!");
+            LogError("Failed to set popup binary");
+            //write something to pipe to unblock caller process
+            DPL::NamedOutputPipe errOut;
+            errOut.Open(m_inputName);
+            DPL::BinaryQueue data;
+            PopupSerializer::appendArg(false, data);
+            errOut.Write(data, data.Size());
+            errOut.Close();
+
             Assert(false);
         }
     }
index 1a0f82a..2476011 100755 (executable)
@@ -54,8 +54,7 @@ if [ "x$1" == "xstart" ]; then
     INS_ALL_WIDGET_LOC_STARTFILE="insert into WidgetLocalizedStartFile(app_id, start_file_id, widget_locale, type, encoding)"
     INS_ALL_WIDGET_DEFPREF="insert into WidgetDefaultPreference(app_id, key_name, key_value, readonly)"
     INS_ALL_WIDGET_PREF="insert into WidgetPreference(tizen_appid, key_name, key_value, readonly)"
-    INS_ALL_WIDGET_FEATURE="insert into WidgetFeature(widget_feature_id, app_id, name, required, rejected)"
-    INS_ALL_WIDGET_FEATURE_PARAM="insert into FeatureParam(widget_feature_id, name, value)"
+    INS_ALL_WIDGET_FEATURE="insert into WidgetFeature(widget_feature_id, app_id, name,  rejected)"
     INS_ALL_WIDGET_WINMODES="insert into WidgetWindowModes(app_id, window_mode)"
     INS_ALL_WIDGET_WARP="insert into WidgetWARPInfo(app_id, iri, subdomain_access)"
     INS_ALL_WIDGET_CERT="insert into WidgetCertificateFingerprint(app_id, owner, chainid, type, md5_fingerprint, sha1_fingerprint, common_name)"
@@ -79,25 +78,15 @@ if [ "x$1" == "xstart" ]; then
     sqlite3 $WRT_DB "insert into LocalizedWidgetInfo(app_id, widget_locale) VALUES(2003, 'en')";
 
 #Widget features
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(1,2000, 'first_2000', 1, 0)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(2,2000, 'second_2000', 1, 0)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(3,2000, 'third_2000', 0, 0)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(8,2000, 'fourth_2000', 1, 0)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(9,2000, 'fifth_2000', 0, 0)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(4,2001, 'first_2001', 1, 0)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(5,2001, 'second_2001', 1, 0)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(6,2001, 'third_2001', 0, 0)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(7,2001, 'fourth_2001', 1, 0)";
-
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE_PARAM} VALUES(1, 'first_2000_first', 'firstValue1')";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE_PARAM} VALUES(1, 'first_2000_second', 'firstValue2')";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE_PARAM} VALUES(1, 'first_2000_third', 'firstValue3')";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE_PARAM} VALUES(1, 'first_2000_fourth', 'firstValue4')";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE_PARAM} VALUES(2, 'second_2000', 'secondValue1')";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE_PARAM} VALUES(3, 'third_2000', 'thirdValue1')";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE_PARAM} VALUES(4, 'first_2001', 'firstValue_2001')";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE_PARAM} VALUES(5, 'second_2001', 'secondValue_2001')";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE_PARAM} VALUES(6, 'third_2001', 'thirdValue_2001')";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(1,2000, 'first_2000', 0)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(2,2000, 'second_2000', 0)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(3,2000, 'third_2000', 0)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(8,2000, 'fourth_2000', 0)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(9,2000, 'fifth_2000', 0)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(4,2001, 'first_2001', 0)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(5,2001, 'second_2001', 0)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(6,2001, 'third_2001', 0)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_FEATURE} VALUES(7,2001, 'fourth_2001', 0)";
 
     sqlite3 $WRT_DB "${INS_ALL_WIDGET_ICONS} VALUES(2000, 'icon_src_2000', 50, 50)";
     sqlite3 $WRT_DB "insert into WidgetIcon(app_id, icon_src) VALUES(2002, 'icon_src_2002')";