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 c85a63f..2593e32 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 42cc787..2678b1c 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 209e49c..af0b862 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