[Release] wrt_0.8.274
[platform/framework/web/wrt.git] / src / api_new / core_module.cpp
index 62030b2..d5c07de 100644 (file)
 #include <dpl/assert.h>
 #include <dpl/exception.h>
 #include <dpl/singleton_impl.h>
+#include <dpl/optional_typedefs.h>
 #include "localization_setting.h"
 #include <dpl/wrt-dao-ro/global_config.h>
 #include <profiling_util.h>
 #include <widget_deserialize_model.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <dpl/wrt-dao-ro/global_dao_read_only.h>
-#include "webkit/bundles/plugin_module_support.h"
-
-#include <EWebKit2.h>
 
 IMPLEMENT_SINGLETON(WRT::CoreModule)
 
-namespace { //Anonymous
-const char * const bundlePath = "/usr/lib/wrt-wk2-bundles/libwrt-wk2-bundle.so";
+namespace {
+const char* const TEXT_DOMAIN = "wrt";
+const char* const TEXT_LOCALE_PATH = "/usr/share/wrt-engine/locale";
 
 std::string cutOffFileName(const std::string& path)
 {
@@ -71,20 +70,8 @@ bool checkPaths()
 
     bool if_ok = true;
     if_ok &= (isDir(cutOffFileName(GetWrtDatabaseFilePath())));
-    if (!if_ok) {
-        LogError("Path <" << GetWrtDatabaseFilePath() << "> does not exist.");
-    }
-
     if_ok &= (isDir(GetDevicePluginPath()));
-    if (!if_ok) {
-        LogError("Path <" << GetDevicePluginPath() << "> does not exist.");
-    }
-
     if_ok &= (isDir(GetUserInstalledWidgetPath()));
-    if (!if_ok) {
-        LogError("Path <" << GetUserInstalledWidgetPath() <<
-                 "> does not exist.");
-    }
     return if_ok;
 }
 } // namespace anonymous
@@ -94,7 +81,7 @@ class CoreModuleImpl
 {
   public:
 
-    CoreModuleImpl() : m_initialized(false), m_ewkContext(NULL)
+    CoreModuleImpl() : m_initialized(false)
     {
         LogDebug("enter");
     }
@@ -116,38 +103,9 @@ class CoreModuleImpl
             }
             Try
             {
-                if (!m_ewkContext) {
-                    // Needed settings for WKContext are located here
-                    // create Ewk_Context
-                    Ewk_Context* newEwkContext =
-                        ewk_context_new_with_injected_bundle_path(bundlePath);
-                    if (!newEwkContext) {
-                        LogError("Failed to create Ewk_Context");
-                        ThrowMsg(DPL::Exception, "Failed to create ewk context");
-                    }
-
-                    m_ewkContext = newEwkContext;
-                }
-
-                // cache model setting
-                ewk_context_cache_model_set(m_ewkContext,
-                                            EWK_CACHE_MODEL_DOCUMENT_BROWSER);
-                ADD_PROFILING_POINT("WebProcess fork", "start");
-
-                // To fork a Webprocess as soon as possible,
-                // the following ewk_api is called explicitly.
-                Ewk_Cookie_Manager *ewkCookieManager;
-                ewkCookieManager =
-                    ewk_context_cookie_manager_get(m_ewkContext);
-                ewk_cookie_manager_accept_policy_set(
-                    ewkCookieManager,
-                    EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
-                ADD_PROFILING_POINT("WebProcess fork", "stop");
-
                 ADD_PROFILING_POINT("attach databases", "start");
                 MainThreadSingleton::Instance().AttachDatabases();
                 ADD_PROFILING_POINT("attach databases", "stop");
-
                 LogDebug("Initialize finished");
             } catch (const DPL::Exception& ex) {
                 LogError("Internal Error during screen preparation:");
@@ -158,42 +116,27 @@ class CoreModuleImpl
                  */
                 return false;
             }
+            bindtextdomain(TEXT_DOMAIN, TEXT_LOCALE_PATH);
             m_initialized = true;
         }
         return true;
     }
 
-    bool Init(Ewk_Context* ewk_context)
-    {
-        if (ewk_context) {
-            m_ewkContext = ewk_context;
-        }
-
-        return Init();
-    }
-
     void Terminate()
     {
-        if (m_ewkContext) {
-            LogInfo("finalizeEwkContext called");
-            ewk_context_delete(m_ewkContext);
-            m_ewkContext = 0;
-        }
         MainThreadSingleton::Instance().DetachDatabases();
-
         m_initialized = false;
     }
 
     RunnableWidgetObjectPtr getRunnableWidgetObject(
         const std::string& tizenId)
     {
-        PluginModuleSupport::init(m_ewkContext, tizenId);
-
         try {
             RunnableWidgetObjectPtr runnable;
-            WidgetModelPtr model = Domain::deserializeWidgetModel(tizenId);
+            WidgetModelPtr model =
+                Domain::deserializeWidgetModel(tizenId);
             if (!!model) {
-                runnable.reset(new RunnableWidgetObject(model, m_ewkContext));
+                runnable.reset(new RunnableWidgetObject(model));
             }
             return runnable;
         } catch (WrtDB::WidgetDAOReadOnly::Exception::WidgetNotExist) {
@@ -234,14 +177,8 @@ class CoreModuleImpl
         return CoreModule::ALWAYS_ASK;
     }
 
-    bool developerMode()
-    {
-        return WrtDB::GlobalDAOReadOnly::GetDeveloperMode();
-    }
-
   private:
     bool m_initialized;
-    Ewk_Context* m_ewkContext;
 };
 
 CoreModule::CoreModule() : m_impl(new CoreModuleImpl())
@@ -255,11 +192,6 @@ bool CoreModule::Init()
     return m_impl->Init();
 }
 
-bool CoreModule::Init(Ewk_Context* ewk_context)
-{
-    return m_impl->Init(ewk_context);
-}
-
 void CoreModule::Terminate()
 {
     return m_impl->Terminate();
@@ -281,8 +213,4 @@ CoreModule::NetworkAccessMode CoreModule::roamingNetworkAccess()
     return m_impl->roamingNetworkAccess();
 }
 
-bool CoreModule::developerMode()
-{
-    return m_impl->developerMode();
-}
 } /* namespace WRT */