#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/render_frame_host.h"
+#include "tizen/common/application_data.h"
#endif
#if defined(OS_TIZEN_TV_PRODUCT)
const int kDefaultWindowWidthDip = 800;
const int kDefaultWindowHeightDip = 600;
+const char* kFileScheme = "file";
+const std::string kViewmodeTypeWindowed = "windowed";
+
#if defined(OS_TIZEN)
const char* kBackKeyEventScript =
"(function(){"
#if defined(OS_TIZEN)
// static
void NativeWindowEfl::HWBackKeyCallback(void* data, Evas_Object*, void*) {
+
+ auto app_data_ = common::ApplicationDataManager::GetCurrentAppData();
+
+ bool enabled = app_data_->setting_info() != NULL
+ ? app_data_->setting_info()->hwkey_enabled()
+ : true;
+ if(!enabled)
+ return;
+
NativeWindow* thiz = static_cast<NativeWindow*>(data);
// TODO: We need to consider to clear selection or exit fullscreen
// before send JS custom event.
content::RenderFrameHost* rfh = thiz->web_contents()->GetMainFrame();
+
if (rfh) {
rfh->ExecuteJavaScriptWithUserGestureForTests(
base::UTF8ToUTF16(kBackKeyEventScript));
}
- if (thiz->web_contents()->GetController().CanGoBack())
+
+ std::string scheme = thiz->web_contents()->GetURL().scheme();
+
+ if ((app_data_->setting_info() != NULL &&
+ app_data_->setting_info()->backbutton_presence()) ||
+ (app_data_->widget_info() != NULL &&
+ app_data_->widget_info()->view_modes() == kViewmodeTypeWindowed) ||
+ (scheme != kFileScheme)) {
+ if (thiz->web_contents()->GetController().CanGoBack())
+ thiz->web_contents()->GetController().GoBack();
+ else
+ thiz->Close();
+ } else {
thiz->web_contents()->GetController().GoBack();
- else
- thiz->Close();
+ }
+
}
// static
void NativeWindowEfl::HWMoreKeyCallback(void* data, Evas_Object*, void*) {
NativeWindow* thiz = static_cast<NativeWindow*>(data);
content::RenderFrameHost* rfh = thiz->web_contents()->GetMainFrame();
+
+ auto app_data_ = common::ApplicationDataManager::GetCurrentAppData();
+
+ bool enabled = app_data_->setting_info() != NULL
+ ? app_data_->setting_info()->hwkey_enabled()
+ : true;
+ if(!enabled)
+ return;
+
if (rfh) {
rfh->ExecuteJavaScriptWithUserGestureForTests(
base::UTF8ToUTF16(kMenuKeyEventScript));