Add tizen scheme handler
authorJihoon Chung <jihoon.chung@samsaung.com>
Wed, 31 Jul 2013 03:04:35 +0000 (12:04 +0900)
committerHoseon LEE <hoseon46.lee@samsung.com>
Sun, 29 Sep 2013 05:37:46 +0000 (14:37 +0900)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Add tizen scheme handler in the IPC callback
"tizen://exit", "tizen://hide"
No longer used title changed callback for IPC between UI process and tizen plugin
[SCMRequest] must be imported with wrt-plugins-common

Change-Id: I9d17a6963d7907d76b1193247a311e5c9b621fcc

src/view/webkit/view_logic.cpp

index 12261c7..f52a3fe 100644 (file)
@@ -543,10 +543,8 @@ void ViewLogic::checkSyncMessageFromBundle(
 
 void ViewLogic::checkAsyncMessageFromBundle(const char* name, const char* body)
 {
-    LogDebug("checkAsyncMessageFromBundle called");
     Assert(name);
-
-    LogDebug("received : " << name);
+    _D("received : %s", name);
 
     if (!strcmp(name, Message::ToUIProcess::BLOCKED_URL)) {
         // Currently WebProcess informs obly about blocked
@@ -569,49 +567,57 @@ void ViewLogic::checkAsyncMessageFromBundle(const char* name, const char* body)
         Ewk_Cookie_Manager* cookieManager =
             ewk_context_cookie_manager_get(m_ewkContext);
         if (!cookieManager) {
-            LogError("Fail to get cookieManager");
+            _E("Fail to get cookieManager");
             return;
         }
         ewk_cookie_manager_cookies_clear(cookieManager);
-    }
-    else if (!strcmp(name, IPCMessageSupport::TIZEN_CHANGE_USERAGENT))
-    {
+    } else if (!strcmp(name, IPCMessageSupport::TIZEN_CHANGE_USERAGENT)) {
         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);
-
-        LogDebug("Id: " << strId << ", Body:" << strBody);
+        _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));
 
-        LogDebug("get UA: " << ewk_view_user_agent_get(m_currentEwkView));
-
-        IPCMessageSupport::replyAsyncMessageToWebProcess(m_ewkContext, atoi(strId.c_str()), "success");
-
+        IPCMessageSupport::replyAsyncMessageToWebProcess(m_ewkContext,
+                                                         atoi(strId.c_str()),
+                                                         "success");
         return;
-    }
-    else if (!strcmp(name, IPCMessageSupport::TIZEN_DELETE_ALL_COOKIES))
-    {
+    } 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)
-        {
-            LogError("Fail to get cookieManager");
-            IPCMessageSupport::replyAsyncMessageToWebProcess(m_ewkContext, atoi(strId.c_str()), "error");
-
+        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");
-
+        IPCMessageSupport::replyAsyncMessageToWebProcess(m_ewkContext,
+                                                         atoi(strId.c_str()),
+                                                         "success");
         return;
+    } else if (!strcmp(name, IPCMessageSupport::TIZEN_EXIT) ||
+               !strcmp(name, IPCMessageSupport::TIZEN_HIDE))
+    {
+        bool ret = m_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");
     }
 }