[Performance] Suspend browser instead of terminated on back pressed 80/71480/4
authorm.kawonczyk <m.kawonczyk@samsung.com>
Wed, 25 May 2016 12:16:07 +0000 (14:16 +0200)
committerHye Kyoung Hwang <cookie@samsung.com>
Thu, 26 May 2016 00:09:55 +0000 (17:09 -0700)
[Issue]    N/A
[Problem]  Browser was terminated on back pressed when there was no
           page in history or when there was no view before.
[Solution] Suspend browser instead of terminating it.
[verify]   Open webpage without a history and press back key.
           Open quickaccess as a first view and press back key.
           Reopen browser. In both cases browser should be instantly
           resumed.

Change-Id: I7f82826e55f3b9d494cccd83f8fb6f8df31fd32c

core/Tools/GeneralTools.h
services/SimpleUI/SimpleUI.cpp
services/WebEngineService/WebEngineService.cpp

index c69c3d42be385a648cef33584fbf5a3626a824f3..cd87b0c2969de7f834c74bdfbc0e00265dd14753 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <string>
 #include <cstring>
+#include "app_control.h"
 
 #ifndef __GENERALTOOLS_H__
 #define __GENERALTOOLS_H__
@@ -34,6 +35,7 @@ namespace tools
     static std::string fromChar(const char* c) __attribute__ ((unused));
     static std::string clearURL(const std::string & url) __attribute__ ((unused));
     static std::string extractDomain(const std::string & url) __attribute__ ((unused));
+    static void ui_app_pause() __attribute__ ((unused));
 
     static std::string fromChar(const char* c) { return c ? std::string(c) : std::string(); }
 
@@ -49,6 +51,17 @@ namespace tools
         size_t end = url.find(END_SLASH, beg);
         return url.substr(beg, end - beg);
     }
+
+    static void ui_app_pause() {
+        //From app_control.h on APP_CONTROL_OPERATION_MAIN:
+        //"Definition for the app_control operation: An explicit launch for a homescreen application."
+        app_control_h service;
+        app_control_create(&service);
+        app_control_set_operation(service, APP_CONTROL_OPERATION_MAIN);
+        app_control_set_app_id(service, "org.tizen.homescreen-efl");
+        app_control_send_launch_request(service, NULL, NULL);
+        app_control_destroy(service);
+    }
 }
 }
 
index 17e2ae9beb4c5f2bf501098253e16b07014458f8..dd311d43c7dd047495f2db1b4bd015fce01ad2a7 100644 (file)
@@ -1003,7 +1003,7 @@ void SimpleUI::onBackPressed()
             if (m_quickAccess->canBeBacked(m_webEngine->tabsCount())) {
                 m_quickAccess->backButtonClicked();
             } else {
-                ui_app_exit();
+                tools::ui_app_pause();
             }
         } else {
             m_webEngine->backButtonClicked();
index a897b56e152062b12a072319a2d1d65c85d425e6..e39103caa243c36523500c03bf97345ed8e97d5e 100644 (file)
@@ -27,6 +27,7 @@
 #include "BrowserLogger.h"
 #include "Config/Config.h"
 #include "WebView.h"
+#include "GeneralTools.h"
 
 namespace tizen_browser {
 namespace basic_webengine {
@@ -692,7 +693,7 @@ void WebEngineService::backButtonClicked()
         closeTab();
         switchToWebPage();
     } else {
-        ui_app_exit();
+        tools::ui_app_pause();
     }
 }