Merge "fix: use EINA_* booleans instread of TRUE/FALSE" into tizen
[platform/framework/web/wrt.git] / src / view / webkit / view_logic.cpp
index 96d7569..8957136 100644 (file)
 #include <dpl/foreach.h>
 
 #include <Elementary.h>
+#include <efl_assist.h>
 #include <pcrecpp.h>
-#include <vconf.h>
 #include <sysman.h>
 #include <widget_model.h>
+#include <dpl/log/secure_log.h>
+#include <system_settings.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-#include <dpl/wrt-dao-ro/vconf_config.h>
 #include <dpl/utils/wrt_global_settings.h>
 
-#include <common/application_data.h>
+#include <application_data.h>
 #include <common/application_launcher.h>
+#include <common/message_support.h>
 #include <common/scheme.h>
 
 #include <common/view_logic_apps_support.h>
 #include <common/view_logic_certificate_support.h>
 #include <common/view_logic_storage_support.h>
 #include <common/view_logic_uri_support.h>
-#include <common/view_logic_user_agent_support.h>
 #include <common/view_logic_vibration_support.h>
 #include <view_logic_authentication_challenge_support.h>
-#include <view_logic_scheme_support.h>
+#include <view_logic_certificate_confirm_support.h>
 #include <view_logic_geolocation_support.h>
+#include <view_logic_message_support.h>
+#include <view_logic_orientation_support.h>
+#include <view_logic_scheme_support.h>
 #include <view_logic_usermedia_support.h>
+#include <view_logic_web_notification_data.h>
 #include <view_logic_web_notification_support.h>
-
-#include <view_logic_certificate_confirm_support.h>
-#include "bundles/plugin_module_support.h"
-#include <popup-runner/PopupInvoker.h>
+#include <view_logic_web_notification_permission_support.h>
+#include <view_logic_web_storage_support.h>
 
 #include <EWebKit2.h>
 #include <dpl/localization/w3c_file_localization.h>
 #include <js_overlay_types.h>
+#include <dispatch_event_support.h>
 #include <i_runnable_widget_object.h>
 #include <profiling_util.h>
 #include <wrt-commons/custom-handler-dao-ro/CustomHandlerDatabase.h>
 #include <wrt-commons/custom-handler-dao-rw/custom_handler_dao.h>
 #include <popup-runner/PopupInvoker.h>
-
-#include <appsvc/appsvc.h>
-
-#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
-#include "view_logic_service_support.h"
-
-extern "C" int appsvc_allow_transient_app(bundle *b, Ecore_X_Window id);
-extern "C" int appsvc_request_transient_app(bundle *b, Ecore_X_Window callee_id, appsvc_host_res_fn cbfunc, void *data);
-#endif
+#include <plugins-ipc-message/ipc_message_support.h>
+#include <appsvc.h>
 
 namespace {
-const char * const uriBlockedMessageName = "uri_blocked_msg";
-const char * const uriChangedMessageName = "uri_changed_msg";
-#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
-const char * const webProcessPidMessageName = "web_process_pid_msg";
-#endif
-const char * const URICHANGE_PLUGIN_STOP_ONLY = "plugin_stop_only";
-const char * const URICHANGE_PLUGIN_RESTART = "plugin_restart";
-const char * const URICHANGE_PLUGIN_NO_CHANGE = "plugin_no_change";
-const char* PATTERN_URI_CHANGE = "^(([^:/\\?#]+)://[^\\?#]*)";
-
 // IME State value
 const char * const IME_STATE_ON = "on";
 const char * const IME_STATE_OFF = "off";
@@ -102,21 +89,21 @@ const char CONTENT_HANDLER_ASK_MSG[] = "Add content?";
 const char CONTENT_HANDLER_ASK_TITLE[] = "Add content";
 const char CONTENT_HANDLER_AKS_REMEMBER[] = "Remember dicision";
 
-const int WIN_ORIENTATION_PORTRAIT_PRIMARY_ANGLE = 0;
-const int WIN_ORIENTATION_PORTRAIT_SECONDARY_ANGLE = 180;
-const int WIN_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE = 270;
-const int WIN_ORIENTATION_LANDSCAPE_SECONDARY_ANGLE = 90;
-const int W3C_ORIENTATION_PORTRAIT_PRIMARY_ANGLE = 0;
-const int W3C_ORIENTATION_PORTRAIT_SECONDARY_ANGLE = 180;
-const int W3C_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE = 90;
-const int W3C_ORIENTATION_LANDSCAPE_SECONDARY_ANGLE = -90;
+const char* const DEFAULT_ENCODING = "UTF-8";
+#ifdef CSP_ENABLED
+const char* const DEFAULT_CSP_POLICY =
+    "default-src *; script-src 'self'; style-src 'self'; object-src 'none';";
+#endif
+// SCHEME
+const char * const SCHEME_BOX_SLASH = "box://";
+const double ORIENTATION_THRESHOLD = 0.5;
 } // anonymous namespace
 
 std::map<const std::string,
          const Evas_Smart_Cb> ViewLogic::m_ewkCallbacksMap = {
     { "load,started", &ViewLogic::loadStartedCallback },
     { "load,finished", &ViewLogic::loadFinishedCallback },
-    { "title,changed", &ViewLogic::titleChangedCallback },
+    { "load,progress,started", &ViewLogic::loadProgressStartedCallback },
     { "load,progress", &ViewLogic::loadProgressCallback },
     { "load,progress,finished", &ViewLogic::loadProgressFinishedCallback },
     { "process,crashed", &ViewLogic::processCrashedCallback },
@@ -137,7 +124,6 @@ std::map<const std::string,
     { "notification,cancel", &ViewLogic::notificationCancelCallback },
     { "notification,permission,request",
       &ViewLogic::notificationPermissionRequestCallback },
-
     { "fullscreen,enterfullscreen", &ViewLogic::enterFullscreenCallback },
     { "fullscreen,exitfullscreen", &ViewLogic::exitFullscreenCallback },
     // IME Callback
@@ -175,7 +161,17 @@ std::map<const std::string,
     { "authentication,challenge",
       &ViewLogic::authenticationChallengeRequestCallback },
     { "frame,rendered",
-      &ViewLogic::viewFrameRenderedCallback }
+      &ViewLogic::viewFrameRenderedCallback },
+    { "mediacontrol,rotate,horizontal",
+      &ViewLogic::mediacontrolRotateHorizontal },
+    { "mediacontrol,rotate,vertical",
+      &ViewLogic::mediacontrolRotateVertical },
+    { "mediacontrol,rotate,exit",
+      &ViewLogic::mediacontrolRotateExit },
+    { "popup,reply,wait,start",
+      &ViewLogic::popupReplyWaitStart },
+    { "popup,reply,wait,finish",
+      &ViewLogic::popupReplyWaitFinish },
 };
 
 ViewLogic::ViewLogic() :
@@ -190,8 +186,15 @@ ViewLogic::ViewLogic() :
     m_imeHeight(0),
     m_isBackgroundReload(false),
     m_isBackgroundSupport(false),
+    m_rotateAngle(0),
+    m_deferredRotateAngle(
+        ViewModule::OrientationSupport::DEFERRED_ORIENTATION_EMPTY),
+    m_orientationThresholdTimer(NULL),
+    m_isPopupReplyWait(false),
+    m_isFullscreenByPlatform(false),
     m_appsSupport(new ViewModule::AppsSupport()),
-    m_vibrationSupport(new ViewModule::VibrationSupport())
+    m_vibrationSupport(new ViewModule::VibrationSupport()),
+    m_webNotificationSupport(new ViewModule::WebNotificationSupport())
 {
     ApplicationLauncherSingleton::Instance().Touch();
 }
