Update wrt_0.8.89
authorjihoon.chung <jihoon.chung@samsung.com>
Mon, 3 Sep 2012 11:47:16 +0000 (20:47 +0900)
committerjihoon.chung <jihoon.chung@samsung.com>
Mon, 3 Sep 2012 11:47:16 +0000 (20:47 +0900)
30 files changed:
debian/changelog
packaging/wrt.spec
src/CMakeLists.txt
src/api_new/i_runnable_widget_object.h
src/api_new/runnable_widget_object.cpp
src/api_new/runnable_widget_object.h
src/arch/CMakeLists.txt [deleted file]
src/arch/DESCRIPTION [deleted file]
src/profiling/profiling_util.cpp
src/profiling/script/profiling-host-part.pl [changed mode: 0644->0755]
src/profiling/script/profiling-target-part.pl
src/profiling/script/test-widgets/0Jet_Pack_Agent.wgt
src/profiling/script/test-widgets/minimal.wgt
src/profiling/script/test-widgets/wac2_0Test.wgt
src/view/common/CMakeLists.txt
src/view/common/view_logic_debugger_support.cpp [deleted file]
src/view/common/view_logic_debugger_support.h [deleted file]
src/view/common/view_logic_password_support.cpp
src/view/i_view_module.h
src/view/webkit/view_logic.cpp
src/view/webkit/view_logic.h
src/view/webkit/view_logic_scheme_support.cpp
src/wrt-client/CMakeLists.txt
src/wrt-client/splash_screen_support.cpp [moved from src/view/common/view_logic_splash_screen_support.cpp with 94% similarity]
src/wrt-client/splash_screen_support.h [moved from src/view/common/view_logic_splash_screen_support.h with 93% similarity]
src/wrt-client/window_data.cpp [moved from src/view/common/window_data.cpp with 100% similarity]
src/wrt-client/window_data.h [moved from src/view/common/window_data.h with 100% similarity]
src/wrt-client/wrt-client.cpp
src/wrt-client/wrt-client.h
src/wrt-launcher/wrt-launcher.cpp

index e2a39bc..2c7f915 100644 (file)
@@ -1,3 +1,20 @@
+wrt (0.8.89) unstable; urgency=low
+
+  * [Engine] Arch directory removed
+  * [Engine] View module header cleanup
+  * [Engine] Move windowData and splash screen to wrt-client
+  * [Engine] Move setLayout out of view module
+  * [Engine] Profiling fixes
+  * [Engine] Fixed SDK launch fail issue
+  * [Engine] Fixed CCR issue(#78130)
+  * [Engine] calling connectElmCallback
+  * [Engine] Support focusing of top level webview in case of reset or resume
+
+  * Git : slp/pkgs/w/wrt
+  * Tag : wrt_0.8.89
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Mon, 03 Sep 2012 20:30:30 +0900
+
 wrt (0.8.88) unstable; urgency=low
 
   * [Engine] Support to get current webview used for rendering
index d86e750..ff7ceed 100644 (file)
@@ -1,7 +1,7 @@
-#sbs-git:slp/pkgs/w/wrt wrt 0.8.88
+#sbs-git:slp/pkgs/w/wrt wrt 0.8.89
 Name:       wrt
 Summary:    web runtime
-Version:    0.8.88
+Version:    0.8.89
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 00aabad..28a98a7 100755 (executable)
@@ -164,7 +164,6 @@ INSTALL(FILES
 )
 
 ADD_SUBDIRECTORY(api_new)
-ADD_SUBDIRECTORY(arch)
 ADD_SUBDIRECTORY(wrt-client)
 ADD_SUBDIRECTORY(wrt-launcher)
 ADD_SUBDIRECTORY(plugin-service)
index 582247f..e047d8a 100644 (file)
 namespace WRT {
 
 typedef struct UserCallbacks {
+    void (*progressFinish)(void *data);
     void (*loadFinish)(bool success, void *data);
     void (*resume)(bool success, void *data);
     void (*suspend)(bool success, void *data);
     void (*reset)(bool success, void *data);
+    void (*bufferUnset)(Evas_Object* currentBuffer, void *data);
+    void (*bufferSet)(Evas_Object* newBuffer, void *data);
+
+    UserCallbacks():
+            progressFinish(NULL),
+            loadFinish(NULL),
+            resume(NULL),
+            suspend(NULL),
+            reset(NULL),
+            bufferUnset(NULL),
+            bufferSet(NULL)  {}
 } UserCallbacks;
 typedef std::shared_ptr<UserCallbacks> UserCallbacksPtr;
 typedef std::shared_ptr<WidgetModel> WidgetModelPtr;
@@ -50,11 +62,11 @@ public:
     /**
      * Prepares view to launch. You MUST call elm_init before calling
      * this method.
-     * @param buffer where Webkit will draw website. If it is null
-     * it will be created.
+     * @param window
+     * @param callbacks passed to viewLogic
      */
     virtual void PrepareView(const std::string &startUrl,
-                             Evas_Object *buffer = NULL) = 0;
+                             Evas_Object *window) = 0;
     /**
      * Shows widget asynchronously. Callback will be called when
      * webkit generates website.
@@ -93,6 +105,11 @@ public:
      * Register widget's callbacks
      */
     virtual void SetUserCallbacks(UserCallbacksPtr cbs, void *data) = 0;
+    /*
+     * Call goBack() on webkit
+     */
+    virtual void GoBack() = 0;
+    virtual ~IRunnableWidgetObject() {};
 };
 
 typedef std::shared_ptr<IRunnableWidgetObject> RunnableWidgetObjectPtr;
index 05887cd..82f882e 100644 (file)
 #include <appcore-common.h>
 #include <profiling_util.h>
 #include <signal.h>
