From: leerang song Date: Mon, 21 Jan 2013 04:04:19 +0000 (+0900) Subject: Make popup message when EwkView is NULL X-Git-Tag: 2.1b_release~22^2~88 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f9e351d4d42bf17f3b9cc98669d57e55abdfe850;p=platform%2Fframework%2Fweb%2Fwrt.git Make popup message when EwkView is NULL [Issue#] N/A [Bug] N/A [Cause] N/A [Solution] Make popup message when create EwkView [verification] N/A Change-Id: I9f5fcab8dbb2450ef52a3348c743e10e4c8d8aaf --- diff --git a/src/api_new/i_runnable_widget_object.h b/src/api_new/i_runnable_widget_object.h index 73bdbd1..a032f26 100644 --- a/src/api_new/i_runnable_widget_object.h +++ b/src/api_new/i_runnable_widget_object.h @@ -120,7 +120,7 @@ public: * @param window * @param callbacks passed to viewLogic */ - virtual void PrepareView(const std::string &startUrl, + virtual bool PrepareView(const std::string &startUrl, Evas_Object *window) = 0; /** * Shows widget asynchronously. Callback will be called when diff --git a/src/api_new/runnable_widget_object.cpp b/src/api_new/runnable_widget_object.cpp index e1b7957..029a0fe 100644 --- a/src/api_new/runnable_widget_object.cpp +++ b/src/api_new/runnable_widget_object.cpp @@ -107,19 +107,23 @@ bool RunnableWidgetObject::CheckBeforeLaunch() } } -void RunnableWidgetObject::PrepareView(const std::string &startUrl, +bool RunnableWidgetObject::PrepareView(const std::string &startUrl, Evas_Object *window) { State::StateChange change = m_guardstate->allowPrepareView(); Assert(window); ADD_PROFILING_POINT("view_logic_init", "start"); - m_view->createWebView(m_ewkContext, window); + if(!m_view->createWebView(m_ewkContext, window)) + { + return false; + } m_view->initialize(); m_view->prepareView(m_widgetModel.get(), startUrl); ADD_PROFILING_POINT("view_logic_init", "stop"); change.commit(); + return true; } void RunnableWidgetObject::Show() diff --git a/src/api_new/runnable_widget_object.h b/src/api_new/runnable_widget_object.h index dd0f85e..281781c 100644 --- a/src/api_new/runnable_widget_object.h +++ b/src/api_new/runnable_widget_object.h @@ -48,7 +48,7 @@ public: virtual ~RunnableWidgetObject(); bool CheckBeforeLaunch(); - void PrepareView(const std::string &startUrl, + bool PrepareView(const std::string &startUrl, Evas_Object *window); void Show(); //asynchronous function void Hide(); diff --git a/src/view/i_view_module.h b/src/view/i_view_module.h old mode 100644 new mode 100755 index a59dcbc..e24da45 --- a/src/view/i_view_module.h +++ b/src/view/i_view_module.h @@ -38,7 +38,7 @@ namespace ViewModule { class IViewModule { public: - virtual void createWebView(Ewk_Context* context, + virtual bool createWebView(Ewk_Context* context, Evas_Object* window) = 0; virtual void destroyWebView() = 0; virtual void initialize() = 0; diff --git a/src/view/webkit/view_logic.cpp b/src/view/webkit/view_logic.cpp old mode 100644 new mode 100755 index 3eacf27..3e27ac8 --- a/src/view/webkit/view_logic.cpp +++ b/src/view/webkit/view_logic.cpp @@ -166,7 +166,7 @@ ViewLogic::~ViewLogic () detachFromCustomHandlersDao(); } -void ViewLogic::createWebView(Ewk_Context* context, +bool ViewLogic::createWebView(Ewk_Context* context, Evas_Object* window) { LogDebug(""); @@ -174,7 +174,11 @@ void ViewLogic::createWebView(Ewk_Context* context, Assert(NULL != m_ewkContext); Assert(window); m_window = window; - createEwkView(evas_object_evas_get(m_window)); + if(!createEwkView(evas_object_evas_get(m_window))) + { + return false; + } + return true; } void ViewLogic::destroyWebView() @@ -558,7 +562,7 @@ void ViewLogic::ewkClientDeinit(Evas_Object *wkView) { } } -void ViewLogic::createEwkView(Evas* canvas) +bool ViewLogic::createEwkView(Evas* canvas) { LogDebug("createEwkVeiw"); Assert(canvas); @@ -569,8 +573,10 @@ void ViewLogic::createEwkView(Evas* canvas) ADD_PROFILING_POINT("ewk_view_add_with_context", "stop"); if (!newEwkView) { - LogError("WKView creation failed"); - Assert(false); + LogError("View creation failed"); + Wrt::Popup::PopupInvoker().showInfo( + "Info", "View creation failed","close"); + return false; } // set cookie policy @@ -585,6 +591,7 @@ void ViewLogic::createEwkView(Evas* canvas) LogInfo("push webview: " << newEwkView); m_ewkViewList.push_back(newEwkView); m_currentEwkView = newEwkView; + return true; } void ViewLogic::setStartPage() diff --git a/src/view/webkit/view_logic.h b/src/view/webkit/view_logic.h old mode 100644 new mode 100755 index f90a182..4b1229b --- a/src/view/webkit/view_logic.h +++ b/src/view/webkit/view_logic.h @@ -47,7 +47,7 @@ class ViewLogic : public ViewModule::IViewModule ViewLogic(); virtual ~ViewLogic(); - void createWebView(Ewk_Context* context, + bool createWebView(Ewk_Context* context, Evas_Object* window); void destroyWebView(); void initialize(); @@ -76,7 +76,7 @@ class ViewLogic : public ViewModule::IViewModule // EwkView operations void ewkClientInit(Evas_Object *wkView); void ewkClientDeinit(Evas_Object *wkView); - void createEwkView(Evas* canvas); + bool createEwkView(Evas* canvas); void setStartPage(); void prepareEwkView(Evas_Object *wkView); void removeEwkView(Evas_Object *wkView); diff --git a/src/wrt-client/wrt-client.cpp b/src/wrt-client/wrt-client.cpp old mode 100644 new mode 100755 index 4f4e823..d3af09a --- a/src/wrt-client/wrt-client.cpp +++ b/src/wrt-client/wrt-client.cpp @@ -494,8 +494,13 @@ void WrtClient::launchStep() } ADD_PROFILING_POINT("Create splash screen", "stop"); DPL::OptionalString startUrl = W3CFileLocalization::getStartFile(m_dao); - m_widget->PrepareView(DPL::ToUTF8String(*startUrl), - m_windowData->m_win); + if (!m_widget->PrepareView(DPL::ToUTF8String(*startUrl), + m_windowData->m_win)) + { + DPL::Event::ControllerEventHandler::PostEvent( + NextStepEvent()); + return; + } //you can't show window with splash screen before PrepareView //ewk_view_add_with_context() in viewLogic breaks window @@ -627,14 +632,19 @@ void WrtClient::unsetLayout(Evas_Object* currentBuffer) { void WrtClient::shutdownStep() { LogDebug("Closing Wrt connection ..."); - if (m_initialized && m_widget) { + + if (m_widget && m_widgetState) + { m_widgetState = WidgetState_Stopped; m_widget->Hide(); m_widget.reset(); - m_windowData.reset(); WRT::CoreModuleSingleton::Instance().Terminate(); + } + if (m_initialized) + { m_initialized = false; } + m_windowData.reset(); Quit(); } diff --git a/src/wrt-client/wrt-client.h b/src/wrt-client/wrt-client.h old mode 100644 new mode 100755