Fixed backbutton-presence setting in config.xml
authorJongHeon Choi <j-h.choi@samsung.com>
Tue, 3 May 2016 06:33:56 +0000 (15:33 +0900)
committerJongHeon Choi <j-h.choi@samsung.com>
Tue, 3 May 2016 06:34:08 +0000 (15:34 +0900)
runtime/browser/web_application.cc
runtime/browser/web_application.h
runtime/browser/web_view.cc
runtime/browser/web_view.h
runtime/browser/web_view_impl.cc
runtime/browser/web_view_impl.h
runtime/renderer/injected_bundle.cc

index b338095..c86b522 100644 (file)
@@ -495,7 +495,7 @@ void WebApplication::OnCreatedNewWebView(WebView* /*view*/, WebView* new_view) {
   window_->SetContent(new_view->evas_object());
 }
 
-void WebApplication::OnClosedWebView(WebView* view) {
+void WebApplication::RemoveWebViewFromStack(WebView* view) {
   if (view_stack_.size() == 0) return;
 
   WebView* current = view_stack_.front();
@@ -524,6 +524,10 @@ void WebApplication::OnClosedWebView(WebView* view) {
                   view);
 }
 
+void WebApplication::OnClosedWebView(WebView* view) {
+    RemoveWebViewFromStack(view);
+}
+
 void WebApplication::OnReceivedWrtMessage(WebView* /*view*/,
                                           Ewk_IPC_Wrt_Message_Data* msg) {
   Eina_Stringshare* msg_id = ewk_ipc_wrt_message_data_id_get(msg);
@@ -616,7 +620,9 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) {
   // NOTE: This code is added to enable back-key on remote URL
   if (!common::utils::StartsWith(view->GetUrl(), kFileScheme)) {
     LOGGER(DEBUG) << "Back to previous page for remote URL";
-    view->Backward();
+    if (!view->Backward()) {
+      RemoveWebViewFromStack(view_stack_.front());
+    }
     return;
   }
 
@@ -629,7 +635,9 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) {
     // If the 'backbutton_presence' is true, WebView should be navigated back.
     if (app_data_->setting_info() &&
         app_data_->setting_info()->backbutton_presence()) {
-      view->Backward();
+      if (!view->Backward()) {
+        RemoveWebViewFromStack(view_stack_.front());
+      }
     }
   } else if (enabled && kKeyNameMenu == keyname) {
     view->EvalJavascript(kMenuKeyEventScript);
index f3c3989..09ad3bb 100755 (executable)
@@ -103,6 +103,7 @@ class WebApplication : public WebView::EventListener {
   void SendAppControlEvent();
   void LaunchInspector(common::AppControl* appcontrol);
   void SetupWebView(WebView* view);
+  void RemoveWebViewFromStack(WebView* view);
 
   bool launched_;
   bool debug_mode_;
index 7fa79d5..fe33581 100644 (file)
@@ -53,8 +53,8 @@ void WebView::Reload() {
   impl_->Reload();
 }
 
-void WebView::Backward() {
-  impl_->Backward();
+bool WebView::Backward() {
+  return impl_->Backward();
 }
 
 void WebView::SetVisibility(bool show) {
index 6456650..878fe31 100644 (file)
@@ -118,7 +118,7 @@ class WebView {
   void Suspend();
   void Resume();
   void Reload();
-  void Backward();
+  bool Backward();
   void SetVisibility(bool show);
   bool EvalJavascript(const std::string& script);
   void SetAppInfo(const std::string& app_name, const std::string& version);
index 2d3a7dc..cf1f343 100644 (file)
@@ -131,8 +131,12 @@ void WebViewImpl::Reload() {
   ewk_view_reload(ewk_view_);
 }
 
-void WebViewImpl::Backward() {
-  ewk_view_back(ewk_view_);
+bool WebViewImpl::Backward() {
+  if (ewk_view_back_possible(ewk_view_)) {
+    ewk_view_back(ewk_view_);
+    return EINA_TRUE;
+  }
+  return EINA_FALSE;
 }
 
 void WebViewImpl::SetVisibility(bool show) {
index 9b6b3b1..b9d22f5 100644 (file)
@@ -41,7 +41,7 @@ class WebViewImpl {
   void Suspend();
   void Resume();
   void Reload();
-  void Backward();
+  bool Backward();
   void SetVisibility(bool show);
   bool EvalJavascript(const std::string& script);
   void SetAppInfo(const std::string& app_name, const std::string& version);
index 0abd02d..e3f5730 100755 (executable)
@@ -157,8 +157,6 @@ extern "C" void DynamicPluginStopSession(
 
 extern "C" void DynamicUrlParsing(
     std::string* old_url, std::string* new_url, const char* /*tizen_id*/) {
-  SCOPE_PROFILE();
-
   auto res_manager =
       runtime::BundleGlobalData::GetInstance()->resource_manager();
   if (res_manager == NULL) {