-#include <common/window_data.h>
 #include "webkit/bundles/plugin_module_support.h"
 
 namespace { //Anonymous
 
 const wchar_t* BACKGROUND_ENABLED = L"background_enabled" ;
 
-const std::string VIEWMODE_TYPE_FULLSCREEN = "fullscreen";
-const std::string VIEWMODE_TYPE_MAXIMIZED = "maximized";
-
-// window signal callback
-const char *EDJE_SHOW_BACKWARD_SIGNAL = "show,backward,signal";
-
 class Popups : DPL::Popup::PopupControllerUser
 {
   public:
@@ -145,42 +138,12 @@ bool RunnableWidgetObject::CheckBeforeLaunch()
 }
 
 void RunnableWidgetObject::PrepareView(const std::string &startUrl,
-                                       Evas_Object *buffer)
+        Evas_Object *window)
 {
-    if (!buffer) {
-        LogDebug("Buffer is null, creating window");
-        ADD_PROFILING_POINT("CreateWindow", "start");
-        m_windowData.reset(new WindowData(static_cast<unsigned long>(getpid())));
-        ADD_PROFILING_POINT("CreateWindow", "stop");
-        // Initialize things in ViewLogic
-        ADD_PROFILING_POINT("view_logic_init", "start");
-        m_view = ViewModule::getView();
-
-        m_splashScreen.reset(new ViewModule::SplashScreenSupport(m_windowData->m_win));
-        if (m_splashScreen->createSplashScreen(m_widgetModel->Handle.Get())) {
-            m_splashScreen->startSplashScreen();
-
-            // TODO get rid of conformant and splash image
-            m_view->createWebView(
-                m_ewkContext,
-                m_windowData->m_win,
-                m_windowData->m_conformant,
-                DPL::MakeDelegate(
-                    m_splashScreen.get(),
-                    &ViewModule::SplashScreenSupport::stopSplashScreen)
-            );
-        } else {
-            m_view->createWebView(m_ewkContext,
-                                  m_windowData->m_win,
-                                  m_windowData->m_conformant);
-        }
-        evas_object_show(m_windowData->m_win);
-        initializeWindowModes();
-    } else {
-        LogDebug("Buffer is not null, passing to view");
-        m_view = ViewModule::getView();
-        m_view->createWebView(m_ewkContext, buffer, NULL, NULL);
-    }
+    Assert(window);
+    ADD_PROFILING_POINT("view_logic_init", "start");
+    m_view = ViewModule::getView();
+    m_view->createWebView(m_ewkContext, window);
     m_view->initialize();
     m_view->prepareView(m_widgetModel.get(), startUrl);
     ADD_PROFILING_POINT("view_logic_init", "stop");
@@ -188,11 +151,7 @@ void RunnableWidgetObject::PrepareView(const std::string &startUrl,
 
 void RunnableWidgetObject::Show()
 {
-    connectElmCallback();
     m_view->showWidget();
-    if (m_windowData) {
-        m_windowData->emitSignalForUserLayout(EDJE_SHOW_BACKWARD_SIGNAL, "");
-    }
 }
 
 void RunnableWidgetObject::Hide() {
@@ -238,9 +197,6 @@ void RunnableWidgetObject::Reset()
     Assert(m_widgetModel);
 
     m_view->resetWidget();
-    if (m_windowData) {
-        m_windowData->emitSignalForUserLayout(EDJE_SHOW_BACKWARD_SIGNAL, "");
-    }
 }
 
 WidgetModelPtr RunnableWidgetObject::GetModel() {
@@ -256,81 +212,8 @@ void RunnableWidgetObject::SetUserCallbacks(UserCallbacksPtr cbs, void *data) {
     m_view->setUserCallbacks(cbs, data);
 }
 
-void RunnableWidgetObject::initializeWindowModes()
-{
-    auto windowModes = m_widgetModel->WindowModes.Get();
-    bool fullscreen = false;
-    FOREACH(it, windowModes)
-    {
-        std::string viewMode = DPL::ToUTF8String(*it);
-        if (viewMode == VIEWMODE_TYPE_FULLSCREEN) {
-            fullscreen = true;
-            break;
-        } else if (viewMode == VIEWMODE_TYPE_MAXIMIZED) {
-            break;
-        }
-    }
-    bool indicator = true;
-    bool backbutton = false;
-    if (m_widgetModel->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
-        indicator
-        = (m_widgetModel->SettingList.Get().getIndicatorPresence()
-           == Indicator_Enable);
-        backbutton
-        = (m_widgetModel->SettingList.Get().getBackButtonPresence()
-           == BackButton_Enable);
-    }
-
-    if (!fullscreen) {
-        std::string name = "";
-        if (!(m_widgetModel->Name.Get().IsNull())) {
-            name = DPL::ToUTF8String(*(m_widgetModel->Name.Get()));
-        }
-        m_windowData->setViewModeMaximized(
-            name.c_str(), indicator, backbutton);
-    } else {
-        m_windowData->setViewModeFullScreen(
-            indicator, backbutton);
-    }
-}
-
-void RunnableWidgetObject::backButtonCallback(void* data,
-                                     Evas_Object * /*obj*/,
-                                     void * /*event_info*/)
-{
-    LogInfo("BackButtonCallback");
-    Assert(data);
-
-    RunnableWidgetObject* This = static_cast<RunnableWidgetObject*>(data);
-
-    This->m_view->goBack();
-}
-
-void RunnableWidgetObject::connectElmCallback()
-{
-    if (!m_windowData) {
-        return;
-    }
-    if (m_widgetModel->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
-        if (m_widgetModel->SettingList.Get().getBackButtonPresence() ==
-                BackButton_Enable)
-        {
-            m_windowData->addFloatBackButtonCallback(
-                "clicked",
-                &RunnableWidgetObject::backButtonCallback,
-                this);
-        }
-
-        WidgetSettingScreenLock rotationValue =
-                m_widgetModel->SettingList.Get().getRotationValue();
-        if (rotationValue == Screen_Portrait) {
-            elm_win_rotation_with_resize_set(m_windowData->m_win, 0);
-        } else if (rotationValue == Screen_Landscape) {
-            elm_win_rotation_with_resize_set(m_windowData->m_win, 270);
-        } else {
-            elm_win_rotation_with_resize_set(m_windowData->m_win, 0);
-        }
-    }
+void RunnableWidgetObject::GoBack() {
+    m_view->goBack();
 }
 
 RunnableWidgetObject::~RunnableWidgetObject()
index 29587b8..1e95b93 100644 (file)
 #include "i_runnable_widget_object.h"
 #include <widget_model.h>
 #include <i_view_module.h>
+#include <string>
 #include <common_error.h>
 #include <widget_launch_struct.h>
-#include <common/view_logic_splash_screen_support.h>
-
 #include <ewk_context.h>
 
-class WindowData;
-
 namespace WRT {
 
 class RunnableWidgetObject : public IRunnableWidgetObject
@@ -45,7 +42,8 @@ public:
     virtual ~RunnableWidgetObject();
 
     bool CheckBeforeLaunch();
-    void PrepareView(const std::string &startUrl, Evas_Object *buffer = NULL);
+    void PrepareView(const std::string &startUrl,
+            Evas_Object *window);
     void Show(); //asynchronous function
     void Hide();
     void Suspend();
@@ -54,22 +52,15 @@ public:
     WidgetModelPtr GetModel();
     Evas_Object* GetCurrentWebview();
     void SetUserCallbacks(UserCallbacksPtr cbs, void *data);
+    void GoBack();
 private:
     bool CheckWACTestCertififedWidget();
     void LocalizeWidgetModel();
-    void initializeWindowModes();
-    // UI callback
-    static void backButtonCallback(void* data,
-                                   Evas_Object* obj,
-                                   void* event_info);
-    void connectElmCallback();
 
     WidgetModelPtr m_widgetModel;
     void localizeWidgetModel();
     ViewModule::IViewModulePtr m_view;
     Ewk_Context* m_ewkContext;
-    std::unique_ptr<WindowData> m_windowData;
-    std::unique_ptr<ViewModule::SplashScreenSupport> m_splashScreen;
 };
 
 } /* namespace WRT */
diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
deleted file mode 100644 (file)
index 57da214..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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      Pawel Sikorski (p.sikorski@samsung.com)
-# @version     1.0
-# @brief
-#
\ No newline at end of file
diff --git a/src/arch/DESCRIPTION b/src/arch/DESCRIPTION
deleted file mode 100644 (file)
index 742f6f4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-architecture specific files
index 9548f89..bba7a7c 100644 (file)
@@ -97,6 +97,7 @@ void dumpStatistic()
         result->Print(fp);
     }
     fprintf(fp, "###PROFILING###STOP###\n");
+    fflush(fp);
     if (stdout != fp) {
         fclose(fp); // newfd is also closed
     }
@@ -136,4 +137,3 @@ void AddProfilingMeasurment(const char* name,
     results.push_back(
         PacketResult(toULong(value), name, prefix, description));
 }
-
old mode 100644 (file)
new mode 100755 (executable)
index 3c06961..5903479 100755 (executable)
@@ -23,7 +23,7 @@ my @WIDGETS = (
   ['wac2_0Test.wgt', 'WAC Test' ],
 );
 my $WRT_CLIENT_LAUNCH = 'wrt-client -l {}';
-my $WRT_CLIENT_QUERY = 'wrt-client -q 2>/dev/null';
+my $WRT_CLIENT_QUERY = 'wrt-launcher -l 2>/dev/null';
 my $WRT_CLIENT_INSTALL = 'wrt-installer -i {}';
 my $WRT_CLIENT_UNINSTALL = 'wrt-installer -u {}';
 my $COLD_START_PREPARE_COMMAND = '/sbin/sysctl vm.drop_caches=3';
@@ -57,14 +57,17 @@ sub runWidget {
   $command =~ s/\{\}/$widgetHandle/;
   $command .= " 2>$fnameerr 3>$OUTPUT_DIR/tmp/prof.tmp & echo TEST-WIDGET-PID \$\!";
 
+  print "$command\n";
+
   my ($startSec, $startUSec) = Time::HiRes::gettimeofday();
-  
+
   my $f;
   open $f, "$command |";
-  
+
   my $pid = undef;
-  
+
   while (my $line = <$f>) {
+    print "The line is: $line";
     if (defined $streamout) {
       print $streamout $line;
     }
@@ -72,7 +75,8 @@ sub runWidget {
     if (my ($p) = $line =~ /^TEST-WIDGET-PID (\d+)/) {
         $pid = 0+$p;
     } elsif ($line =~ /^launched$/) {
-        `kill -SIGUSR1 $pid`;
+        print "launched detected\n";
+        kill 10, $pid;
         my $again = 1;
         while ($again) {
             my $t = `tail -1 $OUTPUT_DIR/tmp/prof.tmp`;
@@ -80,7 +84,8 @@ sub runWidget {
                 $again = 0;
             }
         }
-        `kill -9 $pid`;
+        kill 9, $pid;
+        print "killed\n";
     }
 }
 
@@ -245,6 +250,7 @@ for my $ptest (@testList) {
     my ($name, $mode) = @$ptest;
     my $widgetHandle = $$pwidgetMap{$name};
     my $runNo = $runNumbers{"$mode|$widgetHandle"};
+    print "next\n";
     if (defined $runNo)
     { $runNo += 1; }
     else
@@ -270,11 +276,10 @@ for my $ptest (@testList) {
     # close output files
     close $outFile;
     close $dumpOutFile;
+    print "Done\n";
 }
 }
 
 ##### MAIN #####
 
 fullRandomTest( undef, ['cold', 'warm', 'preload'], 10 );
-
-
index 2ce7117..a9b27fa 100644 (file)
Binary files a/src/profiling/script/test-widgets/0Jet_Pack_Agent.wgt and b/src/profiling/script/test-widgets/0Jet_Pack_Agent.wgt differ
index d1585e2..2406783 100644 (file)
Binary files a/src/profiling/script/test-widgets/minimal.wgt and b/src/profiling/script/test-widgets/minimal.wgt differ
index 948f1a9..913267e 100644 (file)
Binary files a/src/profiling/script/test-widgets/wac2_0Test.wgt and b/src/profiling/script/test-widgets/wac2_0Test.wgt differ
index b7713ea..27b245d 100644 (file)
@@ -51,11 +51,9 @@ SET(VIEW_COMMON_SOURCES
     ${PROJECT_SOURCE_DIR}/src/view/common/scheme.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/scheme_action_map.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/youtubehd.cpp
-    ${PROJECT_SOURCE_DIR}/src/view/common/window_data.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_apps_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_custom_header_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_security_support.cpp
-    ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_splash_screen_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_geolocation_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_password_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_security_support.cpp
diff --git a/src/view/common/view_logic_debugger_support.cpp b/src/view/common/view_logic_debugger_support.cpp
deleted file mode 100644 (file)
index 03431d7..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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        debug_support.cpp
- * @author      Andrzej Surdej(a.surdej@samsung.com)
- * @version     1.0
- * @brief       This file implements methods for sdk debugger
- */
-
-#include "view_logic_debugger_support.h"
-
-#include <dpl/assert.h>
-#include <dpl/log/log.h>
-#include <global_logic.h>
-#include <launch_user_data.h>
-#include <widget_model.h>
-
-namespace ViewModule {
-namespace DebuggerSupport {
-
-bool checkDebugMode(WidgetModel const * const model, SDKDebugData* debugData)
-{
-    LogError("Checking for debug mode");
-    Assert(model && "Passed widget model is NULL!");
-
-    bool debugMode = debugData->debugMode;
-
-    LogInfo("[DEBUG_MODE] Widget is launched in " <<
-            (debugMode ? "DEBUG" : "RETAIL") <<
-            " mode.");
-
-    if (debugMode == true) {
-        // In WAC widget, only test widgets can use web inspector.
-        // In TIZEN widget,
-        // every launched widgets as debug mode can use it.
-        if (model->Type.Get().appType ==
-            WrtDB::APP_TYPE_WAC20)
-        {
-            bool developerMode =
-                GlobalLogicSingleton::Instance().GetGlobalModel()
-                ->DeveloperMode.Get();
-            //This code will be activated
-            //after WAC test certificate is used by SDK
-            //bool isTestWidget = view->m_widgetModel->IsTestWidget.Get();
-            //if(!isTestWidget)
-            //{
-            //    LogInfo("This is not WAC Test Widget");
-            //    break;
-            //}
-            if (!developerMode) {
-                LogInfo("This is not WAC Developer Mode");
-                debugMode = false;
-            }
-        }
-    }
-    return debugMode;
-}
-
-} // namespace ViewModule
-} // namespace DebuggerSupport
diff --git a/src/view/common/view_logic_debugger_support.h b/src/view/common/view_logic_debugger_support.h
deleted file mode 100644 (file)
index b58063c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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        debug_support.h
- * @author      Andrzej Surdej(a.surdej@samsung.com)
- * @version     1.0
- * @brief       This file implements methods for sdk debugger
- */
-
-#ifndef WRT_VIEW_LOGIC_DEBUGGER_SUPPORT_H_
-#define WRT_VIEW_LOGIC_DEBUGGER_SUPPORT_H_
-
-class WidgetModel; // FORWARD DECLARATION
-struct SDKDebugData; // FORWARD DECLARATION
-
-namespace ViewModule {
-namespace DebuggerSupport {
-
-bool checkDebugMode(WidgetModel const * const model, SDKDebugData* debugData);
-
-} // namespace ViewModule
-} // namespace DebuggerSupport
-#endif // WRT_VIEW_LOGIC_DEBUGGER_SUPPORT_H_
index d664294..a5a16c5 100644 (file)
@@ -37,6 +37,8 @@ namespace ViewModule {
 namespace PasswordSupport {
 
 namespace {
+const char *SCHEME_TYPE_HTTP = "http";
+const char *SCHEME_TYPE_HTTPS = "https";
 const char *AUTOSAVEIDPASS_OFF          = "OFF";
 const char *AUTOSAVEIDPASS_ON           = "ON";
 const char *AUTOSAVEIDPASS_ALWAYS_ASK   = "ALWAYS_ASK";
@@ -51,7 +53,7 @@ const char * const FILE_PATH_AUTOSAVE_JS = "/usr/share/wrt-engine/AutoSave.js";
 const char * const FILE_OPTION_READ = "r";
 const std::string JS_KEY_TAG = "$KEY";
 const std::string JS_VALUE_TAG = "$VALUE";
-const unsigned int MIN_SUBMIT_FORM_DATA_SIZE = 1;
+const unsigned int MIN_SUBMIT_FORM_DATA_SIZE = 0;
 
 // Internal declaration
 Eina_Bool submitFormDataSet(const Eina_Hash* hash,
@@ -67,7 +69,11 @@ Eina_Bool submitFormDataSet(const Eina_Hash* /*hash*/,
     using namespace AutoSaveDB;
     SubmitFormData *submitFormData = static_cast<SubmitFormData*>(fdata);
 
-    if (!key || !data) {
+    if (!key ||
+        !data ||
+        strlen(static_cast<const char *>(key)) == 0 ||
+        strlen(static_cast<char *>(data)) == 0)
+    {
         LogDebug("input data is empty");
         return EINA_TRUE;
     }
@@ -99,16 +105,32 @@ void submitClicked(std::string uri, Eina_Hash* data)
     }
 
     DPL::ScopedPtr<iri_t> iri(iri_parse(uri.c_str()));
-    if (!iri.Get() || NULL == iri->host) {
-        LogDebug("host is invalid");
+    if (!iri.Get()) {
+        LogDebug("Fail to get iri");
         return;
     }
-    DPL::String host = DPL::FromASCIIString(std::string(iri->host));
+    DPL::String host;
+    if (strstr(uri.c_str(), SCHEME_TYPE_HTTP) == uri.c_str() ||
+        strstr(uri.c_str(), SCHEME_TYPE_HTTPS) == uri.c_str())
+    {
+        if (NULL == iri->host) {
+            LogDebug("host is invalid");
+            return;
+        }
+        host = DPL::FromASCIIString(std::string(iri->host));
+    } else {
+        if (NULL == iri->path) {
+            LogDebug("path is invalid");
+            return;
+        }
+        // case of local file, store full path
+        host = DPL::FromASCIIString(std::string(iri->path));
+    }
 
     SubmitFormData submitFormData;
     eina_hash_foreach(data, submitFormDataSet, &submitFormData);
 
-    if (MIN_SUBMIT_FORM_DATA_SIZE >= submitFormData.size()) {
+    if (MIN_SUBMIT_FORM_DATA_SIZE == submitFormData.size()) {
         LogDebug("not enough data size " << submitFormData.size());
         return;
     }
@@ -138,12 +160,27 @@ DPL::Optional<DPL::String> jsForAutoFillData(const char *uri)
 
     // check uri is invalid
     DPL::ScopedPtr<iri_t> iri(iri_parse(uri));
-    if (!iri.Get() || NULL == iri->host) {
-        LogDebug("host is invalid");
+    if (!iri.Get()) {
+        LogDebug("Fail to get iri");
         return DPL::OptionalString::Null;
     }
-    DPL::String host = DPL::FromASCIIString(std::string(iri->host));
-
+    DPL::String host;
+    if (strstr(uri, SCHEME_TYPE_HTTP) == uri ||
+        strstr(uri, SCHEME_TYPE_HTTPS) == uri)
+    {
+        if (NULL == iri->host) {
+            LogDebug("host is invalid");
+            return DPL::OptionalString::Null;
+        }
+        host = DPL::FromASCIIString(std::string(iri->host));
+    } else {
+        if (NULL == iri->path) {
+            LogDebug("path is invalid");
+            return DPL::OptionalString::Null;
+        }
+        // case of local file, compare fullpath
+        host = DPL::FromASCIIString(std::string(iri->path));
+    }
     SubmitFormData submitData =
         AutoSaveDAOReadOnly::getAutoSaveSubmitFormData(host);
 
@@ -198,7 +235,6 @@ DPL::Optional<DPL::String> jsForAutoFillData(const char *uri)
     jsStr.replace(jsStr.find(JS_VALUE_TAG),
                   JS_VALUE_TAG.length(),
                   valueOstring.str());
-    LogDebug("\n" << jsStr);
 
     return DPL::FromUTF8String(jsStr);
 }
index 1dd8d2a..ec3c5c2 100644 (file)
 
 #include <memory>
 #include <string>
-#include <dpl/fast_delegate.h>
 #include <common/evas_object.h>
 #include <ewk_context.h>
 #include <i_runnable_widget_object.h>
 
-class WindowData; //FORWARD DECLARATION
 class WidgetModel; //FORWARD DECLARATION
-struct WidgetLaunchStruct; //FORWARD DECLARATION
 struct OperationStatusStruct; //FORWARD DECLARATION
-struct InitScreenStruct; //FORWARD DECLARATION
 namespace ViewModule {
 
-typedef DPL::FastDelegate0<void> ProgresFinishedCallback;
-
 /** \brief Interface to ViewModule. Object of IViewModule type is returned from
  *  ViewModuleMgr factory.
  */
@@ -46,9 +40,7 @@ class IViewModule
 {
 public:
     virtual void createWebView(Ewk_Context* context,
-                               Evas_Object* window,
-                               Evas_Object* conformant = NULL,
-                               ProgresFinishedCallback cb = NULL) = 0;
+                               Evas_Object* window) = 0;
     virtual void destroyWebView() = 0;
     virtual void initialize() = 0;
     virtual void terminate() = 0;
index b0d4b82..2504c7f 100644 (file)
@@ -38,7 +38,6 @@
 #include <common/application_launcher.h>
 #include <common/scheme.h>
 #include <common/roaming_agent.h>
-#include <common/window_data.h>
 
 #include <common/view_logic_apps_support.h>
 #include <common/view_logic_custom_header_support.h>
@@ -99,17 +98,13 @@ const char * const EWK_VIBRATION_CANCEL = "vibration,cancel";
 }
 
 void ViewLogic::createWebView(Ewk_Context* context,
-                              Evas_Object* window,
-                              Evas_Object* conformant,
-                              ViewModule::ProgresFinishedCallback cb)
+                              Evas_Object* window)
 {
     LogDebug("");
-    m_finishedCallback = cb;
     initializeEwkContext(context);
     Assert(NULL != m_ewkContext);
     Assert(window);
     m_window = window;
-    m_conformant = conformant;
     createEwkView();
 }
 
@@ -212,9 +207,9 @@ void ViewLogic::showWidget()
     WKPageLoadURL(ewk_view_WKPage_get(m_currentEwkView), baseUrl);
     WKRelease(baseUrl);
 
-    setLayout(m_currentEwkView);
-    evas_object_show(m_currentEwkView);
-    evas_object_focus_set(m_currentEwkView, EINA_TRUE);
+    if (m_cbs->bufferSet) {
+        m_cbs->bufferSet(m_currentEwkView, m_cbsData);
+    }
 }
 
 void ViewLogic::hideWidget()
@@ -342,14 +337,13 @@ void ViewLogic::resetWidget()
     WKPageLoadURL(ewk_view_WKPage_get(m_currentEwkView), baseUrl);
     WKRelease(baseUrl);
 
-    setLayout(m_currentEwkView);
-    elm_win_raise(m_window);
-    evas_object_focus_set(m_currentEwkView, EINA_TRUE);
-    
     // call user callback
     if (m_cbs->reset) {
         m_cbs->reset(true, m_cbsData);
     }
+    if (m_cbs->bufferSet) {
+        m_cbs->bufferSet(m_currentEwkView, m_cbsData);
+    }
 }
 
 void ViewLogic::goBack()
@@ -457,7 +451,6 @@ ViewLogic::ViewLogic():
     m_appsSupport(new ViewModule::AppsSupport()),
     m_vibrationSupport(new ViewModule::VibrationSupport()),
     m_window(NULL),
-    m_conformant(NULL),
     m_cbs(new WRT::UserCallbacks),
     m_cbsData(NULL)
 {
@@ -1148,8 +1141,8 @@ void ViewLogic::didFinishProgressCallback(WKPageRef /*page*/,
 {
     LogDebug("didFinishProgressCallback");
     ViewLogic const * const view = static_cast<ViewLogic const * const>(clientinfo);
-    if (!view->m_finishedCallback.empty())
-        view->m_finishedCallback();
+    if (view->m_cbs->progressFinish)
+        view->m_cbs->progressFinish(view->m_cbsData);
 }
 
 void ViewLogic::createWindowCallback(
@@ -1168,9 +1161,9 @@ void ViewLogic::createWindowCallback(
        then view should not be suspended*/
     //This->suspendEwkView(currentEwkView);
 
-    // hide current ewkview
-    evas_object_hide(currentEwkView);
-    This->unsetLayout();
+    if (This->m_cbs->bufferUnset) {
+        This->m_cbs->bufferUnset(currentEwkView, This->m_cbsData);
+    }
 
     // create new ewkview
     This->createEwkView();
@@ -1183,9 +1176,9 @@ void ViewLogic::createWindowCallback(
     This->prepareEwkView(newEwkView);
 
     // show new ewkview
-    This->setLayout(newEwkView);
-    evas_object_show(newEwkView);
-    evas_object_focus_set(newEwkView, EINA_TRUE);
+    if (This->m_cbs->bufferUnset) {
+        This->m_cbs->bufferSet(newEwkView, This->m_cbsData);
+    }
     *(static_cast<Evas_Object **>(eventInfo)) = newEwkView;
 }
 
@@ -1799,9 +1792,10 @@ void ViewLogic::windowClose()
         return;
     } else {
         // hide current ewkView
-        evas_object_hide(m_currentEwkView);
-        unsetLayout();
-        // remove current ewkView
+
+        if (m_cbs->bufferUnset) {
+            m_cbs->bufferUnset(m_currentEwkView, m_cbsData);
+        }
         removeEwkView(m_currentEwkView);
 
         // get latest ewkView
@@ -1824,23 +1818,8 @@ void ViewLogic::windowClose()
         //resumeEwkView(m_currentEwkView);
 
         // show ewkView
-        setLayout(m_currentEwkView);
-        evas_object_show(m_currentEwkView);
-        evas_object_focus_set(m_currentEwkView, EINA_TRUE);
-    }
-}
-
-// TODO try to remove it from ViewLogic
-void ViewLogic::setLayout(Evas_Object* object)
-{
-    if (m_conformant) {
-        elm_object_content_set(m_conformant, object);
-    }
-}
-
-void ViewLogic::unsetLayout()
-{
-    if (m_conformant) {
-        elm_object_content_unset(m_conformant);
+        if (m_cbs->bufferSet) {
+            m_cbs->bufferSet(m_currentEwkView, m_cbsData);
+        }
     }
 }
index 0951104..fc1c091 100644 (file)
@@ -44,9 +44,7 @@ class ViewLogic : public ViewModule::IViewModule
 {
   public:
     void createWebView(Ewk_Context* context,
-                       Evas_Object* window,
-                       Evas_Object* conformant = NULL,
-                       ViewModule::ProgresFinishedCallback cb = NULL);
+                       Evas_Object* window);
     void destroyWebView();
     void initialize();
     void terminate();
@@ -250,15 +248,11 @@ class ViewLogic : public ViewModule::IViewModule
     // window
     void windowClose(void);
 
-    // UI
-    void setLayout(Evas_Object* object);
-    void unsetLayout();
 
     Ewk_Context* m_ewkContext;
     std::list<Evas_Object*> m_ewkViewList;
     Evas_Object* m_currentEwkView;
     Evas_Object* m_window;
-    Evas_Object* m_conformant;
     WidgetModel* m_model;
     std::string m_currentUri;
     std::string m_blockedUri;
@@ -268,8 +262,6 @@ class ViewLogic : public ViewModule::IViewModule
     WRT::UserCallbacksPtr m_cbs;
     void* m_cbsData;
 
-    ViewModule::ProgresFinishedCallback m_finishedCallback;
-
     std::unique_ptr<SchemeSupport> m_schemeSupport;
     std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
     std::unique_ptr<ViewModule::VibrationSupport> m_vibrationSupport;
index ae47d5a..686f04f 100644 (file)
@@ -27,7 +27,6 @@
 #include <widget_model.h>
 
 #include <common/scheme_action_map.h>
-#include <common/window_data.h>
 
 #include <ewk_view.h>
 #include <WKString.h>
index 6af4d25..ea1f048 100644 (file)
@@ -16,6 +16,8 @@
 SET(TARGET_WRT_CLIENT "wrt-client")
 
 SET(WRT_CLIENT_SRCS
+    ${PROJECT_SOURCE_DIR}/src/wrt-client/window_data.cpp
+    ${PROJECT_SOURCE_DIR}/src/wrt-client/splash_screen_support.cpp
     ${PROJECT_SOURCE_DIR}/src/wrt-client/wrt-client.cpp
 )
 
  *    limitations under the License.
  */
 /**
- * @file        view_logic_splash_screen_support.cpp
+ * @file        splash_screen_support.cpp
  * @author      Andrzej Surdej (a.surdej@samsung.com)
  * @brief       Implementation file for splash screen support
  */
 
-#include "view_logic_splash_screen_support.h"
+#include "splash_screen_support.h"
 #include <dpl/log/log.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <Elementary.h>
 
-namespace ViewModule {
 
 SplashScreenSupport::SplashScreenSupport(Evas_Object* parent)
 {
@@ -56,7 +55,6 @@ bool SplashScreenSupport::createSplashScreen(const WidgetHandle handle)
     } else {
         result = false;
     }
-    startSplashScreen();
     return result;
 }
 
@@ -99,5 +97,4 @@ void SplashScreenSupport::setSplashImagePath(const char * image_path)
             LogError("loading splash image has been failed");
         }
     }
-}
-} //ViewModule
\ No newline at end of file
+}
\ No newline at end of file
similarity index 93%
rename from src/view/common/view_logic_splash_screen_support.h
rename to src/wrt-client/splash_screen_support.h
index 5467dd2..f62c9b6 100644 (file)
@@ -14,7 +14,7 @@
  *    limitations under the License.
  */
 /**
- * @file        view_logic_splash_screen_support.h
+ * @file        splash_screen_support.h
  * @author      Andrzej Surdej (a.surdej@samsung.com)
  * @brief       Header file for supporting splash screen handling
  */
@@ -26,7 +26,6 @@
 #include <Evas.h>
 #include <memory>
 
-namespace ViewModule {
 
 class SplashScreenSupport
 {
@@ -45,5 +44,4 @@ class SplashScreenSupport
 
 typedef std::shared_ptr<SplashScreenSupport> SplashScreenSupportPtr;
 
-} // ViewModule
 #endif /* WRT_SPLASH_SCREEN_SUPPORT_H */
index 098a4dc..19308ae 100644 (file)
 //W3C PACKAGING enviroment variable name
 #define W3C_DEBUG_ENV_VARIABLE "DEBUG_LOAD_FINISH"
 
+// window signal callback
+const char *EDJE_SHOW_BACKWARD_SIGNAL = "show,backward,signal";
+const std::string VIEWMODE_TYPE_FULLSCREEN = "fullscreen";
+const std::string VIEWMODE_TYPE_MAXIMIZED = "maximized";
+
 WrtClient::WrtClient(int argc, char **argv) :
     Application(argc, argv, "wrt-client", false),
     DPL::TaskDecl<WrtClient>(this),
@@ -78,6 +83,7 @@ void WrtClient::OnResume()
         return;
     }
     m_widget->Resume();
+    evas_object_focus_set(m_widget->GetCurrentWebview(), EINA_TRUE);
     m_widgetState = WidgetState_Running;
 }
 
@@ -109,6 +115,9 @@ void WrtClient::OnReset(bundle *b)
             return;
         }
         m_widget->Reset();
+        m_windowData->emitSignalForUserLayout(EDJE_SHOW_BACKWARD_SIGNAL, "");
+        elm_win_raise(m_windowData->m_win);
+        evas_object_focus_set(m_widget->GetCurrentWebview(), EINA_TRUE);
         m_widgetState = WidgetState_Running;
     } else {
         if (true == checkArgument())
@@ -416,6 +425,12 @@ void WrtClient::loadFinishCallback(bool success, void* data)
     delete debug;
 }
 
+void WrtClient::progressFinishCallback(void* data)
+{
+    WrtClient* wrtClient = static_cast<WrtClient*>(data);
+    wrtClient->m_splashScreen->stopSplashScreen();
+}
+
 void WrtClient::launchStep()
 {
     LogDebug("Launching widget ...");
@@ -448,6 +463,26 @@ void WrtClient::launchStep()
     LocalizationSetting::SetLanguageChangedCallback(
             languageChangedCallback, this);
 
+    ADD_PROFILING_POINT("CreateWindow", "start");
+    m_windowData.reset(new WindowData(static_cast<unsigned long>(getpid())));
+    ADD_PROFILING_POINT("CreateWindow", "stop");
+
+    WRT::UserCallbacksPtr cbs(new WRT::UserCallbacks);
+    m_splashScreen.reset(
+            new SplashScreenSupport(m_windowData->m_win));
+    if (m_splashScreen->createSplashScreen(m_handle)) {
+        m_splashScreen->startSplashScreen();
+        cbs->progressFinish = progressFinishCallback;
+    }
+    DPL::OptionalString startUrl = m_widget->GetModel()->RunningStartURL.Get();
+    m_widget->PrepareView(DPL::ToUTF8String(*startUrl),
+            m_windowData->m_win);
+    //you can't show window with splash screen before PrepareView
+    //ewk_view_add_with_context() in viewLogic breaks window
+    evas_object_show(m_windowData->m_win);
+    initializeWindowModes();
+    connectElmCallback();
+
     if (!checkWACTestCertififedWidget())
     {
         LogWarning("WAC Certificate failed, stop launchStep");
@@ -462,18 +497,114 @@ void WrtClient::launchStep()
         return;
     }
     LogInfo("Widget launch accepted. Entering running state");
-    DPL::OptionalString startUrl = m_widget->GetModel()->RunningStartURL.Get();
     m_widgetState = WidgetState_Running;
-    m_widget->PrepareView(DPL::ToUTF8String(*startUrl), NULL);
 
-    m_cbs.reset(new WRT::UserCallbacks);
-    m_cbs->loadFinish = loadFinishCallback;
-    m_cbs->resume = NULL;
-    m_cbs->suspend = NULL;
-    m_cbs->reset = NULL;
+    cbs->loadFinish = loadFinishCallback;
+    cbs->bufferSet = setLayout;
+    cbs->bufferUnset = unsetLayout;
 
-    m_widget->SetUserCallbacks(m_cbs, this);
+    m_widget->SetUserCallbacks(cbs, this);
     m_widget->Show();
+    m_windowData->emitSignalForUserLayout(EDJE_SHOW_BACKWARD_SIGNAL, "");
+}
+
+void WrtClient::initializeWindowModes()
+{
+    Assert(m_windowData);
+    WRT::WidgetModelPtr model = m_widget->GetModel();
+    Assert(model);
+    auto windowModes = model->WindowModes.Get();
+    bool fullscreen = false;
+    FOREACH(it, windowModes)
+    {
+        std::string viewMode = DPL::ToUTF8String(*it);
+        if (viewMode == VIEWMODE_TYPE_FULLSCREEN) {
+            fullscreen = true;
+            break;
+        } else if (viewMode == VIEWMODE_TYPE_MAXIMIZED) {
+            break;
+        }
+    }
+    bool indicator = true;
+    bool backbutton = false;
+    if (model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
+        indicator
+        = (model->SettingList.Get().getIndicatorPresence()
+           == Indicator_Enable);
+        backbutton
+        = (model->SettingList.Get().getBackButtonPresence()
+           == BackButton_Enable);
+    }
+
+    if (!fullscreen) {
+        std::string name = "";
+        if (!(model->Name.Get().IsNull())) {
+            name = DPL::ToUTF8String(*(model->Name.Get()));
+        }
+        m_windowData->setViewModeMaximized(
+            name.c_str(), indicator, backbutton);
+    } else {
+        m_windowData->setViewModeFullScreen(
+            indicator, backbutton);
+    }
+}
+
+void WrtClient::backButtonCallback(void* data,
+                                     Evas_Object * /*obj*/,
+                                     void * /*event_info*/)
+{
+    LogInfo("BackButtonCallback");
+    Assert(data);
+
+    WrtClient* This = static_cast<WrtClient*>(data);
+
+    This->m_widget->GoBack();
+}
+
+void WrtClient::connectElmCallback()
+{
+    Assert(m_windowData);
+    WRT::WidgetModelPtr model = m_widget->GetModel();
+    Assert(model);
+    if (model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
+        if (model->SettingList.Get().getBackButtonPresence() ==
+                BackButton_Enable)
+        {
+            m_windowData->addFloatBackButtonCallback(
+                "clicked",
+                &WrtClient::backButtonCallback,
+                this);
+        }
+
+        WidgetSettingScreenLock rotationValue =
+                model->SettingList.Get().getRotationValue();
+        if (rotationValue == Screen_Portrait) {
+            elm_win_rotation_with_resize_set(m_windowData->m_win, 0);
+        } else if (rotationValue == Screen_Landscape) {
+            elm_win_rotation_with_resize_set(m_windowData->m_win, 270);
+        } else {
+            elm_win_rotation_with_resize_set(m_windowData->m_win, 0);
+        }
+    }
+}
+
+void WrtClient::setLayout(Evas_Object* newBuffer, void* data) {
+    LogDebug("add new webkit buffer to window");
+    Assert(data);
+    Assert(newBuffer);
+    WrtClient* wrtClient = static_cast<WrtClient*>(data);
+    elm_object_content_set(wrtClient->m_windowData->m_conformant, newBuffer);
+    evas_object_show(newBuffer);
+    evas_object_focus_set(newBuffer, EINA_TRUE);
+}
+
+void WrtClient::unsetLayout(Evas_Object* currentBuffer, void* data) {
+    LogDebug("remove current webkit buffer from window");
+    Assert(data);
+    Assert(currentBuffer);
+    WrtClient* wrtClient = static_cast<WrtClient*>(data);
+    evas_object_hide(currentBuffer);
+    elm_object_content_unset(wrtClient->m_windowData->m_conformant);
 }
 
 void WrtClient::shutdownStep()
@@ -483,6 +614,7 @@ void WrtClient::shutdownStep()
         m_widgetState = WidgetState_Stopped;
         m_widget->Hide();
         m_widget.reset();
+        m_windowData.reset();
         WRT::CoreModuleSingleton::Instance().Terminate();
         m_initialized = false;
     }
@@ -529,7 +661,7 @@ int main(int argc,
                 LogDebug("Enable backend");
         }
     }
-
     // Set log tagging
     DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-CLIENT");
 
index 026558a..c7410a1 100644 (file)
@@ -27,6 +27,8 @@
 #include <common_error.h>
 #include <launch_user_data.h>
 #include <widget_model.h>
+#include "window_data.h"
+#include "splash_screen_support.h"
 
 DECLARE_GENERIC_EVENT_0(NextStepEvent)
 
@@ -71,9 +73,15 @@ class WrtClient :
                             SDKDebugData* debugData);
     bool                 checkWACTestCertififedWidget();
     void                 localizeWidgetModel();
