Update unmerged source code
authorJihoon Chung <jihoon.chung@samsung.com>
Thu, 14 Mar 2013 01:49:55 +0000 (10:49 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Thu, 14 Mar 2013 01:50:20 +0000 (10:50 +0900)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Update unmerged source code
[SCMRequest] N/A

Change-Id: Id690cf1b265013778ba5f8d992cbc4b549a52fe0

src/view/webkit/bundles/wrt-wk2-bundle.cpp
src/view/webkit/view_logic.cpp
src/view/webkit/view_logic_utils.cpp [deleted file]
src/view/webkit/view_logic_utils.h [deleted file]
src/wrt-client/window_data.cpp
src/wrt-client/window_data.h
src/wrt-launchpad-daemon/launchpad_src/launchpad.c
src/wrt-launchpad-daemon/launchpad_src/util_x.c

index 055960b..aa3aa8f 100644 (file)
@@ -968,7 +968,7 @@ void Bundle::connectLoaderClientCallbacksToPage(WKBundlePageRef page)
     WKBundlePageLoaderClient loaderClient = {
         kWKBundlePageLoaderClientCurrentVersion,
         this, /* clientinfo */
-        didStartProvisionalLoadForFrameCallback, /* StartProvisionLoadForFrm */
+        didStartProvisionalLoadForFrameCallback, /* StartProvisionalLdForFrm */
         0, /* didReceiveServerRedirectForProvisionalLoadForFrame */
         0, /* didFailProvisionalLoadWithErrorForFrame */
         didCommitLoadForFrameCallback, /* didCommitLoadForFrame */
index 55d04c2..cabd818 100755 (executable)
@@ -66,9 +66,7 @@
 #include <js_overlay_types.h>
 #include <i_runnable_widget_object.h>
 #include <profiling_util.h>
-#include <wrt-commons/custom-handler-dao-ro/common_dao_types.h>
 #include <wrt-commons/custom-handler-dao-ro/CustomHandlerDatabase.h>
-#include <wrt-commons/custom-handler-dao-ro/custom_handler_dao_read_only.h>
 #include <wrt-commons/custom-handler-dao-rw/custom_handler_dao.h>
 #include <popup-runner/PopupInvoker.h>
 
@@ -530,7 +528,8 @@ void ViewLogic::ewkClientInit(Evas_Object *wkView)
 {
     Assert(NULL != wkView && "ewk_view not created at this point");
 
-    FOREACH(it, m_ewkCallbacksMap) {
+    FOREACH(it, m_ewkCallbacksMap)
+    {
         evas_object_smart_callback_add(
             wkView,
             it->first.c_str(),
@@ -549,7 +548,8 @@ void ViewLogic::ewkClientDeinit(Evas_Object *wkView)
     LogDebug("ewkClientDeinit");
     Assert(NULL != wkView && "ewk_view not created at this point");
 
-    FOREACH(it, m_ewkCallbacksMap) {
+    FOREACH(it, m_ewkCallbacksMap)
+    {
         evas_object_smart_callback_del(
             wkView,
             it->first.c_str(),
@@ -610,9 +610,9 @@ void ViewLogic::prepareEwkView(Evas_Object *wkView)
     Assert(wkView);
 
 #ifdef CSP_ENABLED
+    LogInfo("Setting CSP default policy");
     ewk_context_tizen_extensible_api_set(
         m_ewkContext, EWK_EXTENSIBLE_API_CSP, true);
-    LogInfo("Setting CSP default policy");
     // setting CSP policy rules
     ewk_view_content_security_policy_set(
         wkView,
@@ -1645,7 +1645,6 @@ void ViewLogic::protocolHandlerRegistrationCallback(void* data,
         if (customHandler->user_decision == CustomHandlerDB::Declined) {
             return;
         }
-        handlersDao.registerProtocolHandler(*(customHandler.get()));
         if (customHandler->user_decision & CustomHandlerDB::Agreed) {
             //TODO remove old default handler somehow from appsvc
             LogDebug("Registering appservice entry");
@@ -1657,8 +1656,12 @@ void ViewLogic::protocolHandlerRegistrationCallback(void* data,
                                                               TizenId).c_str());
             if (APPSVC_RET_OK != ret) {
                 LogWarning("Appsvc entry failed: " << ret);
+                //no database change
+                return;
             }
         }
+        handlersDao.registerProtocolHandler(*(customHandler.get()));
+
         LogDebug("Protocal saved");
     }
 
@@ -1683,16 +1686,16 @@ void ViewLogic::protocolHandlerIsRegisteredCallback(void* data,
     if (handler) {
         if (handler->user_decision & CustomHandlerDB::Agreed) {
             ewk_custom_handlers_data_result_set(
-                static_cast<Ewk_Custom_Handlers_Data*>(data),
+                static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
                 EWK_CUSTOM_HANDLERS_REGISTERED);
         } else {
             ewk_custom_handlers_data_result_set(
-                static_cast<Ewk_Custom_Handlers_Data*>(data),
+                static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
                 EWK_CUSTOM_HANDLERS_DECLINED);
         }
     } else {
         ewk_custom_handlers_data_result_set(
-            static_cast<Ewk_Custom_Handlers_Data*>(data),
+            static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
             EWK_CUSTOM_HANDLERS_NEW);
     }
     This->detachFromCustomHandlersDao();
@@ -1713,19 +1716,23 @@ void ViewLogic::protocolHandlerUnregistrationCallback(void* data,
         handlersDao.getProtocolHandler(customHandler->target,
                                        customHandler->url,
                                        customHandler->base_url);
+    This->detachFromCustomHandlersDao();
     if (handlerCheck) {
         if (handlerCheck->user_decision & CustomHandlerDB::Agreed) {
-            appsvc_unset_defapp(DPL::ToUTF8String(This->m_model->TizenId).c_str());
+            int ret = appsvc_unset_defapp(
+                    DPL::ToUTF8String(This->m_model->TizenId).c_str());
+            if (APPSVC_RET_OK != ret) {
+                LogWarning("Failed to unregister appsvc entry");
+                return;
+            }
         }
-
+        //if appsvc ok change custom_handlers_db
         handlersDao.unregisterProtocolHandler(customHandler->target,
                                               customHandler->url,
                                               customHandler->base_url);
     } else {
         LogDebug("Nothing to unregister");
     }
-
-    This->detachFromCustomHandlersDao();
 }
 
 void ViewLogic::contentHandlerRegistrationCallback(void* data,
@@ -1773,7 +1780,6 @@ void ViewLogic::contentHandlerRegistrationCallback(void* data,
         if (customHandler->user_decision == CustomHandlerDB::Declined) {
             return;
         }
-        handlersDao.registerContentHandler(*(customHandler.get()));
         if (customHandler->user_decision & CustomHandlerDB::Agreed) {
             //TODO remove old default handler somehow from appsvc
             LogDebug("Registering appservice entry");
@@ -1785,8 +1791,10 @@ void ViewLogic::contentHandlerRegistrationCallback(void* data,
                                                               TizenId).c_str());
             if (APPSVC_RET_OK != ret) {
                 LogWarning("Appsvc entry failed: " << ret);
+                return;
             }
         }
+        handlersDao.registerContentHandler(*(customHandler.get()));
         LogDebug("Content saved");
     }
     This->detachFromCustomHandlersDao();
@@ -1811,16 +1819,16 @@ void ViewLogic::contentHandlerIsRegisteredCallback(void* data,
     if (handler) {
         if (handler->user_decision & CustomHandlerDB::Agreed) {
             ewk_custom_handlers_data_result_set(
-                static_cast<Ewk_Custom_Handlers_Data*>(data),
+                static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
                 EWK_CUSTOM_HANDLERS_REGISTERED);
         } else {
             ewk_custom_handlers_data_result_set(
-                static_cast<Ewk_Custom_Handlers_Data*>(data),
+                static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
                 EWK_CUSTOM_HANDLERS_DECLINED);
         }
     } else {
         ewk_custom_handlers_data_result_set(
-            static_cast<Ewk_Custom_Handlers_Data*>(data),
+            static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
             EWK_CUSTOM_HANDLERS_NEW);
     }
     This->detachFromCustomHandlersDao();
@@ -1841,18 +1849,22 @@ void ViewLogic::contentHandlerUnregistrationCallback(void* data,
         handlersDao.getContentHandler(customHandler->target,
                                       customHandler->url,
                                       customHandler->base_url);
+    This->detachFromCustomHandlersDao();
     if (handlerCheck) {
         if (handlerCheck->user_decision & CustomHandlerDB::Agreed) {
-            appsvc_unset_defapp(DPL::ToUTF8String(This->m_model->TizenId).c_str());
+            int ret = appsvc_unset_defapp(
+                    DPL::ToUTF8String(This->m_model->TizenId).c_str());
+            if (APPSVC_RET_OK != ret) {
+                LogWarning("Failed to unregister mime handler from appsvc");
+                return;
+            }
         }
-
         handlersDao.unregisterContentHandler(customHandler->target,
                                              customHandler->url,
                                              customHandler->base_url);
     } else {
         LogDebug("Nothing to unregister");
     }
-    This->detachFromCustomHandlersDao();
 }
 
 void ViewLogic::didRunJavaScriptCallback(
diff --git a/src/view/webkit/view_logic_utils.cpp b/src/view/webkit/view_logic_utils.cpp
deleted file mode 100644 (file)
index df08cde..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-/**
- * @file    view_logic_utils.cpp
- * @author  Lukasz Marek (l.marek@samsung.com)
- * @brief   Implementation file of utils API used by ViewLogic
- */
-
-#include "view_logic_utils.h"
-
-namespace ViewModule {
-namespace Utils {
-DPL::OptionalString toString(WKStringRef str)
-{
-    if (WKStringIsEmpty(str)) {
-        return DPL::OptionalString::Null;
-    }
-    size_t size = WKStringGetMaximumUTF8CStringSize(str);
-    char buffer[size + 1];
-    WKStringGetUTF8CString(str, buffer, size + 1);
-    return DPL::FromUTF8String(buffer);
-}
-
-DPL::OptionalString toString(WKURLRef url)
-{
-    WKStringRef urlStr = WKURLCopyString(url);
-    DPL::OptionalString str = toString(urlStr);
-    WKRelease(urlStr);
-    return str;
-}
-
-DPL::OptionalString toString(WKURLRequestRef req)
-{
-    WKURLRef reqUrl = WKURLRequestCopyURL(req);
-    DPL::OptionalString str = toString(reqUrl);
-    WKRelease(reqUrl);
-    return str;
-}
-
-DPL::OptionalString toString(WKFrameRef req)
-{
-    WKURLRef reqUrl = WKFrameCopyURL(req);
-    DPL::OptionalString str = toString(reqUrl);
-    WKRelease(reqUrl);
-    return str;
-}
-
-DPL::OptionalString toString(WKErrorRef err)
-{
-    WKStringRef domErr = WKErrorCopyDomain(err);
-    WKStringRef desc = WKErrorCopyLocalizedDescription(err);
-    DPL::String str =
-        (WKStringIsEmpty(domErr) ? L"null" : *toString(domErr)) +
-        L"\n" +
-        (WKStringIsEmpty(desc) ? L"null" : *toString(desc));
-    WKRelease(domErr);
-    WKRelease(desc);
-    return str;
-}
-} // namespace Utils
-} // namespace ViewModule
diff --git a/src/view/webkit/view_logic_utils.h b/src/view/webkit/view_logic_utils.h
deleted file mode 100644 (file)
index 42be1ae..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-/**
- * @file    view_logic_utils.h
- * @author  Lukasz Marek (l.marek@samsung.com)
- * @brief   Header file of utils API used by ViewLogic
- */
-
-#ifndef VIEW_LOGIC_UTILS_H_
-#define VIEW_LOGIC_UTILS_H_
-
-#include <WebKit2.h>
-#include <dpl/string.h>
-#include <dpl/optional_typedefs.h>
-
-namespace ViewModule {
-namespace Utils {
-DPL::OptionalString toString(WKStringRef str);
-DPL::OptionalString toString(WKURLRef url);
-DPL::OptionalString toString(WKURLRequestRef req);
-DPL::OptionalString toString(WKFrameRef req);
-DPL::OptionalString toString(WKErrorRef err);
-} // namespace Utils
-} // namespace ViewModule
-
-#endif /* VIEW_LOGIC_UTILS_H_ */
index 9088532..dd64049 100644 (file)
@@ -32,6 +32,8 @@ char const* const ELM_STATE_SHOW_CONTENT = "elm,state,show,content";
 char const* const ELM_SWALLOW_CONTENT = "elm.swallow.content";
 char const* const ELM_SWALLOW_BACKWARD = "elm.swallow.backward";
 
+const char *ELM_EVENT_PROFILE_CHANGED = "profile,changed";
+
 char const* const ELM = "elm";
 char const* const LAYOUT = "layout";
 char const* const APPLICATION = "application";
@@ -39,6 +41,7 @@ char const* const INDICATOR = "indicator";
 char const* const NOINDICATOR = "noindicator";
 char const* const INTERNAL_LAYOUT = "internal_layout";
 char const* const FLOATBACKWARD_BUTTON_STYLE = "wrt/backward";
+const std::string DESKTOP_PROFILE("desktop");
 } // anonymous namespace
 
 WindowData::WindowData(unsigned long pid, bool manualInit) :
@@ -138,6 +141,10 @@ Evas_Object* WindowData::createWindow(unsigned long pid)
     ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
     evas_object_resize(window, w, h);
 
+    evas_object_smart_callback_add(window,
+                                   ELM_EVENT_PROFILE_CHANGED,
+                                   winProfileChangedCallback,
+                                   this);
     return window;
 }
 
@@ -213,12 +220,23 @@ Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
             layout,
             /* const char *item_style */
             NULL);
+    ADD_PROFILING_POINT("elm_naviframe_item_push", "stop");
 
     elm_naviframe_item_title_visible_set(naviIt, EINA_FALSE);
 
     return layout;
 }
 
+void WindowData::setDesktopIcon()
+{
+    // set window icon
+    Evas_Object *icon = evas_object_image_add(evas_object_evas_get(m_win));
+    evas_object_image_file_set(icon,
+                               "/opt/share/icons/default/small/tizenScmgz.png",
+                               NULL);
+    elm_win_icon_object_set(m_win, icon);
+}
+
 void WindowData::addNaviBackButtonCallback(
     const char* event,
     CallbackType callback,
@@ -301,3 +319,21 @@ void WindowData::toggleFullscreen(bool fullscreen)
 
     alreadyFullscreen = !alreadyFullscreen;
 }
+
+void WindowData::winProfileChangedCallback(void *data,
+                                           Evas_Object* /*obj*/,
+                                           void* /*eventInfo*/)
+{
+    LogDebug("winProfileChangedCallback");
+    if (data == NULL) {
+        return;
+    }
+    WindowData* This = static_cast<WindowData *>(data);
+    const char *profile = elm_config_profile_get();
+
+    if (DESKTOP_PROFILE == profile) {
+        elm_win_indicator_mode_set(This->m_win, ELM_WIN_INDICATOR_HIDE);
+        This->setDesktopIcon();
+    }
+}
+
index 389ca7c..8c656e9 100644 (file)
@@ -100,6 +100,9 @@ class WindowData : private DPL::Noncopyable
         bool backbutton);
 
     void toggleFullscreen(bool fullscreen);
+    static void winProfileChangedCallback(void *data,
+                                          Evas_Object * obj,
+                                          void *event_info);
 
   protected:
     Evas_Object* m_conformant;
@@ -118,6 +121,7 @@ class WindowData : private DPL::Noncopyable
     void alignProgressPosition();
     void toggleIndicator(bool fullscreen);
     void createFloatBackButton();
+    void setDesktopIcon();
 };
 
 #endif /* WINDOW_INITIALIZE_H_ */
index 484cc64..415519e 100644 (file)
@@ -58,6 +58,7 @@
 #define SQLITE_FLUSH_MAX        (1048576)       /* (1024*1024) */
 #define AUL_POLL_CNT            15
 #define AUL_PR_NAME                     16
+#define PKG_ID_LENGTH   11
 #define PATH_APP_ROOT "/opt/usr/apps"
 #define PATH_DATA "/data"
 #define SDK_CODE_COVERAGE "CODE_COVERAGE"
@@ -189,7 +190,11 @@ _static_ int __prepare_exec(const char *pkg_name,
     __set_oom();
 
     /* SET PRIVILEGES*/
-    if (__set_access(pkg_name, menu_info->pkg_type, app_path) < 0) {
+    char pkg_id[PKG_ID_LENGTH];
+    memset(pkg_id, '\0', PKG_ID_LENGTH);
+    snprintf(pkg_id, PKG_ID_LENGTH, "%s", pkg_name);
+
+    if (__set_access(pkg_id, menu_info->pkg_type, app_path) < 0) {
         _D("fail to set privileges - check your package's credential\n");
         return -1;
     }
index 0ab8f4f..678434c 100644 (file)
@@ -188,7 +188,9 @@ int x_util_get_default_size(double *w, double *h)
 
 static int __cb_x_error(Display* disp, XErrorEvent *ev)
 {
+    //warning unused parameter
     (void)disp;
+
     _E("X error received - Error Code = %d", ev->error_code);
     return 0;
 }