From 05e10fc455b2863ac79512c8d24e267bec6eca0c Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Fri, 14 Apr 2017 10:49:25 +0900 Subject: [PATCH] Add codes to enable web voice touch This commit adds codes to enable web voice touch. Web voice touch is enabled by the vconfkey value. To use web voice touch, vc-webview module must be needed. Change-Id: I082c537423e6d3a7b1c0943ae2119f69aabb93fe Signed-off-by: Suyeon Hwang --- packaging/crosswalk-tizen.spec | 1 + runtime/browser/web_application.cc | 37 ++++++++++++++++++++++++++++++ runtime/browser/web_application.h | 2 ++ runtime/runtime.gyp | 1 + 4 files changed, 41 insertions(+) diff --git a/packaging/crosswalk-tizen.spec b/packaging/crosswalk-tizen.spec index a94815845..baed89809 100755 --- a/packaging/crosswalk-tizen.spec +++ b/packaging/crosswalk-tizen.spec @@ -48,6 +48,7 @@ BuildRequires: pkgconfig(uuid) BuildRequires: pkgconfig(launchpad) BuildRequires: pkgconfig(ttrace) BuildRequires: pkgconfig(jsoncpp) +BuildRequires: pkgconfig(vc-webview) %define chromium_efl_workaround_ewk_settings 0 diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index ccfe8503d..94ed40a49 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -482,6 +482,14 @@ bool WebApplication::Initialize() { m_tizenCompatibilitySettings.m_minor = 0; m_tizenCompatibilitySettings.m_release = 0; + // Get Web voice touch agent + bool is_supported_web_vt = false; + vc_webview_ = NULL; + if (0 == VCWebView::vc_is_supported_web_vt(&is_supported_web_vt) && is_supported_web_vt) { + LOGGER(DEBUG) << "[DEBUG] Web voice touch is enabled"; + vc_webview_ = VCWebView::getInstance(); + } + return true; } @@ -534,6 +542,11 @@ void WebApplication::Launch(std::unique_ptr appcontrol) { view->LoadUrl(res->uri(), res->mime()); view_stack_.push_front(view); + // Set web view into Web voice touch agent + if (NULL != vc_webview_) { + vc_webview_->vc_webview_set_view(view->evas_object()); + } + // ewk_view_bg_color_set is not working at webview initialization. if (common::getProfile() == common::kPROFILE_WEARABLE && app_data_->app_type() == common::ApplicationData::WATCH) { @@ -747,6 +760,11 @@ void WebApplication::OnCreatedNewWebView(WebView* /*view*/, WebView* new_view) { SetupWebViewCompatibilitySettings(new_view); view_stack_.push_front(new_view); window_->SetContent(new_view->evas_object()); + + // Set web view into Web voice touch agent + if (NULL != vc_webview_) { + vc_webview_->vc_webview_set_view(new_view->evas_object()); + } } void WebApplication::RemoveWebViewFromStack(WebView* view) { @@ -784,6 +802,11 @@ void WebApplication::RemoveWebViewFromStack(WebView* view) { } else if (current != view_stack_.front()) { view_stack_.front()->SetVisibility(true); window_->SetContent(view_stack_.front()->evas_object()); + + // Set web view into Web voice touch agent + if (NULL != vc_webview_) { + vc_webview_->vc_webview_set_view(view_stack_.front()->evas_object()); + } } // Delete after the callback context(for ewk view) was not used @@ -938,6 +961,15 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) { ? app_data_->setting_info()->hwkey_enabled() : true; + if (NULL != vc_webview_ && kKeyNameBack == keyname && vc_webview_->vc_get_conflict_status() == 1) { + // When Web voice touch is in result conflict state, function of back key change to + // canceling the conflict state + vc_webview_->vc_remove_tooltip(); + LOGGER(DEBUG) << "[DEBUG] Cancel conflict state of web voice touch"; + + return; + } + if (!common::utils::StartsWith(view->GetUrl(), kFileScheme)) { if (kKeyNameBack == keyname) { LOGGER(DEBUG) << "Back to previous page for remote URL"; @@ -1119,6 +1151,11 @@ void WebApplication::OnRendered(WebView* view) { LOGGER(DEBUG) << "Rendered"; splash_screen_->HideSplashScreen(SplashScreen::HideReason::RENDERED); + // Set web view into Web voice touch agent + if (NULL != vc_webview_) { + vc_webview_->vc_webview_set_view(view->evas_object()); + } + // Do not show(), active() for language change if(lang_changed_mode_ == false){ // Show window after frame rendered. diff --git a/runtime/browser/web_application.h b/runtime/browser/web_application.h index 0e1096761..0614f1f37 100755 --- a/runtime/browser/web_application.h +++ b/runtime/browser/web_application.h @@ -22,6 +22,7 @@ #include #include +#include #include "runtime/browser/web_view.h" class Ewk_Context; @@ -148,6 +149,7 @@ class WebApplication : public WebView::EventListener { int security_model_version_; std::string csp_rule_; std::string csp_report_rule_; + VCWebView* vc_webview_; }; } // namespace runtime diff --git a/runtime/runtime.gyp b/runtime/runtime.gyp index 168f13a71..0beb057c9 100755 --- a/runtime/runtime.gyp +++ b/runtime/runtime.gyp @@ -65,6 +65,7 @@ 'wgt-manifest-handlers', 'notification', 'launchpad', + 'vc-webview', ], }, 'conditions': [ -- 2.34.1