Implement Hardware Backkey action 87/174687/2
authorws29.jung <ws29.jung@samsung.com>
Tue, 3 Apr 2018 11:05:00 +0000 (20:05 +0900)
committerws29.jung <ws29.jung@samsung.com>
Tue, 3 Apr 2018 11:38:27 +0000 (20:38 +0900)
Hardware Backkey callback was already registered and called but
inside of it, there was nothing implemented related with WebApp.
Now hardware backkey work as it should be, like going back history
and App quit when there is no history to go back.

Change-Id: Ib95be89c8dc4da0628b7c69c531f36ff921c1b04
Signed-off-by: ws29.jung <ws29.jung@samsung.com>
atom/app/ui_runtime.cc
atom/browser/browser.cc
atom/browser/native_window_efl.cc

index c85a63fd4276cede0a188646e8f7448b097f9c0d..2593e3233f6267d8d05911dd5ee5b0312470f392 100644 (file)
@@ -45,7 +45,6 @@ bool UiRuntime::OnCreate() {
 
 void UiRuntime::OnTerminate() {
   atom::Browser *browser_model = atom::Browser::Get();
-  browser_model->Shutdown();
 }
 
 void UiRuntime::OnPause() {
index 42cc787ee980593c251fef47c3ebb544e16719a0..2678b1c3ec858be5d97fb219be10d1932f9c27cb 100644 (file)
@@ -5,6 +5,7 @@
 #include "atom/browser/browser.h"
 
 #include <string>
+#include <app.h>
 
 #include "atom/browser/atom_browser_main_parts.h"
 #include "atom/browser/browser_observer.h"
@@ -87,6 +88,7 @@ void Browser::Shutdown() {
   if (base::ThreadTaskRunnerHandle::IsSet()) {
     base::ThreadTaskRunnerHandle::Get()->PostTask(
         FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
+    ui_app_exit();
   } else {
     // There is no message loop available so we are in early stage.
     exit(0);
index 209e49c4319e734b9dd7f15991c1da9104a46c7b..af0b8626e3049f1594a6212e1f84a75c6b821fd5 100644 (file)
@@ -145,7 +145,6 @@ void NativeWindowEfl::Close() {
 }
 
 void NativeWindowEfl::CloseImmediately() {
-  NOTIMPLEMENTED();
   if(window_)
     evas_object_del(window_);
   window_ = nullptr;
@@ -419,6 +418,10 @@ void NativeWindowEfl::HWBackKeyCallback(void* data, Evas_Object*, void*) {
     rfh->ExecuteJavaScriptWithUserGestureForTests(
         base::UTF8ToUTF16(kBackKeyEventScript));
   }
+  if (thiz->web_contents()->GetController().CanGoBack())
+    thiz->web_contents()->GetController().GoBack();
+  else
+    thiz->Close();
 }
 
 // static