From: Youngsoo Choi Date: Mon, 2 Jan 2017 13:33:48 +0000 (+0900) Subject: Refactor ClosePageFromOnTerminate X-Git-Tag: accepted/tizen/3.0.m2/mobile/20170105.023704~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a554a6ba46892023faf3a4aef4cc6bb9a7ae9fa6;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Refactor ClosePageFromOnTerminate The view stack needs to be handled in class WebApplication. Bug: http://suprem.sec.samsung.net/jira/browse/TWF-2743 Change-Id: Ide43a3d254da9d1746b5235a97ed401aa24ea7b8 Signed-off-by: Youngsoo Choi --- diff --git a/runtime/browser/runtime.cc b/runtime/browser/runtime.cc index a2e0c03..bba1168 100644 --- a/runtime/browser/runtime.cc +++ b/runtime/browser/runtime.cc @@ -58,17 +58,8 @@ std::unique_ptr Runtime::MakeRuntime( } void Runtime::ClosePageFromOnTerminate(WebApplication* app) { - if (app) { - std::list vstack = app->view_stack(); - auto it = vstack.begin(); - if (it != vstack.end()) { - Runtime::is_on_terminate_called = true; - for (; it != vstack.end(); ++it) { - vstack.front()->SetVisibility(false); - ewk_view_page_close((*it)->evas_object()); - } - } - } + if (app) + app->ClosePageFromOnTerminate(); } } // namespace runtime diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index f5f16ba..753711a 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -655,6 +655,17 @@ void WebApplication::Terminate() { extension_server->Shutdown(); } +void WebApplication::ClosePageFromOnTerminate() { + auto it = view_stack_.begin(); + if (it != view_stack_.end()) { + runtime::Runtime::is_on_terminate_called = true; + for (; it != view_stack_.end(); ++it) { + view_stack_.front()->SetVisibility(false); + ewk_view_page_close((*it)->evas_object()); + } + } +} + void WebApplication::OnCreatedNewWebView(WebView* /*view*/, WebView* new_view) { if (view_stack_.size() > 0 && view_stack_.front() != NULL) view_stack_.front()->SetVisibility(false); diff --git a/runtime/browser/web_application.h b/runtime/browser/web_application.h index f219a37..1c31d21 100755 --- a/runtime/browser/web_application.h +++ b/runtime/browser/web_application.h @@ -52,6 +52,7 @@ class WebApplication : public WebView::EventListener { void Suspend(); void Terminate(); + void ClosePageFromOnTerminate(); std::string data_path() const { return app_data_path_; } void set_terminator(std::function terminator) { terminator_ = terminator;