From b9ccdf51c14fae0176016b40bbe4dcfa73b9ccc5 Mon Sep 17 00:00:00 2001 From: "min7.choi" Date: Thu, 15 Dec 2016 21:28:06 +0900 Subject: [PATCH] Setting custom timeout HTTP (Long polling) Change-Id: I37282aa22b62a1f83cbcf19bfd1bad46255ea2ca Signed-off-by: min7.choi --- runtime/browser/web_application.cc | 8 ++++++++ runtime/browser/web_application.h | 2 +- runtime/browser/web_view.cc | 4 ++++ runtime/browser/web_view.h | 1 + runtime/browser/web_view_impl.cc | 4 ++++ runtime/browser/web_view_impl.h | 1 + 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index eb72425..47da126 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -923,6 +923,14 @@ void WebApplication::SetupWebView(WebView* view) { view->SetCSPRule(csp_report_rule_, true); } } + +// Setup longpolling value + if (app_data_->setting_info() != NULL && + app_data_->setting_info()->long_polling()) { + boost::optional polling_val(app_data_->setting_info()->long_polling()); + unsigned long *ptr = reinterpret_cast (&polling_val.get()); + view->SetLongPolling(*ptr); + } } bool WebApplication::OnDidNavigation(WebView* /*view*/, diff --git a/runtime/browser/web_application.h b/runtime/browser/web_application.h index 8e72b25..75b934e 100755 --- a/runtime/browser/web_application.h +++ b/runtime/browser/web_application.h @@ -117,6 +117,7 @@ class WebApplication : public WebView::EventListener { bool launched_; bool debug_mode_; bool verbose_mode_; + bool lang_changed_mode_; Ewk_Context* ewk_context_; bool has_ownership_of_ewk_context_; NativeWindow* window_; @@ -131,7 +132,6 @@ class WebApplication : public WebView::EventListener { int security_model_version_; std::string csp_rule_; std::string csp_report_rule_; - bool lang_changed_mode_; }; } // namespace runtime diff --git a/runtime/browser/web_view.cc b/runtime/browser/web_view.cc index 1d898a1..c96a28f 100644 --- a/runtime/browser/web_view.cc +++ b/runtime/browser/web_view.cc @@ -89,6 +89,10 @@ void WebView::SetDefaultEncoding(const std::string& encoding) { impl_->SetDefaultEncoding(encoding); } +void WebView::SetLongPolling(unsigned long longpolling) { + impl_->SetLongPolling(longpolling); +} + #ifdef PROFILE_WEARABLE void WebView::SetBGColor(int r, int g, int b, int a) { impl_->SetBGColor(r, g, b, a); diff --git a/runtime/browser/web_view.h b/runtime/browser/web_view.h index be1bcc6..29a6fad 100644 --- a/runtime/browser/web_view.h +++ b/runtime/browser/web_view.h @@ -129,6 +129,7 @@ class WebView { bool SetUserAgent(const std::string& user_agent); void SetCSPRule(const std::string& rule, bool report_only); void SetDefaultEncoding(const std::string& encoding); + void SetLongPolling(unsigned long longpolling); #ifdef PROFILE_WEARABLE void SetBGColor(int r, int g, int b, int a); #endif diff --git a/runtime/browser/web_view_impl.cc b/runtime/browser/web_view_impl.cc index 6ad4c2a..9a4e38f 100644 --- a/runtime/browser/web_view_impl.cc +++ b/runtime/browser/web_view_impl.cc @@ -1008,6 +1008,10 @@ void WebViewImpl::SetDefaultEncoding(const std::string& encoding) { } } +void WebViewImpl::SetLongPolling(unsigned long longpolling) { + ewk_view_session_timeout_set(ewk_view_, longpolling); +} + #ifdef PROFILE_WEARABLE void WebViewImpl::SetBGColor(int r, int g, int b, int a) { ewk_view_bg_color_set(ewk_view_, r, g, b, a); diff --git a/runtime/browser/web_view_impl.h b/runtime/browser/web_view_impl.h index 73c70c1..eba7748 100644 --- a/runtime/browser/web_view_impl.h +++ b/runtime/browser/web_view_impl.h @@ -49,6 +49,7 @@ class WebViewImpl { bool SetUserAgent(const std::string& user_agent); void SetCSPRule(const std::string& rule, bool report_only); void SetDefaultEncoding(const std::string& encoding); + void SetLongPolling(unsigned long longpolling); #ifdef PROFILE_WEARABLE void SetBGColor(int r, int g, int b, int a); #endif -- 2.7.4