@@ -213,7 +216,7 @@ bool ViewLogic::createWebView(Ewk_Context* context,
     const char *theme = elm_theme_get(NULL);
     if (theme) {
         m_theme = theme;
-        LogInfo("theme is " << m_theme);
+        LogDebug("theme is " << m_theme);
     }
 
     // set members
@@ -221,20 +224,13 @@ bool ViewLogic::createWebView(Ewk_Context* context,
     m_window = window;
 
     Evas* canvas = evas_object_evas_get(m_window);
-    return createEwkView(canvas);
-}
 
-#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
-int ViewLogic::appServiceCallerIsKilled(void *data)
-{
-    Assert(data);
-    ViewLogic *This = static_cast<ViewLogic *>(data);
-    if (!This->m_cbs->webkitExit.empty()) {
-        This->m_cbs->webkitExit();
+    if (!createEwkView(canvas)) {
+        return false;
     }
-    return 0;
+
+    return true;
 }
-#endif
 
 void ViewLogic::prepareView(WidgetModel* m, const std::string &startUrl)
 {
@@ -246,55 +242,31 @@ void ViewLogic::prepareView(WidgetModel* m, const std::string &startUrl)
     Assert(NULL != m_ewkContext);
     Assert(m_window);
 
-#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
-    if (ServiceSupport::isService(m_model))
-    {
-        bundle *b = ApplicationDataSingleton::Instance().getBundle();
-        if (ServiceSupport::Disposition::INLINE == ServiceSupport::disposition(m_model))
-        {
-            LogDebug("Set up INLINE disposition");
-            int pid = ServiceSupport::callerPID(b);
-            if (pid) {
-                unsigned windowId = ServiceSupport::xWindowByPid(pid);
-                appsvc_allow_transient_app(b, windowId);
-                appsvc_request_transient_app(b, elm_win_xwindow_get(m_window), appServiceCallerIsKilled, this);
-            }
-        }
-        else
-        {
-            LogDebug("Set up WINDOW disposition");
-        }
-    }
-    else
-    {
-        LogDebug("Starting regular widget");
-    }
-#endif
-
     ADD_PROFILING_POINT("initializeSupport", "start");
     initializeSupport();
     ADD_PROFILING_POINT("initializeSupport", "stop");
-    setStartPage();
     ewkClientInit(m_currentEwkView);
     ADD_PROFILING_POINT("prepareEwkView", "start");
     prepareEwkView(m_currentEwkView);
     ADD_PROFILING_POINT("prepareEwkView", "stop");
     initializePluginLoading();
+    initializeXwindowHandle();
 }
 
 void ViewLogic::showWidget()
 {
     LogDebug("showing widget");
     Assert(NULL != m_currentEwkView && "ewk_view not created at this point");
-    if (m_currentUri.empty()) {
+    std::string url =
+        ViewModule::UriSupport::getUri(m_model, m_startUrl);
+    if (url.empty()) {
         LogError("Localized current URI doesn't exist");
         return;
     }
-
-    LogInfo("m_currentUri: " << m_currentUri);
+    LogDebug("url : " << url);
 
     // load page
-    ewk_view_url_set(m_currentEwkView, m_currentUri.c_str());
+    ewk_view_url_set(m_currentEwkView, url.c_str());
 
     if (!m_cbs->bufferSet.empty()) {
         m_cbs->bufferSet(m_currentEwkView);
@@ -306,11 +278,12 @@ void ViewLogic::hideWidget()
     LogDebug("hiding widget");
     ViewModule::StorageSupport::deinitializeStorage(m_model);
     m_appsSupport->deinitialize();
-
     m_vibrationSupport->deinitialize();
+    m_webNotificationSupport->deinitialize();
+    system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE);
 
     while (!m_ewkViewList.empty()) {
-        LogInfo("pop webview: " << m_ewkViewList.back());
+        LogDebug("pop webview: " << m_ewkViewList.back());
         removeEwkView(m_ewkViewList.back());
     }
     m_ewkViewList.clear();
@@ -318,20 +291,25 @@ void ViewLogic::hideWidget()
 
 void ViewLogic::suspendWidget()
 {
-    LogInfo("Pausing widget");
+    LogDebug("Pausing widget");
     Assert(m_model);
 
     if (!m_currentEwkView) {
         LogWarning("Cannot suspend widget without view");
     } else {
         setEwkViewInvisible(m_currentEwkView);
+
         if (!m_isBackgroundSupport) {
+            FOREACH(it, m_ewkViewList) {
+                if (*it != m_currentEwkView) {
+                    suspendWebkit(*it);
+                }
+            }
+
             suspendWebkit(m_currentEwkView);
         }
     }
 
-    evas_object_focus_set(m_currentEwkView, EINA_FALSE);
-
     // call user callback
     if (!m_cbs->suspend.empty()) {
         m_cbs->suspend(true);
@@ -340,12 +318,20 @@ void ViewLogic::suspendWidget()
 
 void ViewLogic::resumeWidget()
 {
-    LogInfo("Resume widget");
+    LogDebug("Resume widget");
     Assert(m_model);
 
-    if (m_currentEwkView) {
+    if (m_currentEwkView)
+    {
         setEwkViewVisible(m_currentEwkView);
+
         if (!m_isBackgroundSupport) {
+            FOREACH(it, m_ewkViewList) {
+                if (*it != m_currentEwkView) {
+                    resumeWebkit(*it);
+                }
+            }
+
             resumeWebkit(m_currentEwkView);
         }
     }
@@ -356,7 +342,6 @@ void ViewLogic::resumeWidget()
      *  elm_win_raise(m_window);
      * }
      */
-    evas_object_focus_set(m_currentEwkView, EINA_TRUE);
 
     // call user callback
     if (!m_cbs->resume.empty()) {
@@ -366,42 +351,56 @@ void ViewLogic::resumeWidget()
 
 void ViewLogic::resetWidget()
 {
-    LogInfo("Resetting Widget");
-
-    // destory all webview
-    while (!m_ewkViewList.empty()) {
-        LogInfo("pop webview: " << m_ewkViewList.back());
-        removeEwkView(m_ewkViewList.back());
-    }
-    m_ewkViewList.clear();
-
-    // create new webview
-    createEwkView(evas_object_evas_get(m_window));
-    setStartPage();
-    ewkClientInit(m_currentEwkView);
-    prepareEwkView(m_currentEwkView);
-
-    // check if current url is service url for this tizen service
-    std::string requestedUri =
-        ViewModule::UriSupport::getUri(m_model, m_startUrl);
-    DPL::OptionalString servicedUri = ViewModule::UriSupport::localizeURI(
-            DPL::FromUTF8String(requestedUri.c_str()),
-            m_model);
-
-    initializePluginLoading();
+    LogDebug("Resetting Widget");
 
-    // webview activated
-    m_currentUri = DPL::ToUTF8String(*servicedUri);
-    ewk_view_url_set(m_currentEwkView, m_currentUri.c_str());
-    elm_win_activate(m_window);
-    evas_object_focus_set(m_currentEwkView, EINA_TRUE);
+    // handling case of WebProcess is locked
+    if (m_isPopupReplyWait) {
+        // resume web application
+        LogDebug("WebProcess is locked");
+        if (m_currentEwkView) {
+            setEwkViewVisible(m_currentEwkView);
+            if (!m_isBackgroundSupport) {
+                resumeWebkit(m_currentEwkView);
+            }
+        }
+        // webview activated
+        elm_win_activate(m_window);
 
-    // call user callback
-    if (!m_cbs->reset.empty()) {
-        m_cbs->reset(true);
-    }
-    if (!m_cbs->bufferSet.empty()) {
-        m_cbs->bufferSet(m_currentEwkView);
+        // call user callback
+        if (!m_cbs->reset.empty()) {
+            m_cbs->reset(false);
+        }
+    } else {
+        // reset web application
+        // destory all webview
+        while (!m_ewkViewList.empty()) {
+            LogDebug("pop webview: " << m_ewkViewList.back());
+            removeEwkView(m_ewkViewList.back());
+        }
+        m_ewkViewList.clear();
+        m_currentEwkView = NULL;
+
+        // create new webview
+        createEwkView(evas_object_evas_get(m_window));
+        ewkClientInit(m_currentEwkView);
+        prepareEwkView(m_currentEwkView);
+
+        // check if current url is service url for this tizen service
+        std::string url =
+            ViewModule::UriSupport::getUri(m_model, m_startUrl);
+
+        initializePluginLoading();
+        // webview activated
+        ewk_view_url_set(m_currentEwkView, url.c_str());
+        elm_win_activate(m_window);
+
+        // call user callback
+        if (!m_cbs->reset.empty()) {
+            m_cbs->reset(true);
+        }
+        if (!m_cbs->bufferSet.empty()) {
+            m_cbs->bufferSet(m_currentEwkView);
+        }
     }
 }
 
@@ -412,11 +411,11 @@ void ViewLogic::backward()
     } else {
         if (1 >= m_ewkViewList.size()) {
             // If there is no previous page, widget move to backgroud.
-            LogInfo("Widget move to backgroud");
+            LogDebug("Widget move to backgroud");
             elm_win_lower(m_window);
         } else {
             // Back to previous webview
-            LogInfo("Widget move to previous webview");
+            LogDebug("Widget move to previous webview");
             m_closedEwkView = m_currentEwkView;
             ecore_idler_add(windowCloseIdlerCallback, this);
         }
@@ -425,7 +424,7 @@ void ViewLogic::backward()
 
 void ViewLogic::reloadStartPage()
 {
-    LogInfo("Reload Start Page");
+    LogDebug("Reload Start Page");
     // prevent fail to load plugin bundle side
     m_isBackgroundReload = true;
 
@@ -442,29 +441,29 @@ void ViewLogic::reloadStartPage()
     createEwkView(evas_object_evas_get(m_window));
     ewkClientInit(m_currentEwkView);
 
-    setStartPage();
     prepareEwkView(m_currentEwkView);
     initializePluginLoading();
 
     // load page
-    ewk_view_url_set(m_currentEwkView, m_currentUri.c_str());
+    std::string url = ViewModule::UriSupport::getUri(m_model, m_startUrl);
+    ewk_view_url_set(m_currentEwkView, url.c_str());
 
     // show ewkView
     if (!m_cbs->bufferSet.empty()) {
         m_cbs->bufferSet(m_currentEwkView);
     }
-    LogInfo("Reloading Start Page is done!");
+    LogDebug("Reloading Start Page is done!");
 }
 
 Evas_Object* ViewLogic::getCurrentWebview()
 {
-    LogInfo("get current webview");
+    LogDebug("get current webview");
     return m_currentEwkView;
 }
 
 void ViewLogic::fireJavascriptEvent(int event, void* data)
 {
-    PluginModuleSupport::dispatchJavaScriptEvent(
+    ViewLogicMessageSupport::dispatchJavaScriptEvent(
         m_ewkContext,
         static_cast<WrtPlugins::W3C::CustomEventType>(event),
         data);
@@ -477,46 +476,103 @@ void ViewLogic::setUserCallbacks(const WRT::UserDelegatesPtr& cbs)
 
 void ViewLogic::checkSyncMessageFromBundle(
         const char* name,
-        const char* body,
+        const char* /*body*/,
         char** returnData)
 {
     LogDebug("didReceiveSynchronousMessage called");
     Assert(name);
-    Assert(returnData);
 
-    if (!body) {
-        LogDebug("body is empty");
-        *returnData = NULL;
-        return;
+    LogDebug("received : " << name);
+    if (!strcmp(name, Message::TizenScheme::GET_WINDOW_HANDLE)) {
+        if (m_window) {
+            Ecore_X_Window handle = elm_win_xwindow_get(m_window);
+            if (handle != 0) {
+                std::stringstream ss;
+                ss << handle;
+                std::string ret  = ss.str();
+                if (returnData) {
+                    *returnData = strdup(ret.c_str());
+                }
+            } else {
+                LogDebug("X window isn't exist");
+            }
+        }
     }
+}
 
-    LogDebug("received : " << name);
-    std::string result;
-    if (!strcmp(name, uriBlockedMessageName)) {
+void ViewLogic::checkAsyncMessageFromBundle(const char* name, const char* body)
+{
+    Assert(name);
+    _D("received : %s", name);
+
+    if (!strcmp(name, Message::ToUIProcess::BLOCKED_URL)) {
         // Currently WebProcess informs obly about blocked
         // URI - URI localization and security chekcs are
-        // done by WebProcess itself (see: wrt-wk2-bundle.cpp
+        // done by WebProcess itself (see: wrt-injected-bundle.cpp
         // and bundle_uri_handling.cpp)
-        result = requestUrlBlocked(std::string(body));
-    }
-    else if (!strcmp(name, uriChangedMessageName)) {
-        result = requestUrlChanged(std::string(body));
-    }
-#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
-    else if (!strcmp(name, webProcessPidMessageName)) {
-        std::stringstream ss(body);
-        unsigned int pid = 0;
-        ss >> pid;
-        ServiceSupport::setWebProcessPidWindowProperty(elm_win_xwindow_get(m_window), pid);
-    }
-#endif
+        requestUrlBlocked(std::string(body));
+    } else if (!strcmp(name, Message::TizenScheme::CLEAR_ALL_COOKIES)) {
+        Ewk_Cookie_Manager* cookieManager =
+            ewk_context_cookie_manager_get(m_ewkContext);
+        if (!cookieManager) {
+            _E("Fail to get cookieManager");
+            return;
+        }
+        ewk_cookie_manager_cookies_clear(cookieManager);
+    } else if (!strcmp(name, IPCMessageSupport::TIZEN_CHANGE_USERAGENT)) {
+        std::string msgBody = (body) ? (body) : "";
 
-    *returnData = strdup(result.c_str());
+        std::string strId = msgBody.substr(0, msgBody.find_first_of('_'));
+        std::string strBody = msgBody.substr(msgBody.find_first_of('_')+1);
+        _D("Id: %s , Body %s", strId.c_str(), strBody.c_str());
+
+        ewk_view_user_agent_set(m_currentEwkView, strBody.c_str());
+        _D("get UA: %s", ewk_view_user_agent_get(m_currentEwkView));
+
+        IPCMessageSupport::replyAsyncMessageToWebProcess(m_ewkContext,
+                                                         atoi(strId.c_str()),
+                                                         "success");
+        return;
+    } else if (!strcmp(name, IPCMessageSupport::TIZEN_DELETE_ALL_COOKIES)) {
+        std::string msgBody = (body) ? (body) : "";
+        std::string strId = msgBody.substr(0, msgBody.find_first_of('_'));
+        std::string strBody = msgBody.substr(msgBody.find_first_of('_')+1);
+
+        Ewk_Cookie_Manager* cookieManager =
+            ewk_context_cookie_manager_get(m_ewkContext);
+        if (!cookieManager) {
+            _E("Fail to get cookieManager");
+            IPCMessageSupport::replyAsyncMessageToWebProcess(
+                m_ewkContext,
+                atoi(strId.c_str()),
+                "error");
+            return;
+        }
+        ewk_cookie_manager_cookies_clear(cookieManager);
+        IPCMessageSupport::replyAsyncMessageToWebProcess(m_ewkContext,
+                                                         atoi(strId.c_str()),
+                                                         "success");
+        return;
+    } else if (!strcmp(name, IPCMessageSupport::TIZEN_EXIT) ||
+               !strcmp(name, IPCMessageSupport::TIZEN_HIDE))
+    {
+        bool ret =
+            ViewModule::SchemeSupport::HandleTizenScheme(name,
+                                                         m_window,
+                                                         m_currentEwkView);
+        if (ret == false) {
+            _E("Fail to handle tizen scheme %s", name);
+        }
+        // Not need to send reply
+        return;
+    } else {
+        _W("Not defined message");
+    }
 }
 
 void ViewLogic::downloadData(const char* url)
 {
-    LogInfo("enter");
+    LogDebug("enter");
     if (!url) {
         return;
     }
@@ -525,7 +581,7 @@ void ViewLogic::downloadData(const char* url)
 
 void ViewLogic::activateVibration(bool on, uint64_t time)
 {
-    LogInfo("enter");
+    LogDebug("enter");
     if (on) {
         m_vibrationSupport->startVibration(static_cast<long>(time));
     } else {
@@ -540,29 +596,40 @@ void ViewLogic::initializeSupport()
         == BackgroundSupport_Enable)
     {
         LogDebug("Background support enabled, set process active");
-        pid_t pid = getpid();
-        sysman_inform_active(pid);
+        sysman_inform_active(getpid());
         m_isBackgroundSupport = true;
     }
-    m_schemeSupport.reset(new SchemeSupport(m_model->Type.Get().appType));
+    system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE,
+                                   systemSettingsChangedCallback,
+                                   this);
+
     ViewModule::StorageSupport::initializeStorage(m_model);
-    m_appsSupport->initialize(m_model);
+    m_appsSupport->initialize(m_model, elm_win_xwindow_get(m_window));
     m_securityOriginSupport.reset(new ViewModule::SecurityOriginSupport(m_model));
     m_certificateSupport.reset(new ViewModule::CertificateSupport(m_model));
-
     m_vibrationSupport->initialize();
+    m_webNotificationSupport->initialize(m_model->TzPkgId.Get());
 }
 
 void ViewLogic::initializePluginLoading()
 {
     // inform wrt information for plugin loading to web process
-    PluginModuleSupport::start(
+    ViewLogicMessageSupport::start(
         m_ewkContext,
         m_model->TizenId,
         elm_config_scale_get(),
         ApplicationDataSingleton::Instance().getEncodedBundle(),
-        m_theme.c_str(),
-        m_model->SettingList.Get().isEncrypted());
+        m_theme.c_str());
+}
+
+void ViewLogic::initializeXwindowHandle()
+{
+    if (m_window) {
+        unsigned int handle = elm_win_xwindow_get(m_window);
+        ViewLogicMessageSupport::setXwindowHandle(
+            m_ewkContext,
+            handle);
+    }
 }
 
 void ViewLogic::ewkClientInit(Evas_Object *wkView)
@@ -582,6 +649,33 @@ void ViewLogic::ewkClientInit(Evas_Object *wkView)
         wkView,
         orientationLockCallback,
         this);
+    ewk_view_exceeded_database_quota_callback_set(
+        wkView,
+        exceededDatabaseQuotaCallback,
+        this);
+    ewk_view_exceeded_indexed_database_quota_callback_set(
+        wkView,
+        exceededIndexedDatabaseQuotaCallback,
+        this);
+    ewk_view_exceeded_local_file_system_quota_callback_set(
+        wkView,
+        exceededLocalFileSystemQuotaCallback,
+        this);
+    ea_object_event_callback_add(wkView,
+                                 EA_CALLBACK_BACK,
+                                 eaKeyCallback,
+                                 this);
+    ea_object_event_callback_add(wkView,
+                                 EA_CALLBACK_MORE,
+                                 eaKeyCallback,
+                                 this);
+#if 0 // FIXME!!! elm_access_object_register has not landed yet
+    // Always register access object even application doesn't support
+    // accessibility. In case of accessibility isn't supported, efl_assist
+    // shows warning message by syspopup.
+    // initScreenReaderSupport is related method. (window_data.cpp)
+    elm_access_object_register(wkView, m_window);
+#endif
 }
 
 void ViewLogic::ewkClientDeinit(Evas_Object *wkView)
@@ -596,10 +690,23 @@ void ViewLogic::ewkClientDeinit(Evas_Object *wkView)
             it->first.c_str(),
             it->second);
     }
-    ewk_view_orientation_lock_callback_set(
-        wkView,
-        NULL,
-        NULL);
+    ewk_view_orientation_lock_callback_set(wkView, NULL, NULL);
+    ewk_view_exceeded_database_quota_callback_set(wkView, NULL, NULL);
+    ewk_view_exceeded_indexed_database_quota_callback_set(wkView, NULL, NULL);
+    ewk_view_exceeded_local_file_system_quota_callback_set(wkView, NULL, NULL);
+    ea_object_event_callback_del(wkView,
+                                 EA_CALLBACK_BACK,
+                                 eaKeyCallback);
+    ea_object_event_callback_del(wkView,
+                                 EA_CALLBACK_MORE,
+                                 eaKeyCallback);
+    if (m_orientationThresholdTimer) {
+        ecore_timer_del(m_orientationThresholdTimer);
+        m_orientationThresholdTimer = NULL;
+    }
+    // FIXME!!!! elm_access_object_unregister has not landed in
+    //           tizen 3.0 elementary yet
+    // elm_access_object_unregister(wkView);
 }
 
 bool ViewLogic::createEwkView(Evas* canvas)
@@ -632,73 +739,25 @@ bool ViewLogic::createEwkView(Evas* canvas)
         setEwkViewInvisible(m_currentEwkView);
     }
 
-    LogInfo("push webview: " << newEwkView);
+    LogDebug("push webview: " << newEwkView);
     m_ewkViewList.push_back(newEwkView);
     m_currentEwkView = newEwkView;
     return true;
 }
 
-void ViewLogic::setStartPage()
-{
-    /* Start URI (as other uris) is now localized
-     * on WebProcess side */
-    m_currentUri = ViewModule::UriSupport::getUri(m_model, m_startUrl);
-}
-
 void ViewLogic::prepareEwkView(Evas_Object *wkView)
 {
     LogDebug("prepareEwkView called");
     Assert(wkView);
-
-#ifdef CSP_ENABLED
-    LogInfo("Setting CSP default policy");
-    ewk_context_tizen_extensible_api_set(
-        m_ewkContext, EWK_EXTENSIBLE_API_CSP, true);
-    // setting CSP policy rules
-    // temporary turn off
-    //ewk_view_content_security_policy_set(
-    //    wkView,
-    //    "default-src '*'; script-src 'self'; style-src 'self'; object-src 'none';",
-    //    EWK_ENFORCE_POLICY);
-    //LogInfo("Default policy set");
-
-    DPL::OptionalString policy = m_model->CspReportOnlyPolicy.Get();
-
-    if (!(policy.IsNull()))
-    {
-        LogDebug("CSP report only policy present in manifest: " << *policy);
-        ewk_view_content_security_policy_set(
-            wkView, DPL::ToUTF8String(*policy).c_str(), EWK_REPORT_ONLY);
-    } else {
-        LogDebug("Config CSP report only policy is not present");
-    }
-
-    policy = m_model->CspPolicy.Get();
-
-    if (!(policy.IsNull()))
-    {
-        LogDebug("CSP policy present in manifest: " << *policy);
-        ewk_view_content_security_policy_set(
-            wkView, DPL::ToUTF8String(*policy).c_str(), EWK_ENFORCE_POLICY);
-    } else {
-        LogDebug("Config CSP policy is not present");
-    }
-
-
-    LogInfo("CSP set.");
-#endif
-
     Ewk_Settings* settings = ewk_view_settings_get(wkView);
 
     // set user agent
     std::string customUserAgent = m_model->SettingList.Get().getUserAgent();
     if (customUserAgent.empty()) {
-        auto userAgentString =
-            ViewModule::UserAgentSupport::getUserAgentFromVconf();
-        if (!userAgentString.empty()) {
-            LogDebug("Setting user agent as: " << userAgentString);
-            ewk_view_user_agent_set(wkView, userAgentString.c_str());
-        }
+        LogDebug("Setting user agent as: default");
+        ewk_view_user_agent_set(wkView, NULL);
+        std::string defaultUA = ewk_view_user_agent_get(wkView);
+        LogDebug("webkit's UA: " << defaultUA);
     } else {
         LogDebug("Setting  custom user agent as: " << customUserAgent);
         ewk_view_user_agent_set(wkView, customUserAgent.c_str());
@@ -717,15 +776,6 @@ void ViewLogic::prepareEwkView(Evas_Object *wkView)
 
     // webkit NPAPI plugins is always on in wrt
     ewk_settings_plugins_enabled_set(settings, EINA_TRUE);
-
-    // The followings are not implemeted yet by webkit2
-    //      ewk_view_setting_accelerated_compositing_enable_set(EINA_TRUE);
-    //      ewk_view_mode_set();
-    //      ewk_view_setting_enable_specified_plugin_set(EINA_TRUE,
-    // FLASH_MIME_TYPE);
-    //      ewk_view_setting_html5video_external_player_enable_set(EINA_FALSE);
-    //      ewk_view_show_ime_on_autofocus_set(EINA_TRUE);
-    //      elm_webview_show_magnifier_set(EINA_FALSE);
     ewk_settings_javascript_enabled_set(settings, EINA_TRUE);
     ewk_settings_loads_images_automatically_set(settings, EINA_TRUE);
     // WRT should not fit web contents to device width automatically as default.
@@ -734,39 +784,66 @@ void ViewLogic::prepareEwkView(Evas_Object *wkView)
     ewk_settings_autofill_password_form_enabled_set(settings, EINA_TRUE);
     ewk_settings_form_candidate_data_enabled_set(settings, EINA_TRUE);
 
-    // disable zoom option when user click the input field
-    // this option is useful with the normal website
-    // for the make user friendly, disable auto zoom in the webapp
-    // The followings are not implemeted yet by webkit2
-    //      elm_webview_input_field_zoom_set(EINA_FALSE);
-
-    // set cookie database path
-    // The followings are not implemeted yet by webkit2
-    //      ewk_cookies_file_set(dao.getCookieDatabasePath().c_str()));
-
-    // set visibility to WebCore. This value will be used for html5.
-    // also, this value will be changed in the suspend, resume
-    // or create window, close window.
     ewk_view_page_visibility_state_set(wkView,
                                        EWK_PAGE_VISIBILITY_STATE_VISIBLE,
                                        EINA_TRUE);
 
-    std::string encoding="UTF-8";
-    OptionalWidgetStartFileInfo fileInfo = W3CFileLocalization::getStartFileInfo(m_model->TizenId);
-    if(!fileInfo.IsNull()){
-        encoding=DPL::ToUTF8String((*fileInfo).encoding);
-        LogInfo("Found custom encoding in DB: " << encoding);
+    std::string encoding = DEFAULT_ENCODING;
+    OptionalWidgetStartFileInfo fileInfo =
+        W3CFileLocalization::getStartFileInfo(m_model->TizenId);
+#if 0 // FIXME!!!! ewk_settings_is_encoding_valid has not landed yet
+    if (!fileInfo.IsNull()) {
+            std::string file_encoding = DPL::ToUTF8String((*fileInfo).encoding);
+
+            if(EINA_TRUE == ewk_settings_is_encoding_valid(
+                                                        file_encoding.c_str())){
+                encoding = file_encoding;
+                _D("Found custom encoding in DB: %s", encoding.c_str());
+            }
+
+    }
+#endif
+    _D("Setting encoding: %s", encoding.c_str());
+    if (ewk_settings_default_encoding_set(settings,encoding.c_str())) {
+        _D("Encoding set properly");
+    } else {
+        _E("Error while setting encoding");
+    }
+
+#ifdef CSP_ENABLED
+    if (m_model->SecurityModelVersion.Get() ==
+         WrtDB::WidgetSecurityModelVersion::WIDGET_SECURITY_MODEL_V2)
+    {
+        // setting CSP policy rules
+        DPL::OptionalString policy = m_model->CspReportOnlyPolicy.Get();
+        if (!policy.IsNull()) {
+            LogDebug("CSP report only policy present in manifest: " << *policy);
+            ewk_view_content_security_policy_set(
+                wkView,
+                DPL::ToUTF8String(*policy).c_str(),
+                EWK_REPORT_ONLY);
+        }
+
+        policy = m_model->CspPolicy.Get();
+        if (!policy.IsNull()) {
+            LogDebug("CSP policy present in manifest: " << *policy);
+            ewk_view_content_security_policy_set(
+                wkView,
+                DPL::ToUTF8String(*policy).c_str(),
+                EWK_ENFORCE_POLICY);
+        } else {
+            ewk_view_content_security_policy_set(
+                wkView,
+                DEFAULT_CSP_POLICY,
+                EWK_ENFORCE_POLICY);
+        }
     }
-    LogInfo("Setting encoding: " << encoding);
-    if(ewk_settings_default_encoding_set(settings,encoding.c_str()))
-        LogInfo("Encoding set properly");
-    else
-        LogInfo("Error while setting encoding");
+#endif
 }
 
 void ViewLogic::removeEwkView(Evas_Object *wkView)
 {
-    LogInfo("removeEwkView called");
+    LogDebug("removeEwkView called");
     Assert(wkView);
     Assert(0 != m_ewkViewList.size());
 
@@ -779,36 +856,9 @@ void ViewLogic::removeEwkView(Evas_Object *wkView)
     m_ewkViewList.remove(wkView);
 }
 
-void ViewLogic::resumeEwkView(Evas_Object *wkView)
-{
-    LogInfo("resumeEwkView called");
-    Assert(wkView);
-
-    // register webview callback
-    ewkClientInit(wkView);
-
-    // resume webkit
-    resumeWebkit(wkView);
-
-    return;
-}
-
-void ViewLogic::suspendEwkView(Evas_Object *wkView)
-{
-    LogInfo("suspendEwkView called");
-    Assert(wkView);
-
-    // suspend webkit
-    suspendWebkit(wkView);
-
-    // unregister webview callbacks
-    ewkClientDeinit(wkView);
-    return;
-}
-
 void ViewLogic::setEwkViewInvisible(Evas_Object *wkView)
 {
-    LogInfo("setEwkViewInvisible called");
+    LogDebug("setEwkViewInvisible called");
     Assert(wkView);
 
     ewk_view_page_visibility_state_set(wkView,
@@ -819,7 +869,7 @@ void ViewLogic::setEwkViewInvisible(Evas_Object *wkView)
 
 void ViewLogic::setEwkViewVisible(Evas_Object *wkView)
 {
-    LogInfo("setEwkViewVisible called");
+    LogDebug("setEwkViewVisible called");
     Assert(wkView);
 
     ewk_view_page_visibility_state_set(wkView,
@@ -830,31 +880,25 @@ void ViewLogic::setEwkViewVisible(Evas_Object *wkView)
 
 void ViewLogic::resumeWebkit(Evas_Object *wkView)
 {
-    LogDebug("resumeWebkit");
+    LogDebug("resumeWebkit : " << wkView);
     Assert(wkView);
 
-    // resume NPAPI plugin
-    // The followings are not implemeted yet by webkit2
-    //      ewk_view_pause_or_resume_plugins(false);
-    //      ewk_view_pause_or_resume_video_audio(false);
-    //      ewk_view_javascript_resume();
-    //      ewk_view_enable_render();
-    //      ewk_view_reduce_plugins_frame_rate(false);
     ewk_view_resume(wkView);
+    // FIXME!!!! ewk_view_foreground_set has not landed yet
+    // ewk_view_foreground_set(wkView, true);
 
     return;
 }
 
 void ViewLogic::suspendWebkit(Evas_Object *wkView)
 {
-    LogDebug("suspendWebkit");
+    LogDebug("suspendWebkit : " << wkView);
     Assert(wkView);
 
-    // suspend the followings
-    // The followings are not implemeted yet by webkit2
-    //      ewk_view_pause_or_resume_plugins(true);
-    //      ewk_view_pause_or_resume_video_audio(true);
     ewk_view_suspend(wkView);
+    // FIXME!!!! ewk_view_foreground_set has not landed in the
+    //           tizen 3.0 elementary project yet
+    // ewk_view_foreground_set(wkView, false);
 
     return;
 }
@@ -867,7 +911,6 @@ void ViewLogic::loadStartedCallback(
     LogDebug("loadStartedCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
-    evas_object_focus_set(This->m_currentEwkView, EINA_TRUE);
 
     // call loadFinish callback to wrt-client
     if (!This->m_cbs->loadStart.empty()) {
@@ -898,16 +941,10 @@ void ViewLogic::loadFinishedCallback(
 
     // set only encoded bundle
     double scale = elm_config_scale_get();
-    PluginModuleSupport::setCustomProperties(
+    ViewLogicMessageSupport::setCustomProperties(
         This->m_ewkContext,
         &scale,
         ApplicationDataSingleton::Instance().getEncodedBundle());
-    // check if 'appsevice' event is registed at the current frames.
-    // If so, dispatch the event to frames.
-    PluginModuleSupport::dispatchJavaScriptEvent(
-        This->m_ewkContext,
-        WrtPlugins::W3C::ServiceCustomEvent,
-        NULL);
 
     // In this case, widget is reloaded in the background.
     // After finished load, bundle should disconnent callback.
@@ -917,45 +954,26 @@ void ViewLogic::loadFinishedCallback(
     }
 }
 
-void ViewLogic::titleChangedCallback(
+void ViewLogic::loadProgressStartedCallback(
     void* data,
-    Evas_Object* obj,
-    void* eventInfo)
+    Evas_Object* /*obj*/,
+    void* /*eventInfo*/)
 {
-    LogDebug("titleChangedCallback called");
+    _D("loadProgressStartedCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
-    Assert(eventInfo);
-    const char* title = static_cast<char*>(eventInfo);
-
-    if (0 == strlen(title)) {
-        LogDebug("title data is empty");
-        This->m_currentTitle = std::string();
-        return;
-    }
-    LogDebug("Title = [" << title << "]");
-    bool ret = This->m_schemeSupport->HandleTizenScheme(
-                                             title,
-                                             This->m_window,
-                                             This->m_currentEwkView);
-    // if result is true, this is tizen scheme
-    // and then, title is reset to page's real title
-    if (ret) {
-        std::string script = "document.title = \"";
-        script += This->m_currentTitle;
-        script +="\";";
-        ewk_view_script_execute(obj, script.c_str(), didRunJavaScriptCallback, This);
-    } else {
-        This->m_currentTitle = std::string(title);
+    if (!This->m_cbs->progressStarted.empty()) {
+        This->m_cbs->progressStarted();
     }
 }
 
+
 void ViewLogic::loadProgressCallback(
     void* data,
     Evas_Object* obj,
     void* eventInfo)
 {
-    LogDebug("loadProgressCallback called");
+    _D("loadProgressCallback called");
     Assert(data);
     Assert(eventInfo);
     ViewLogic const * const view = static_cast<ViewLogic const * const>(data);
@@ -985,7 +1003,7 @@ void ViewLogic::processCrashedCallback(
     Evas_Object* /*obj*/,
     void* eventInfo)
 {
-    LogInfo("processCrashedCallback");
+    LogDebug("processCrashedCallback");
     Assert(data);
     ViewLogic const * const view =
         static_cast<ViewLogic const * const>(data);
@@ -1027,7 +1045,6 @@ void ViewLogic::createWindowCallback(
     Evas_Object* newEwkView = This->m_currentEwkView;
 
     // initialize new ewkview
-    This->setStartPage();
     This->ewkClientInit(newEwkView);
     This->prepareEwkView(newEwkView);
 
@@ -1057,7 +1074,7 @@ void ViewLogic::closeWindowCallback(
 
 void ViewLogic::policyNavigationDecideCallback(
     void* data,
-    Evas_Object* /*obj*/,
+    Evas_Object* obj,
     void* eventInfo)
 {
     LogDebug("policyNavigationDecideCallback called");
@@ -1069,6 +1086,17 @@ void ViewLogic::policyNavigationDecideCallback(
 
     // handle blocked url
     const char* url = ewk_policy_decision_url_get(policyDecision);
+
+    // call user delegate callback
+    if (!This->m_cbs->navigationDecide.empty()) {
+        std::string navigationUri(url);
+        This->m_cbs->navigationDecide(obj, navigationUri);
+        if (!navigationUri.compare(0, 6, SCHEME_BOX_SLASH)) {
+            ewk_policy_decision_ignore(policyDecision);
+            return;
+        }
+    }
+
     if (url && strlen(url) != 0) {
         if (This->m_blockedUri == url) {
             LogDebug("Blocked url = " << url);
@@ -1078,11 +1106,10 @@ void ViewLogic::policyNavigationDecideCallback(
         }
     }
 
-    if (This->m_schemeSupport->filterURIByScheme(policyDecision,
-                                                 false,
-                                                 This->m_model,
-                                                 This->m_window,
-                                                 This->m_currentEwkView))
+    if (ViewModule::SchemeSupport::filterURIByScheme(policyDecision,
+                                                     false,
+                                                     This->m_window,
+                                                     This->m_currentEwkView))
     {
         LogDebug("use");
         ewk_policy_decision_use(policyDecision);
@@ -1101,7 +1128,7 @@ void ViewLogic::policyNavigationDecideCallback(
              * and the previous one is shown. This is not an elegant solution
              * but we don't have a better one.
              */
-            LogInfo("Scheme has been handled externally. Removing empty view.");
+            LogDebug("Scheme has been handled externally. Removing empty view.");
             if (ewk_view_back_possible(This->m_currentEwkView)) {
                 // go back to previous WKPage
                 ewk_view_back(This->m_currentEwkView);
@@ -1130,11 +1157,21 @@ void ViewLogic::policyNewWindowDecideCallback(
     Ewk_Policy_Decision* policyDecision =
         static_cast<Ewk_Policy_Decision*>(eventInfo);
 
-    if (This->m_schemeSupport->filterURIByScheme(policyDecision,
-                                                 true,
-                                                 This->m_model,
-                                                 This->m_window,
-                                                 This->m_currentEwkView))
+    // handle blocked url
+    const char* url = ewk_policy_decision_url_get(policyDecision);
+    if (url && strlen(url) != 0) {
+        if (This->m_blockedUri == url) {
+            LogDebug("Blocked url = " << url);
+            This->m_blockedUri = std::string();
+            ewk_policy_decision_ignore(policyDecision);
+            return;
+        }
+    }
+
+    if (ViewModule::SchemeSupport::filterURIByScheme(policyDecision,
+                                                     true,
+                                                     This->m_window,
+                                                     This->m_currentEwkView))
     {
         ewk_policy_decision_use(policyDecision);
     } else {
@@ -1252,6 +1289,10 @@ void ViewLogic::contextmenuCustomizeCallback(
                 ewk_context_menu_item_remove(menu, item);
                 continue;
 
+            case EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK:
+                ewk_context_menu_item_remove(menu, item);
+                continue;
+
             default:
                 idx++;
                 break;
@@ -1271,15 +1312,12 @@ void ViewLogic::geolocationPermissionRequestCallback(
     Ewk_Geolocation_Permission_Request* permissionRequest =
         static_cast<Ewk_Geolocation_Permission_Request*>(eventInfo);
 
-    if (This->m_securityOriginSupport->isNeedPermissionCheck(
-            WrtDB::FEATURE_GEOLOCATION)
-        == WrtDB::SETTINGS_TYPE_OFF)
-    {
+    if (This->m_model->GeolocationUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
         ewk_geolocation_permission_request_set(permissionRequest, EINA_FALSE);
         return;
     }
     ViewModule::GeolocationSupport::geolocationPermissionRequest(
-        This->m_window,
+        This->m_currentEwkView,
         This->m_securityOriginSupport->getSecurityOriginDAO(),
         eventInfo);
 }
@@ -1289,49 +1327,44 @@ void ViewLogic::notificationShowCallback(
     Evas_Object* /*obj*/,
     void* eventInfo)
 {
-    LogDebug("notificationShowCallback called");
-    Assert(data);
-    ViewLogic* This = static_cast<ViewLogic*>(data);
-
     Assert(eventInfo);
-    Ewk_Notification* noti = static_cast<Ewk_Notification*>(eventInfo);
-
-    using namespace ViewModule::WebNotification;
+    Ewk_Notification* ewkNotification =
+        static_cast<Ewk_Notification*>(eventInfo);
+    ViewModule::WebNotificationDataPtr notiData(
+        new ViewModule::WebNotificationData(ewkNotification));
 
-    WebNotificationDataPtr notiData(
-        new WebNotificationData(
-            This->m_model,
-            ewk_notification_id_get(noti)));
+    _D("notification id : %u", notiData->getEwkNotiId());
+    _D("notification iconURL : %s", notiData->getIconUrl());
+    _D("notification title : %s", notiData->getTitle());
+    _D("notification body : %s", notiData->getBody());
 
-    DPL::OptionalString string =
-        DPL::FromUTF8String(ewk_notification_icon_url_get(noti));
-    if (!string.IsNull()) {
-        notiData->m_iconURL = DPL::ToUTF8String(*string);
-    }
-    string = DPL::FromUTF8String(ewk_notification_title_get(noti));
-    if (!string.IsNull()) {
-        notiData->m_title = DPL::ToUTF8String(*string);
-    }
-    string = DPL::FromUTF8String(ewk_notification_body_get(noti));
-    if (!string.IsNull()) {
-        notiData->m_body = DPL::ToUTF8String(*string);
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    if (This->m_webNotificationSupport->show(notiData)) {
+        ewk_notification_showed(This->m_ewkContext, notiData->getEwkNotiId());
     }
-
-    LogInfo("notification id : " << notiData->m_id);
-    LogInfo("notification iconURL : " << notiData->m_iconURL);
-    LogInfo("notification title : " << notiData->m_title);
-    LogInfo("notification body : " << notiData->m_body);
-
-    showWebNotification(notiData);
-    ewk_notification_showed(This->m_ewkContext, ewk_notification_id_get(noti));
 }
 
 void ViewLogic::notificationCancelCallback(
-    void* /*data*/,
-    Evas_Object* /*obj*/,
-    void* /*eventInfo*/)
+    void* data,
+    Evas_Object* obj,
+    void* eventInfo)
 {
-    LogDebug("notificationCancelCallback called");
+    Assert(eventInfo);
+    uint64_t ewkNotiId = *static_cast<uint64_t*>(eventInfo);
+
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    Ewk_Notification* ewkNotification =
+        static_cast<Ewk_Notification*>(
+            This->m_webNotificationSupport->hide(ewkNotiId));
+    if (ewkNotification) {
+        Assert(obj);
+        Eina_List* list = NULL;
+        list = eina_list_append(list, ewkNotification);
+        ewk_view_notification_closed(obj, list);
+        eina_list_free(list);
+    }
 }
 
 void ViewLogic::notificationPermissionRequestCallback(
@@ -1342,21 +1375,10 @@ void ViewLogic::notificationPermissionRequestCallback(
     LogDebug("notificationPermissionRequestCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
-    if (This->m_securityOriginSupport->isNeedPermissionCheck(
-            WrtDB::FEATURE_WEB_NOTIFICATION)
-        == WrtDB::SETTINGS_TYPE_OFF)
-    {
-        Ewk_Notification_Permission_Request* request =
-            static_cast<Ewk_Notification_Permission_Request*>(eventInfo);
-        ewk_notification_permission_request_set(
-            request,
-            EINA_FALSE);
-        return;
-    }
 
     Assert(eventInfo);
-    ViewModule::WebNotification::webNotificationPermissionRequest(
-        This->m_window,
+    ViewModule::WebNotificationPermissionSupport::permissionRequest(
+        This->m_currentEwkView,
         This->m_securityOriginSupport->getSecurityOriginDAO(),
         eventInfo);
     return;
@@ -1365,7 +1387,7 @@ void ViewLogic::notificationPermissionRequestCallback(
 // EWK Orientation Callback
 Eina_Bool ViewLogic::orientationLockCallback(
     Evas_Object* obj,
-    Eina_Bool /*needLock*/,
+    Eina_Bool needLock,
     int orientation,
     void* data)
 {
@@ -1373,39 +1395,42 @@ Eina_Bool ViewLogic::orientationLockCallback(
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
 
-    if (orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY) {
-        LogDebug("orientation is portrait-primary");
-        elm_win_wm_rotation_preferred_rotation_set(
-            This->m_window,
-            WIN_ORIENTATION_PORTRAIT_PRIMARY_ANGLE);
-        ewk_view_orientation_send(obj, W3C_ORIENTATION_PORTRAIT_PRIMARY_ANGLE);
-    } else if (orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY) {
-        LogDebug("orientation is landscape-primary");
-        elm_win_wm_rotation_preferred_rotation_set(
-            This->m_window,
-            WIN_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE);
-        ewk_view_orientation_send(
-            obj,
-             W3C_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE);
-    } else if (orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) {
-        LogDebug("orientation is portrait-secondary");
-        elm_win_wm_rotation_preferred_rotation_set(
-            This->m_window,
-            WIN_ORIENTATION_PORTRAIT_SECONDARY_ANGLE);
-        ewk_view_orientation_send(
-            obj,
-            W3C_ORIENTATION_PORTRAIT_SECONDARY_ANGLE);
-    } else if (orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) {
-        LogDebug("orientation is landscape-secondary");
-        elm_win_wm_rotation_preferred_rotation_set(
-            This->m_window,
-            WIN_ORIENTATION_LANDSCAPE_SECONDARY_ANGLE);
-        ewk_view_orientation_send(
-            obj,
-            W3C_ORIENTATION_LANDSCAPE_SECONDARY_ANGLE);
+    if (This->m_orientationThresholdTimer) {
+        LogDebug("previous orientationLock isn't finished");
+        // Previous API call isn't finished. Keep angle and run it.
+        if (needLock == EINA_TRUE) {
+            // Screen.lockOrientation
+            This->m_deferredRotateAngle = orientation;
+        } else {
+            // Screen.unlockOrientation
+            This->m_deferredRotateAngle =
+                ViewModule::OrientationSupport::DEFERRED_ORIENTATION_UNLOCK;
+        }
+        return EINA_TRUE;
+    }
+
+    This->m_rotateAngle = orientation;
+
+    if (needLock == EINA_TRUE) {
+        // Screen.lockOrientation
+        int w3cAngle =
+            ViewModule::OrientationSupport::getW3COrientationAngle(orientation);
+        int winAngle =
+            ViewModule::OrientationSupport::getWinOrientationAngle(orientation);
+        ViewModule::OrientationSupport::setEwkOrientation(obj, w3cAngle);
+        if (!This->m_cbs->setOrientation.empty()) {
+            This->m_cbs->setOrientation(winAngle);
+        }
     } else {
-        LogDebug("Wrong orientation is set");
-        return EINA_FALSE;
+        // Screen.unlockOrientation
+        if (This->m_model->SettingList.Get().getRotationValue() ==
+            Screen_AutoRotation)
+        {
+            if (!This->m_cbs->setOrientation.empty()) {
+                This->m_cbs->setOrientation(OrientationAngle::Window::UNLOCK);
+            }
+            This->m_rotateAngle = 0;
+        }
     }
     return EINA_TRUE;
 }
@@ -1413,26 +1438,40 @@ Eina_Bool ViewLogic::orientationLockCallback(
 // Fullscreen API callbacks
 void ViewLogic::enterFullscreenCallback(
     void* data,
-    Evas_Object* /*obj*/,
-    void* /*eventInfo*/)
+    Evas_Object* obj,
+    void* eventInfo)
 {
-    LogInfo("enterFullscreenCallback called");
+    LogDebug("enterFullscreenCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
-    if (!This->m_cbs->toggleFullscreen.empty()) {
-        This->m_cbs->toggleFullscreen(true);
+    ViewLogicMessageSupport::setViewmodes(
+        This->m_ewkContext,
+        "fullscreen");
+
+    if (eventInfo) {
+        This->m_isFullscreenByPlatform =
+            *static_cast<Eina_Bool*>(eventInfo) == EINA_TRUE;
+    }
+    if (!This->m_cbs->enterFullscreen.empty()) {
+        This->m_cbs->enterFullscreen(obj);
     }
 }
+
 void ViewLogic::exitFullscreenCallback(
     void* data,
-    Evas_Object* /*obj*/,
+    Evas_Object* obj,
     void* /*eventInfo*/)
 {
-    LogInfo("exitFullscreenCallback called");
+    LogDebug("exitFullscreenCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
-    if (!This->m_cbs->toggleFullscreen.empty()) {
-        This->m_cbs->toggleFullscreen(false);
+    ViewLogicMessageSupport::setViewmodes(
+        This->m_ewkContext,
+        Message::ToInjectedBundle::SET_VIEWMODES_MSGBODY_EXIT);
+
+    This->m_isFullscreenByPlatform = false;
+    if (!This->m_cbs->exitFullscreen.empty()) {
+        This->m_cbs->exitFullscreen(obj);
     }
 }
 
@@ -1481,7 +1520,6 @@ void ViewLogic::imeClosedCallback(
     using namespace WrtPlugins::W3C;
     SoftKeyboardChangeArgs args;
     args.state = IME_STATE_OFF;
-
     This->fireJavascriptEvent(
         static_cast<int>(SoftKeyboardChangeCustomEvent),
         &args);
@@ -1496,7 +1534,7 @@ void ViewLogic::usermediaPermissionRequestCallback(
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
     ViewModule::UsermediaSupport::usermediaPermissionRequest(
-        This->m_window,
+        This->m_currentEwkView,
         This->m_securityOriginSupport->getSecurityOriginDAO(),
         eventInfo);
 }
@@ -1913,8 +1951,53 @@ void ViewLogic::didRunJavaScriptCallback(
     const char* result,
     void* /*userData*/)
 {
-    LogInfo("didRunJavaScriptCallback called");
-    LogInfo("result = " << result);
+    LogDebug("didRunJavaScriptCallback called");
+    LogDebug("result = " << result);
+}
+
+void ViewLogic::eaKeyCallback(void* data, Evas_Object* obj, void* eventInfo)
+{
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+
+    Ea_Callback_Type keyType =
+        static_cast<Ea_Callback_Type>(reinterpret_cast<intptr_t>(eventInfo));
+
+    LogDebug("Key = [" << keyType << "]");
+
+    std::string keyName;
+    if (keyType == EA_CALLBACK_BACK) {
+        Assert(obj);
+#if 0 // FIXME!!!! ewk_view_text_selection_clear has not landed yet
+        // Call fullscreen exit API
+        // In case of fullscreen is entered by platform(default video tag),
+        // automatically exit fullscreen when backkey is selected
+        if (This->m_isFullscreenByPlatform) {
+            ewk_view_fullscreen_exit(obj);
+            return;
+        }
+
+        // Call text selection clear API
+        // In case of current state is selection mode,
+        // application doesn't need to handle back key
+        if (EINA_TRUE == ewk_view_text_selection_clear(obj)) {
+            return;
+        }
+#endif
+        keyName = KeyName::BACK;
+    } else if (keyType == EA_CALLBACK_MORE) {
+        keyName = KeyName::MENU;
+    } else {
+        return;
+    }
+
+    if (This->m_model->SettingList.Get().getHWkeyEvent() == HWkeyEvent_Enable)
+    {
+        DispatchEventSupport::dispatchHwKeyEvent(obj, keyName);
+    }
+    This->m_cbs->hwkey(keyName);
+
+    return;
 }
 
 Eina_Bool ViewLogic::windowCloseIdlerCallback(void* data)
@@ -1925,6 +2008,80 @@ Eina_Bool ViewLogic::windowCloseIdlerCallback(void* data)
     return ECORE_CALLBACK_CANCEL;
 }
 
+Eina_Bool ViewLogic::exceededDatabaseQuotaCallback(Evas_Object* obj,
+                                                   Ewk_Security_Origin* origin,
+                                                   const char* ,
+                                                   unsigned long long ,
+                                                   void* data)
+{
+    LogDebug("exceededDatabaseQuotaCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    Assert(obj);
+
+    if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
+        ewk_view_exceeded_database_quota_reply(obj, EINA_FALSE);
+        return EINA_TRUE;
+    }
+
+    ViewModule::WebStorageSupport::createPermissionRequest(
+        This->m_currentEwkView,
+        This->m_securityOriginSupport->getSecurityOriginDAO(),
+        obj,
+        origin,
+        ewk_view_exceeded_database_quota_reply);
+    return EINA_TRUE;
+}
+
+Eina_Bool ViewLogic::exceededIndexedDatabaseQuotaCallback(Evas_Object* obj,
+                                                          Ewk_Security_Origin* origin,
+                                                          long long ,
+                                                          void* data)
+{
+    LogDebug("exceededIndexedDatabaseQuotaCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    Assert(obj);
+
+    if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
+        ewk_view_exceeded_indexed_database_quota_reply(obj, EINA_FALSE);
+        return EINA_TRUE;
+    }
+
+    ViewModule::WebStorageSupport::createPermissionRequest(
+        This->m_currentEwkView,
+        This->m_securityOriginSupport->getSecurityOriginDAO(),
+        obj,
+        origin,
+        ewk_view_exceeded_indexed_database_quota_reply);
+    return EINA_TRUE;
+}
+
+Eina_Bool ViewLogic::exceededLocalFileSystemQuotaCallback(Evas_Object* obj,
+                                                          Ewk_Security_Origin* origin,
+                                                          long long ,
+                                                          void* data)
+{
+    LogDebug("exceededLocalFileSystemQuotaCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    Assert(obj);
+
+
+    if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
+        ewk_view_exceeded_local_file_system_quota_reply(obj, EINA_FALSE);
+        return EINA_TRUE;
+    }
+
+    ViewModule::WebStorageSupport::createPermissionRequest(
+        This->m_currentEwkView,
+        This->m_securityOriginSupport->getSecurityOriginDAO(),
+        obj,
+        origin,
+        ewk_view_exceeded_local_file_system_quota_reply);
+    return EINA_TRUE;
+}
+
 void ViewLogic::certificateConfirmRequestCallback(
     void* data,
     Evas_Object* /*obj*/,
@@ -1936,7 +2093,7 @@ void ViewLogic::certificateConfirmRequestCallback(
     ViewLogic* This = static_cast<ViewLogic*>(data);
     Assert(eventInfo);
     ViewModule::CertificateConfirmSupport::certificatePermissionRequest(
-        This->m_window,
+        This->m_currentEwkView,
         This->m_certificateSupport->getCertificateDAO(),
         eventInfo);
 }
@@ -1947,14 +2104,16 @@ void ViewLogic::authenticationChallengeRequestCallback(
     void* eventInfo)
 {
     LogDebug("authenticationChallengeRequestCallback called");
-
     Assert(data);
+    Assert(eventInfo);
+
     ViewLogic* This = static_cast<ViewLogic*>(data);
     const char* url = ewk_view_url_get(This->m_currentEwkView);
     if (!url || strlen(url) == 0) {
-        url = This->m_currentUri.c_str();
+        Ewk_Auth_Challenge* authChallenge = static_cast<Ewk_Auth_Challenge*>(eventInfo);
+        ewk_auth_challenge_credential_cancel(authChallenge);
+        return;
     }
-    Assert(eventInfo);
     ViewModule::AuthenticationChallengeSupport::authenticationChallengeRequest(
         This->m_currentEwkView,
         url,
@@ -1966,68 +2125,188 @@ void ViewLogic::viewFrameRenderedCallback(
     Evas_Object* /*obj*/,
     void* /*eventInfo*/)
 {
-    LogInfo("enter");
+    static bool logEnable = (getenv("WRT_FRAME_RENDERED_LOG_ENABLE") != NULL);
+
+    if (logEnable)
+    {
+        LogDebug("enter");
+    }
 }
 
-std::string ViewLogic::requestUrlBlocked(const std::string& blockedUrl)
+void ViewLogic::mediacontrolRotateHorizontal(void* data,
+                                             Evas_Object* obj,
+                                             void* /*eventInfo*/)
 {
-    LogInfo("enter");
+    LogDebug("mediacontrolRotateHorizontal called");
+    Assert(data);
+    Assert(obj);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    ViewModule::OrientationSupport::setEwkOrientation(
+        obj,
+        OrientationAngle::W3C::Landscape::PRIMARY);
+    if (!This->m_cbs->setOrientation.empty()) {
+        This->m_cbs->setOrientation(
+            OrientationAngle::Window::Landscape::PRIMARY);
+    }
+}
 
-    if (m_model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
-        // block this page and open it in browser
-        LogDebug("Request was blocked by WARP: " << blockedUrl);
-        LogDebug("open browser : " << blockedUrl);
-        bundle* bundleData = bundle_create();
-        appsvc_set_operation(bundleData, APPSVC_OPERATION_VIEW);
-        appsvc_set_uri(bundleData, blockedUrl.c_str());
-        CONTROLLER_POST_EVENT(
-            ApplicationLauncher,
-            ApplicationLauncherEvents::LaunchApplicationByAppService(
-                bundleData,
-                NULL,
-                NULL));
+void ViewLogic::mediacontrolRotateVertical(void* data,
+                                           Evas_Object* obj,
+                                           void* /*eventInfo*/)
+{
+    LogDebug("mediacontrolRotateVertical called");
+    Assert(data);
+    Assert(obj);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    ViewModule::OrientationSupport::setEwkOrientation(
+        obj,
+        OrientationAngle::W3C::Portrait::PRIMARY);
+    if (!This->m_cbs->setOrientation.empty()) {
+        This->m_cbs->setOrientation(
+            OrientationAngle::Window::Portrait::PRIMARY);
     }
+}
 
-    // set block url. This is used on load finished callback
-    m_blockedUri = blockedUrl;
+void ViewLogic::mediacontrolRotateExit(void* data,
+                                       Evas_Object* obj,
+                                       void* /*eventInfo*/)
+{
+    LogDebug("mediacontrolRotateExit called");
+    Assert(data);
+    Assert(obj);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+
+    int w3cAngle = 0;
+    int winAngle = 0;
+    if (This->m_rotateAngle == 0) {
+        // application hasn't call orientation lock
+        WidgetSettingScreenLock screenLock =
+            This->m_model->SettingList.Get().getRotationValue();
+        if (screenLock == Screen_Portrait) {
+            w3cAngle = OrientationAngle::W3C::Portrait::PRIMARY;
+            winAngle = OrientationAngle::Window::Portrait::PRIMARY;
+        } else if (screenLock == Screen_Landscape) {
+            w3cAngle = OrientationAngle::W3C::Landscape::PRIMARY;
+            winAngle = OrientationAngle::Window::Landscape::PRIMARY;
+        } else if (screenLock == Screen_AutoRotation) {
+            if (!This->m_cbs->setOrientation.empty()) {
+                This->m_cbs->setOrientation(OrientationAngle::Window::UNLOCK);
+            }
+            return;
+        }
+    } else {
+        // Restore previous orientation
+        w3cAngle =
+            ViewModule::OrientationSupport::getW3COrientationAngle(
+                This->m_rotateAngle);
+        winAngle =
+            ViewModule::OrientationSupport::getWinOrientationAngle(
+                This->m_rotateAngle);
+    }
+
+    ViewModule::OrientationSupport::setEwkOrientation(obj, w3cAngle);
+    if (!This->m_cbs->setOrientation.empty()) {
+        This->m_cbs->setOrientation(winAngle);
+    }
 
-    // This is used in case of returning previous page
-    return URICHANGE_PLUGIN_NO_CHANGE;
 }
 
-std::string ViewLogic::requestUrlChanged(const std::string& changedUrl)
+Eina_Bool ViewLogic::orientationThresholdTimerCallback(void* data)
 {
-    using namespace ViewModule::SecuritySupport;
-
-    LogInfo("changed url: " << changedUrl);
+    LogDebug("orientationThresholdTimerCallback");
+    ViewLogic* This = static_cast<ViewLogic*>(data);
 
-    // Check if this url with 'http' or 'https' is included in whitelist,
-    // which has lists of accessible external documents and
-    // used for ONLY Tizen app
-    std::string matchedScheme;
-    std::string matchedUri;
-    pcrecpp::RE(PATTERN_URI_CHANGE).PartialMatch(changedUrl.c_str(),
-                                                 &matchedUri,
-                                                 &matchedScheme);
-    ViewModule::Scheme scheme(matchedScheme);
-    if (scheme.GetType() == ViewModule::Scheme::HTTP ||
-        scheme.GetType() == ViewModule::Scheme::HTTPS)
+    if (This->m_deferredRotateAngle ==
+        ViewModule::OrientationSupport::DEFERRED_ORIENTATION_EMPTY)
     {
-        if (m_model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
-            if (!checkWhitelist(changedUrl.c_str())) {
-                LogInfo("This uri is not included in white document list");
-                return URICHANGE_PLUGIN_STOP_ONLY;
+        // There is no defered orientation API call
+        This->m_orientationThresholdTimer = NULL;
+        return ECORE_CALLBACK_CANCEL;
+    }
+
+    if (This->m_deferredRotateAngle != This->m_rotateAngle) {
+        This->m_rotateAngle = This->m_deferredRotateAngle;
+        int w3cAngle = 0;
+        int winAngle = 0;
+        if (This->m_rotateAngle == 0) {
+            WidgetSettingScreenLock screenLock =
+                This->m_model->SettingList.Get().getRotationValue();
+            if (screenLock == Screen_Portrait) {
+                w3cAngle = OrientationAngle::W3C::Portrait::PRIMARY;
+                winAngle = OrientationAngle::Window::Portrait::PRIMARY;
+            } else if (screenLock == Screen_Landscape) {
+                w3cAngle = OrientationAngle::W3C::Landscape::PRIMARY;
+                winAngle = OrientationAngle::Window::Landscape::PRIMARY;
+            } else if (screenLock == Screen_AutoRotation) {
+                if (!This->m_cbs->setOrientation.empty()) {
+                    This->m_cbs->setOrientation(OrientationAngle::Window::UNLOCK);
+                }
+                This->m_orientationThresholdTimer = NULL;
+                return ECORE_CALLBACK_CANCEL;
             }
-            LogInfo("This url is included in WhiteList");
         } else {
-            // For WAC app, WRT should block access of device api
-            // for external documents
-            return URICHANGE_PLUGIN_STOP_ONLY;
+            // Restore previous orientation
+            w3cAngle =
+                ViewModule::OrientationSupport::getW3COrientationAngle(
+                    This->m_rotateAngle);
+            winAngle =
+                ViewModule::OrientationSupport::getWinOrientationAngle(
+                    This->m_rotateAngle);
+        }
+
+        ViewModule::OrientationSupport::setEwkOrientation(
+            This->m_currentEwkView,
+            w3cAngle);
+        if (!This->m_cbs->setOrientation.empty()) {
+            This->m_cbs->setOrientation(winAngle);
         }
+        This->m_deferredRotateAngle =
+            ViewModule::OrientationSupport::DEFERRED_ORIENTATION_EMPTY;
+        return ECORE_CALLBACK_RENEW;
     }
 
-    m_currentUri = changedUrl;
-    return URICHANGE_PLUGIN_RESTART;
+    This->m_orientationThresholdTimer = NULL;
+    return ECORE_CALLBACK_CANCEL;
+}
+
+void ViewLogic::popupReplyWaitStart(void* data,
+                                    Evas_Object* /*obj*/,
+                                    void* /*eventInfo*/)
+{
+    LogDebug("called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    This->m_isPopupReplyWait = true;
+}
+
+void ViewLogic::popupReplyWaitFinish(void* data,
+                                     Evas_Object* /*obj*/,
+                                     void* /*eventInfo*/)
+{
+    LogDebug("called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    This->m_isPopupReplyWait = false;
+}
+
+void ViewLogic::requestUrlBlocked(const std::string& blockedUrl)
+{
+    LogDebug("enter");
+
+    // block this page and open it in browser
+    LogDebug("Request was blocked : " << blockedUrl);
+    service_h serviceHandle = NULL;
+    service_create(&serviceHandle);
+    service_set_operation(serviceHandle, SERVICE_OPERATION_VIEW);
+    service_set_uri(serviceHandle, blockedUrl.c_str());
+    CONTROLLER_POST_EVENT(
+        ApplicationLauncher,
+        ApplicationLauncherEvents::LaunchApplicationByAppService(
+            serviceHandle,
+            NULL,
+            NULL));
+    // set block url. This is used on load finished callback
+    m_blockedUri = blockedUrl;
 }
 
 void ViewLogic::windowClose()
@@ -2051,17 +2330,7 @@ void ViewLogic::windowClose()
 
         // get latest ewkView
         m_currentEwkView = m_ewkViewList.back();
-        const char* uri = ewk_view_url_get(m_currentEwkView);
-        if (NULL == uri || 0 == strlen(uri)) {
-            m_currentUri.clear();
-        } else {
-            m_currentUri = uri;
-        }
 
-        // resume ewkView
-        /* In case we support many pages in parallel
-         * then view is not suspended*/
-        //resumeEwkView(m_currentEwkView);
         setEwkViewVisible(m_currentEwkView);
 
         // show ewkView
@@ -2071,3 +2340,23 @@ void ViewLogic::windowClose()
     }
 }
 
+void ViewLogic::systemSettingsChangedCallback(system_settings_key_e key,
+                                              void* data)
+{
+    LogDebug("systemSettingsChanged");
+    LogDebug("System setting Key is [" << key << "]");
+
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+
+    if (SYSTEM_SETTINGS_KEY_FONT_TYPE == key) {
+        if (!This->m_currentEwkView) {
+            LogError("ewkView isn't initialized");
+            return;
+        }
+        ewk_view_use_settings_font(This->m_currentEwkView);
+    } else {
+        LogError("Unregister system callback is called");
+    }
+}
+