Terminate properly when triggering hardware back key event 92/113092/2
authorYoungsoo Choi <kenshin.choi@samsung.com>
Mon, 6 Feb 2017 04:09:15 +0000 (13:09 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Mon, 6 Feb 2017 05:19:47 +0000 (14:19 +0900)
Termination should not be done when there are multiple webviews and
hardware back key event is triggered for page navigation.
The termination needs to be done only if there is one webview on view stack.

This CL adds condition for the checking webview count.

PLM: P170125-05834
Bug: http://suprem.sec.samsung.net/jira/browse/TWF-2951

Change-Id: I6d4056c46a0c9999d068d1dd4c14d4f4793457a0
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
runtime/browser/web_application.cc

index ac93129..a99a876 100755 (executable)
@@ -931,8 +931,12 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) {
       if(enabled)
         view->EvalJavascript(kBackKeyEventScript);
       if (!view->Backward()) {
-        LOGGER(DEBUG) << "Terminate";
-        Terminate();
+        if (view_stack_.size() == 1) {
+          LOGGER(DEBUG) << "Terminate";
+          Terminate();
+        } else {
+          RemoveWebViewFromStack(view_stack_.front());
+        }
       }
     }
     return;
@@ -947,8 +951,12 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) {
         (app_data_->widget_info() != NULL &&
          app_data_->widget_info()->view_modes() == "windowed")) {
       if (!view->Backward()) {
-        LOGGER(DEBUG) << "Terminate";
-        Terminate();
+        if (view_stack_.size() == 1) {
+          LOGGER(DEBUG) << "Terminate";
+          Terminate();
+        } else {
+          RemoveWebViewFromStack(view_stack_.front());
+        }
       }
     }
   } else if (enabled && kKeyNameMenu == keyname) {