Enable back-key on remote URL
authorJongHeon Choi <j-h.choi@samsung.com>
Thu, 7 Apr 2016 06:45:40 +0000 (15:45 +0900)
committerJongHeon Choi <j-h.choi@samsung.com>
Thu, 7 Apr 2016 06:45:40 +0000 (15:45 +0900)
runtime/browser/web_application.cc

index e9b211d..b006d8c 100755 (executable)
@@ -96,6 +96,7 @@ const char* kLocationPrivilege = "http://tizen.org/privilege/location";
 const char* kStoragePrivilege = "http://tizen.org/privilege/unlimitedstorage";
 const char* kUsermediaPrivilege = "http://tizen.org/privilege/mediacapture";
 const char* kNotiIconFile = "noti_icon.png";
+const char* kFileScheme = "file://";
 
 const char* kVisibilitySuspendFeature = "visibility,suspend";
 const char* kMediastreamRecordFeature = "mediastream,record";
@@ -603,6 +604,13 @@ void WebApplication::OnOrientationLock(
 }
 
 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();
+    return;
+  }
+
   bool enabled = app_data_->setting_info() != NULL
                      ? app_data_->setting_info()->hwkey_enabled()
                      : true;