+    void                 connectElmCallback();
+    void                 initializeWindowModes();
 
     // Events
     virtual void         OnEventReceived(const NextStepEvent& event);
+    // UI callback
+    static void          backButtonCallback(void* data,
+                                   Evas_Object* obj,
+                                   void* event_info);
 
     // launching steps
     void                 initStep();
@@ -81,6 +89,9 @@ class WrtClient :
     void                 shutdownStep();
     static int           languageChangedCallback(void *data);
     static void          loadFinishCallback(bool success, void* data);
+    static void          progressFinishCallback(void* data);
+    static void          setLayout(Evas_Object* newBuffer, void* data);
+    static void          unsetLayout(Evas_Object* currentBuffer, void* data);
     // Private data
     int m_handle;
     bool m_launched;
@@ -92,8 +103,9 @@ class WrtClient :
     unsigned short m_debuggerPort;
     ReturnStatus::Type m_returnStatus;
     WRT::RunnableWidgetObjectPtr m_widget;
-    WRT::UserCallbacksPtr m_cbs;
     WidgetState m_widgetState;
+    std::unique_ptr<WindowData> m_windowData;
+    std::unique_ptr<SplashScreenSupport> m_splashScreen;
 };
 
 #endif // WRT_CLIENT_H
index 69f3be3..fbcf23f 100644 (file)
@@ -32,7 +32,7 @@
 #include <dpl/wrt-dao-rw/global_dao.h>
 #include <dpl/wrt-dao-ro/global_dao_read_only.h>
 
