Make popup message when EwkView is NULL
authorleerang song <leerang.song@samsung.com>
Mon, 21 Jan 2013 04:04:19 +0000 (13:04 +0900)
committerleerang song <leerang.song@samsung.com>
Wed, 23 Jan 2013 08:52:54 +0000 (17:52 +0900)
[Issue#] N/A
[Bug] N/A
[Cause] N/A
[Solution] Make popup message when create EwkView
[verification] N/A

Change-Id: I9f5fcab8dbb2450ef52a3348c743e10e4c8d8aaf

src/api_new/i_runnable_widget_object.h
src/api_new/runnable_widget_object.cpp
src/api_new/runnable_widget_object.h
src/view/i_view_module.h [changed mode: 0644->0755]
src/view/webkit/view_logic.cpp [changed mode: 0644->0755]
src/view/webkit/view_logic.h [changed mode: 0644->0755]
src/wrt-client/wrt-client.cpp [changed mode: 0644->0755]
src/wrt-client/wrt-client.h [changed mode: 0644->0755]

index 73bdbd1..a032f26 100644 (file)
@@ -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
index e1b7957..029a0fe 100644 (file)
@@ -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()
index dd0f85e..281781c 100644 (file)
@@ -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();
old mode 100644 (file)
new mode 100755 (executable)
index a59dcbc..e24da45
@@ -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;
old mode 100644 (file)
new mode 100755 (executable)
index 3eacf27..3e27ac8
@@ -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()
old mode 100644 (file)
new mode 100755 (executable)
index f90a182..4b1229b
@@ -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);
old mode 100644 (file)
new mode 100755 (executable)
index 4f4e823..d3af09a
@@ -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<NextStepEvent>::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();
 }
 
old mode 100644 (file)
new mode 100755 (executable)