Add codes to enable web voice touch 42/126142/3 accepted/tizen/unified/20170502.041136 submit/tizen/20170502.005636
authorSuyeon Hwang <stom.hwang@samsung.com>
Fri, 14 Apr 2017 01:49:25 +0000 (10:49 +0900)
committerjaekuk lee <juku1999@samsung.com>
Tue, 2 May 2017 00:39:56 +0000 (00:39 +0000)
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 <stom.hwang@samsung.com>
packaging/crosswalk-tizen.spec
runtime/browser/web_application.cc
runtime/browser/web_application.h
runtime/runtime.gyp

index a948158..baed898 100755 (executable)
@@ -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
 
index ccfe850..94ed40a 100755 (executable)
@@ -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<common::AppControl> 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.
index 0e10967..0614f1f 100755 (executable)
@@ -22,6 +22,7 @@
 #include <memory>
 #include <string>
 
+#include <voice_control_webview.h>
 #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
index 168f13a..0beb057 100755 (executable)
@@ -65,6 +65,7 @@
           'wgt-manifest-handlers',
           'notification',
           'launchpad',
+          'vc-webview',
         ],
       },
       'conditions': [