-#define TIMEOUT_DEFAULT     5
+#define TIMEOUT_DEFAULT     10
 #define ROOT_DEFAULT_UID 0
 #define ROOT_DEFAULT_GID 0
 #define WEBAPP_DEFAULT_UID  5000
@@ -191,6 +191,7 @@ int main(int argc, char* argv[])
     char temp_arg[256] = "";
     char pid[6] = "";
     char op = '\0';
+    bool isDebugMode = false;
     struct sigaction sigact;
 
     service_h serviceHandle = NULL;
@@ -289,6 +290,7 @@ int main(int argc, char* argv[])
                 service_destroy(serviceHandle);
                 return FALSE;
             }
+            isDebugMode = true;
             break;
 
         case 'v':
@@ -408,7 +410,7 @@ int main(int argc, char* argv[])
 
     if (op == 's') {
         /* check if this is request for debug mode, or not */
-        if (serviceHandle != NULL) {
+        if (true == isDebugMode) {
             /* wait for return from the widget */
             sigemptyset(&sigact.sa_mask);
             sigact.sa_flags = SA_SIGINFO;
@@ -419,6 +421,14 @@ int main(int argc, char* argv[])
                 printf("signal error\n");
                 return -1;
             }
+        } else {
+            // case of "-d" option, service_create is already allocated
+            // create service
+            ret = service_create(&serviceHandle);
+            if (SERVICE_ERROR_NONE != ret && NULL == serviceHandle) {
+                LogError("Fail to create service");
+                return FALSE;
+            }
         }
 
         if (strlen(pkgname) > 0) {
@@ -459,19 +469,12 @@ int main(int argc, char* argv[])
             return -1;
         }
 
-        if (serviceHandle != NULL) {
+        if (true == isDebugMode) {
             // wait RTS signal from widget by 5 second
             sleep(timeout);
             printf("result: %s\n", "failed");
             return -1;
         }
-
-        if (ret > 0) {
-            printf("result: %s\n", "launched");
-        } else {
-            printf("result: %s\n", "failed");
-            return -1;
-        }
     } else if (op == 'k') {
         bool isRunning = false;