From 7bed62ba070fd6617f189d9133bc4a115f3f035e Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Thu, 14 Mar 2013 10:49:55 +0900 Subject: [PATCH] Update unmerged source code [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 | 2 +- src/view/webkit/view_logic.cpp | 52 +++++++++------ src/view/webkit/view_logic_utils.cpp | 74 ---------------------- src/view/webkit/view_logic_utils.h | 39 ------------ src/wrt-client/window_data.cpp | 36 +++++++++++ src/wrt-client/window_data.h | 4 ++ src/wrt-launchpad-daemon/launchpad_src/launchpad.c | 7 +- src/wrt-launchpad-daemon/launchpad_src/util_x.c | 2 + 8 files changed, 81 insertions(+), 135 deletions(-) delete mode 100644 src/view/webkit/view_logic_utils.cpp delete mode 100644 src/view/webkit/view_logic_utils.h diff --git a/src/view/webkit/bundles/wrt-wk2-bundle.cpp b/src/view/webkit/bundles/wrt-wk2-bundle.cpp index 055960b..aa3aa8f 100644 --- a/src/view/webkit/bundles/wrt-wk2-bundle.cpp +++ b/src/view/webkit/bundles/wrt-wk2-bundle.cpp @@ -968,7 +968,7 @@ void Bundle::connectLoaderClientCallbacksToPage(WKBundlePageRef page) WKBundlePageLoaderClient loaderClient = { kWKBundlePageLoaderClientCurrentVersion, this, /* clientinfo */ - didStartProvisionalLoadForFrameCallback, /* StartProvisionLoadForFrm */ + didStartProvisionalLoadForFrameCallback, /* StartProvisionalLdForFrm */ 0, /* didReceiveServerRedirectForProvisionalLoadForFrame */ 0, /* didFailProvisionalLoadWithErrorForFrame */ didCommitLoadForFrameCallback, /* didCommitLoadForFrame */ diff --git a/src/view/webkit/view_logic.cpp b/src/view/webkit/view_logic.cpp index 55d04c2..cabd818 100755 --- a/src/view/webkit/view_logic.cpp +++ b/src/view/webkit/view_logic.cpp @@ -66,9 +66,7 @@ #include #include #include -#include #include -#include #include #include @@ -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(data), + static_cast(eventInfo), EWK_CUSTOM_HANDLERS_REGISTERED); } else { ewk_custom_handlers_data_result_set( - static_cast(data), + static_cast(eventInfo), EWK_CUSTOM_HANDLERS_DECLINED); } } else { ewk_custom_handlers_data_result_set( - static_cast(data), + static_cast(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(data), + static_cast(eventInfo), EWK_CUSTOM_HANDLERS_REGISTERED); } else { ewk_custom_handlers_data_result_set( - static_cast(data), + static_cast(eventInfo), EWK_CUSTOM_HANDLERS_DECLINED); } } else { ewk_custom_handlers_data_result_set( - static_cast(data), + static_cast(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 index df08cde..0000000 --- a/src/view/webkit/view_logic_utils.cpp +++ /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 index 42be1ae..0000000 --- a/src/view/webkit/view_logic_utils.h +++ /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 -#include -#include - -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_ */ diff --git a/src/wrt-client/window_data.cpp b/src/wrt-client/window_data.cpp index 9088532..dd64049 100644 --- a/src/wrt-client/window_data.cpp +++ b/src/wrt-client/window_data.cpp @@ -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(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(); + } +} + diff --git a/src/wrt-client/window_data.h b/src/wrt-client/window_data.h index 389ca7c..8c656e9 100644 --- a/src/wrt-client/window_data.h +++ b/src/wrt-client/window_data.h @@ -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_ */ diff --git a/src/wrt-launchpad-daemon/launchpad_src/launchpad.c b/src/wrt-launchpad-daemon/launchpad_src/launchpad.c index 484cc64..415519e 100644 --- a/src/wrt-launchpad-daemon/launchpad_src/launchpad.c +++ b/src/wrt-launchpad-daemon/launchpad_src/launchpad.c @@ -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; } diff --git a/src/wrt-launchpad-daemon/launchpad_src/util_x.c b/src/wrt-launchpad-daemon/launchpad_src/util_x.c index 0ab8f4f..678434c 100644 --- a/src/wrt-launchpad-daemon/launchpad_src/util_x.c +++ b/src/wrt-launchpad-daemon/launchpad_src/util_x.c @@ -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; } -- 2.7.4