#git:framework/web/wrt
Name: wrt
Summary: web runtime
-Version: 0.8.227
+Version: 0.8.229
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
BuildRequires: pkgconfig(ewebkit2)
BuildRequires: pkgconfig(appcore-efl)
BuildRequires: pkgconfig(openssl)
-BuildRequires: pkgconfig(cert-svc)
BuildRequires: pkgconfig(dpl-efl)
BuildRequires: pkgconfig(libpcrecpp)
BuildRequires: pkgconfig(ecore)
BuildRequires: pkgconfig(pkgmgr)
BuildRequires: pkgconfig(libiri)
BuildRequires: pkgconfig(appsvc)
+BuildRequires: pkgconfig(cert-svc)
BuildRequires: pkgconfig(cert-svc-vcore)
BuildRequires: pkgconfig(libsoup-2.4)
BuildRequires: pkgconfig(security-core)
BuildRequires: pkgconfig(sysman)
BuildRequires: pkgconfig(app2sd)
BuildRequires: pkgconfig(capi-system-system-settings)
+BuildRequires: pkgconfig(libsmack)
BuildRequires: libss-client-devel
BuildRequires: gettext
BuildRequires: edje-tools
# @version 1.0
#
+# "smack-labeling-support-static" static library -------------------------------
+SET(SMACK_LABELING_SUPPORT_STATIC "smack-labeling-support-static")
+PKG_CHECK_MODULES(SMACK_LABELING_SUPPORT_DEPS
+ dpl-efl
+ libsmack
+ REQUIRED
+)
+SET(SMACK_LABELING_SUPPORT_SOURCES
+ ${PROJECT_SOURCE_DIR}/src/wrt-client/process_pool/smack_labeling_support.cpp
+ )
+SET(SMACK_LABELING_SUPPORT_INCLUDES
+ ${PROJECT_SOURCE_DIR}/src/wrt-client/process_pool/
+ )
+INCLUDE_DIRECTORIES(
+ ${SMACK_LABELING_SUPPORT_INCLUDES}
+ ${SMACK_LABELING_SUPPORT_DEPS_INCLUDE_DIRS}
+ )
+ADD_LIBRARY(${SMACK_LABELING_SUPPORT_STATIC} STATIC
+ ${SMACK_LABELING_SUPPORT_SOURCES}
+ )
+TARGET_LINK_LIBRARIES(${SMACK_LABELING_SUPPORT_STATIC}
+ ${SMACK_LABELING_SUPPORT_DEPS_LIBRARIES}
+ )
+# ------------------------------------------------------------------------------
+
#it is here, so no INCLUDE_DIRS and DEFINITIONS are passed there
ADD_SUBDIRECTORY(view)
-
SET(WRT_SRC_DIR
${PROJECT_SOURCE_DIR}/src
)
PKG_CHECK_MODULES(SYS_CORE_MODULE_DEP
ewebkit2
libprivilege-control
+ cert-svc
REQUIRED
)
*/
#include <string>
+#include <cert-service.h>
#include <vconf.h>
#include <ewk_context.h>
#include <dpl/log/log.h>
namespace WRT {
static const std::string bundlePath("/usr/lib/libwrt-injected-bundle.so");
-static const std::string caCertPath("/opt/usr/share/certs/ca-certificate.crt");
EwkContextManager::EwkContextManager(
const std::string& tizenAppId,
setNetworkProxy();
LogInfo("ewk_context_certificate_file_set() was called.");
- ewk_context_certificate_file_set(m_ewkContext, caCertPath.c_str());
+ const char* caCertPath = cert_svc_get_certificate_crt_file_path();
+ if (caCertPath) {
+ ewk_context_certificate_file_set(m_ewkContext, caCertPath);
+ } else {
+ LogError("cert path is null");
+ }
// set local stroage database path
WrtDB::WidgetDAOReadOnly dao(DPL::FromUTF8String(m_appId));
m_ewkContext,
dao.getPrivateLocalStoragePath().c_str());
- // memory saving mode
- //ewk_context_memory_saving_mode_set(
- // m_ewkContext,
- // static_cast<WrtDB::SettingsType>(result) ==
- // WrtDB::SETTINGS_TYPE_ON ? EINA_TRUE : EINA_FALSE);
-
ewk_context_tizen_extensible_api_set(
m_ewkContext,
EWK_EXTENSIBLE_API_MEDIA_STREAM_RECORD,
void* clientInfo)
{
LogDebug("enter");
- LogDebug("did recive message: " << name);
EwkContextManager* This = static_cast<EwkContextManager*>(clientInfo);
if (returnData) {
void EwkContextManager::didStartDownloadCallback(const char* downloadUrl, void* data)
{
LogDebug("enter");
- LogDebug("download url: " << downloadUrl);
EwkContextManager* This = static_cast<EwkContextManager*>(data);
This->m_view->downloadData(downloadUrl);
{
if (path == NULL) {
LogError("Wrong input path");
+ return 0;
}
LogDebug(path);
std::string inputPath = path;
)
ADD_DEFINITIONS(${INJECTED_BUNDLE_DEP_CFLAGS})
-INCLUDE_DIRECTORIES(${INJECTED_BUNDLE_INCLUDES})
+INCLUDE_DIRECTORIES(
+ ${INJECTED_BUNDLE_INCLUDES}
+ ${SMACK_LABELING_SUPPORT_INCLUDES}
+ )
ADD_LIBRARY(${TARGET_INJECTED_BUNDLE_LIB} SHARED
${INJECTED_BUNDLE_SOURCES}
${TARGET_WRT_ENGINE_STATIC}
${TARGET_PLUGIN_MODULE_LIB}
${PROF_LIB}
+ ${SMACK_LABELING_SUPPORT_STATIC}
)
# for encryption
bool checkWhitelist(const char *url)
{
- LogInfo("Check WhiteList");
+ LogInfo("Check WhiteList for uri: " << url);
if (url == NULL) {
return true;
}
return true;
}
-bool processURIForPlugin(const char* url)
+bool processURIForPlugin(const char* url, const DPL::String &tizenId)
{
if (!checkWhitelist(url)) {
return false;
}
+ DPL::OptionalString found =
+ W3CFileLocalization::getFilePathInWidgetPackageFromUrl(
+ tizenId,
+ DPL::FromUTF8String(std::string(url)));
+ if (found.IsNull()) {
+ LogDebug("Path not found within current locale in current widget");
+ return false;
+ }
+
return true;
}
bool processMainResource(const DPL::String& inputURI,
const DPL::String& tizenId,
WrtDB::WidgetSecurityModelVersion m_securityModelVersion);
-bool processURIForPlugin(const char* url);
+bool processURIForPlugin(const char* url, const DPL::String &tizenId);
DPL::OptionalString localizeURI(const DPL::String& inputURI,
const DPL::String& tizenId);
std::string localizeURI(const std::string& inputURI, const std::string& tizenId);
#include <sys/resource.h>
#include <privilege-control.h>
+#include <smack_labeling_support.h>
// URI localization on WebProcess side
#include "injected_bundle_uri_handling.h"
GetUserWidgetExecPath() + "/" + tzAppId;
}
+ LogDebug("set_app_smack_label(" << appPath << ")");
+ if (set_app_smack_label(appPath.c_str()) != 0)
+ {
+ LogError("set_app_smack_label() failed");
+ }
+
LogDebug("set_app_privilege(" << appPath << ")");
set_app_privilege(tzPkgId.c_str(), PRIVILEGE_APP_TYPE, appPath.c_str());
}
}
std::string urlStr = toString(url);
- if (InjectedBundleURIHandling::processURIForPlugin(urlStr.c_str())) {
+ if (InjectedBundleURIHandling::processURIForPlugin(urlStr.c_str(),
+ This->m_widgetTizenId))
+ {
LogDebug("start plugin");
if(This->m_pageGlobalContext.find(page) != This->m_pageGlobalContext.end())
{
{ "mediacontrol,rotate,vertical",
&ViewLogic::mediacontrolRotateVertical },
{ "mediacontrol,rotate,exit",
- &ViewLogic::mediacontrolRotateExit }
+ &ViewLogic::mediacontrolRotateExit },
+ { "popup,reply,wait,start",
+ &ViewLogic::popupReplyWaitStart },
+ { "popup,reply,wait,finish",
+ &ViewLogic::popupReplyWaitFinish },
};
ViewLogic::ViewLogic() :
m_deferredRotateAngle(
ViewModule::OrientationSupport::DEFERRED_ORIENTATION_EMPTY),
m_orientationThresholdTimer(NULL),
+ m_isPopupReplyWait(false),
m_appsSupport(new ViewModule::AppsSupport()),
m_vibrationSupport(new ViewModule::VibrationSupport())
{
}
}
- evas_object_focus_set(m_currentEwkView, EINA_FALSE);
-
// call user callback
if (!m_cbs->suspend.empty()) {
m_cbs->suspend(true);
* elm_win_raise(m_window);
* }
*/
- evas_object_focus_set(m_currentEwkView, EINA_TRUE);
// call user callback
if (!m_cbs->resume.empty()) {
{
LogInfo("Resetting Widget");
- // destory all webview
- while (!m_ewkViewList.empty()) {
- LogInfo("pop webview: " << m_ewkViewList.back());
- removeEwkView(m_ewkViewList.back());
- }
- m_ewkViewList.clear();
+ // 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);
- // create new webview
- createEwkView(evas_object_evas_get(m_window));
- ewkClientInit(m_currentEwkView);
- prepareEwkView(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()) {
+ LogInfo("pop webview: " << m_ewkViewList.back());
+ removeEwkView(m_ewkViewList.back());
+ }
+ m_ewkViewList.clear();
- // check if current url is service url for this tizen service
- std::string url =
- ViewModule::UriSupport::getUri(m_model, m_startUrl);
+ // create new webview
+ createEwkView(evas_object_evas_get(m_window));
+ ewkClientInit(m_currentEwkView);
+ prepareEwkView(m_currentEwkView);
- initializePluginLoading();
+ // check if current url is service url for this tizen service
+ std::string url =
+ ViewModule::UriSupport::getUri(m_model, m_startUrl);
- // webview activated
- ewk_view_url_set(m_currentEwkView, url.c_str());
- elm_win_activate(m_window);
- evas_object_focus_set(m_currentEwkView, EINA_TRUE);
+ 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);
+ // call user callback
+ if (!m_cbs->reset.empty()) {
+ m_cbs->reset(true);
+ }
+ if (!m_cbs->bufferSet.empty()) {
+ m_cbs->bufferSet(m_currentEwkView);
+ }
}
}
LogDebug("loadFinishedCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
- evas_object_focus_set(This->m_currentEwkView, EINA_TRUE);
// Fill id/password
const char* url = ewk_view_url_get(This->m_currentEwkView);
return ECORE_CALLBACK_CANCEL;
}
+void ViewLogic::popupReplyWaitStart(void* data,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
+{
+ LogInfo("called");
+ Assert(data);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ This->m_isPopupReplyWait = true;
+}
+
+void ViewLogic::popupReplyWaitFinish(void* data,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
+{
+ LogInfo("called");
+ Assert(data);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ This->m_isPopupReplyWait = false;
+}
+
void ViewLogic::requestUrlBlocked(const std::string& blockedUrl)
{
LogInfo("enter");
static void mediacontrolRotateExit(void* data,
Evas_Object* obj,
void* eventInfo);
+ static void popupReplyWaitStart(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void popupReplyWaitFinish(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
static int appServiceCallerIsKilled(void *data);
int m_rotateAngle;
int m_deferredRotateAngle;
Ecore_Timer* m_orientationThresholdTimer;
+ bool m_isPopupReplyWait;
std::unique_ptr<SchemeSupport> m_schemeSupport;
std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
${PROJECT_SOURCE_DIR}/src/api_new
${PROJECT_SOURCE_DIR}/src/wrt-launchpad-daemon/include
${CLIENT_DEP_INCLUDE_DIRS}
+ ${SMACK_LABELING_SUPPORT_INCLUDES}
)
ADD_EXECUTABLE(${TARGET_WRT_CLIENT}
TARGET_LINK_LIBRARIES(${TARGET_WRT_CLIENT}
${CLIENT_DEP_LIBRARIES}
${TARGET_CORE_MODULE_LIB}
+ ${SMACK_LABELING_SUPPORT_STATIC}
"-pie"
)
--- /dev/null
+/*
+ * Copyright (c) 2013 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 smack_labeling_support.cpp
+ * @author Tae-Jeong Lee (taejeong.lee@samsung.com)
+ * @version 0.1
+ * @brief API to support smack labeling for whole threads in a process.
+ */
+
+#include "smack_labeling_support.h"
+
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/smack.h>
+#include <dirent.h>
+#include <assert.h>
+#include <dpl/log/log.h>
+
+#define SMACK_LABEL_LEN 255
+#define FILE_MAX_LEN 1024
+#define MAX_RETRY_CNT 1000
+#define UID_ROOT 0
+
+static char s_smack_label[SMACK_LABEL_LEN + 1] = {0,};
+static int s_waiting_task_cnt = 0;
+
+static int smack_set_label_for_tid(const char *label)
+{
+ int len, fd, ret;
+ char curren_path[FILE_MAX_LEN + 1] = {0,};
+
+ len = strnlen(label, SMACK_LABEL_LEN + 1);
+
+ if (len > SMACK_LABEL_LEN)
+ {
+ return -1;
+ }
+
+ snprintf(curren_path, sizeof(curren_path), "/proc/%d/attr/current", (int)syscall(__NR_gettid));
+
+ fd = open(curren_path, O_WRONLY);
+
+ if (fd < 0)
+ {
+ return -1;
+ }
+
+ ret = write(fd, label, len);
+ close(fd);
+
+ return (ret < 0) ? -1 : 0;
+}
+
+static void SIGUSR1_handler(int /*signo*/)
+{
+ if (smack_set_label_for_tid(s_smack_label) != 0)
+ {
+ LogError("## [tid:" << syscall(__NR_gettid) << "] smack_set_label_for_tid() failed! ##");
+ }
+ s_waiting_task_cnt--;
+}
+
+static int set_SIGUSR1_handler()
+{
+ if (signal(SIGUSR1, SIGUSR1_handler) == SIG_ERR)
+ {
+ LogError("## signal(SIGUSR1, SIGUSR1_handler) failed! ##");
+ return -1;
+ }
+
+ return 0;
+}
+
+static int set_SIGUSR1_to_default()
+{
+ if (signal(SIGUSR1, SIG_DFL) == SIG_ERR)
+ {
+ LogError("## signal(SIGUSR1, SIG_ERR) failed! ##");
+ return -1;
+ }
+
+ return 0;
+}
+
+static int send_SIGUSR1_to_threads()
+{
+ int ret;
+ DIR *dir;
+ struct dirent entry, *result;
+ char proc_self_task_path[FILE_MAX_LEN + 1] = {0, };
+
+ sprintf(proc_self_task_path, "/proc/self/task");
+
+ dir = opendir(proc_self_task_path);
+
+ if (dir)
+ {
+ for (ret = readdir_r(dir, &entry, &result);
+ result != NULL && ret == 0;
+ ret = readdir_r(dir, &entry, &result))
+ {
+ if (strncmp(entry.d_name, ".", 2) == 0 ||
+ strncmp(entry.d_name, "..", 3) == 0)
+ {
+ continue;
+ }
+
+ s_waiting_task_cnt++;
+ if (syscall(__NR_tkill, atoi(entry.d_name), SIGUSR1) != 0)
+ {
+ LogError("## tkill(" << atoi(entry.d_name) << "SIGUSR1) failed! ##");
+ s_waiting_task_cnt--;
+ }
+ }
+
+ closedir(dir);
+ }
+ else
+ {
+ LogError("## opendir(\"/proc/self/task\") failed! ##");
+ return -1;
+ }
+
+ return 0;
+}
+
+int set_app_smack_label(const char* app_path)
+{
+ assert(s_waiting_task_cnt == 0);
+
+ if (UID_ROOT != getuid() || app_path == NULL)
+ {
+ LogError("## parameter error! ##");
+ return -1;
+ }
+
+ // set SIGUSR1 signal handler
+ if (set_SIGUSR1_handler() != 0)
+ {
+ return -1;
+ }
+
+ // get smack label from app_path
+ char *smack_label = NULL;
+
+ if (smack_lgetlabel(app_path, &smack_label, SMACK_LABEL_EXEC) != 0)
+ {
+ LogError("## smack_lgetlabel() failed! ##");
+ goto err_set_app_smack_label;
+ }
+
+ strncpy(s_smack_label, smack_label, sizeof(s_smack_label));
+
+ if (send_SIGUSR1_to_threads() != 0)
+ {
+ LogError("## send_SIGUSR1_to_threads() timeout! ##");
+ goto err_set_app_smack_label;
+ }
+
+ // wait for labeling on each tasks
+ int i;
+
+ for (i=0; s_waiting_task_cnt && i < MAX_RETRY_CNT; i++)
+ {
+ usleep(100); // 0.1ms
+ }
+
+ if (i == MAX_RETRY_CNT)
+ {
+ LogError("## set_app_smack_label() timeout! ##");
+ }
+
+ // set SIGUSR1 signal defualt handler
+ set_SIGUSR1_to_default();
+
+ return 0;
+
+err_set_app_smack_label:
+ s_waiting_task_cnt = 0;
+ set_SIGUSR1_to_default();
+
+ return -1;
+}
+
+
--- /dev/null
+/*
+ * Copyright (c) 2013 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 smack_labeling_support.h
+ * @author Tae-Jeong Lee (taejeong.lee@samsung.com)
+ * @version 0.1
+ * @brief API to support smack labeling for whole threads in a process.
+ */
+
+#ifndef SMACK_LABELING_SUPPORT_H
+#define SMACK_LABELING_SUPPORT_H
+
+int set_app_smack_label(const char* app_path);
+
+#endif // SMACK_LABELING_SUPPORT_H
evas_object_show(m_navigation);
m_user_layout = createUserLayout(m_navigation);
evas_object_show(m_user_layout);
+ m_focus = createFocus(m_user_layout);
+ evas_object_show(m_focus);
m_progressbar = createProgressBar(m_win, m_user_layout);
evas_object_show(m_progressbar);
m_initialized = true;
}
-void WindowData::setEvasObjectForLayout(Evas_Object* evas_object)
+void WindowData::setEvasObjectForLayout(Evas_Object* obj)
{
- elm_object_content_set(m_conformant, evas_object);
+ elm_object_part_content_set(m_focus, ELM_SWALLOW_CONTENT, obj);
+ elm_object_focus_set(m_focus, EINA_TRUE);
}
void WindowData::unsetEvasObjectForLayout()
{
- elm_object_content_unset(m_conformant);
+ elm_object_part_content_unset(m_focus, ELM_SWALLOW_CONTENT);
}
void WindowData::toggleIndicator(bool fullscreen)
NULL);
ADD_PROFILING_POINT("elm_naviframe_item_push", "stop");
elm_naviframe_item_title_visible_set(naviIt, EINA_FALSE);
-
return layout;
}
+Evas_Object* WindowData::createFocus(Evas_Object* parent)
+{
+ Assert(parent != NULL && "Parent for Focus is null");
+ // ewkview isn't elementary widget style. This is reason why ewkview focus
+ // doesn't restore after focus-out and focus-in. To support focus restore
+ // for ewkview, WRT add selectable elementary(button) to manage focus
+ Evas_Object* focus = elm_button_add(parent);
+ elm_object_style_set(focus, "focus");
+ elm_object_part_content_set(parent, ELM_SWALLOW_CONTENT, focus);
+ evas_object_size_hint_weight_set(focus,
+ EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(focus, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ return focus;
+}
+
Evas_Object* WindowData::createProgressBar(Evas_Object* window, Evas_Object* parent)
{
Assert(parent != NULL && "Parent is null");
return evas_object_event_callback_del(m_user_layout, event, callBack);
}
+void WindowData::focusCallbackAdd(
+ const char* event,
+ CallbackType callback,
+ const void* data)
+{
+ Assert(m_focus != NULL && "m_focus is null");
+ evas_object_smart_callback_add(m_focus, event, callback, data);
+}
+
+void* WindowData::focusCallbackDel(
+ const char* event,
+ CallbackType callback)
+{
+ Assert(m_focus != NULL && "m_focus is null");
+ return evas_object_smart_callback_del(m_focus, event, callback);
+}
+
void WindowData::emitSignalForUserLayout(
const char* emission, const char* source)
{
void* userlayoutCallbackDel(
const Evas_Callback_Type event,
EvasCallbackType callback);
+ void focusCallbackAdd(
+ const char* event,
+ CallbackType callback,
+ const void* data);
+ void* focusCallbackDel(
+ const char* event,
+ CallbackType callback);
void emitSignalForUserLayout(
const char* emission,
const char* source);
Evas_Object* m_conformant;
Evas_Object* m_platform_layout;
Evas_Object* m_navigation;
+ Evas_Object* m_focus;
Evas_Object* m_floatBackButton;
Evas_Object* m_progressbar;
Evas_Object* m_ctxpopup;
Evas_Object* createPlatformLayout(Evas_Object* parent);
Evas_Object* createNavigationBar(Evas_Object* parent);
Evas_Object* createUserLayout(Evas_Object* parent);
+ Evas_Object* createFocus(Evas_Object* parent);
Evas_Object* createProgressBar(Evas_Object* window, Evas_Object* parent);
Evas_Object* createCtxPopup(Evas_Object* parent);
#include <vconf.h>
#include "auto_rotation_support.h"
-#include "process_pool.h"
-#include "menu_db_util.h"
-#include "launchpad_util.h"
+#include <process_pool.h>
+#include <process_pool_launchpad_util.h>
#include <appsvc.h>
#include "client_service_support.h"
const std::string VIEWMODE_TYPE_WINDOWED = "windowed";
char const* const ELM_SWALLOW_CONTENT = "elm.swallow.content";
const char* const BUNDLE_PATH = "/usr/lib/libwrt-injected-bundle.so";
-const char* const caCertPath = "/opt/usr/share/certs/ca-certificate.crt";
const char* const MESSAGE_NAME_INITIALIZE = "ToInjectedBundle::INIT";
// process pool
delete debug;
}
+void WrtClient::resetCallback(bool result)
+{
+ if (!result) {
+ LogDebug("Fail to handle reset event");
+ // free bundle data
+ ApplicationDataSingleton::Instance().freeBundle();
+ }
+}
+
void WrtClient::progressStartedCallback()
{
if (m_settingList->getProgressBarPresence() == ProgressBar_Enable ||
//you can't show window with splash screen before PrepareView
//ewk_view_add_with_context() in viewLogic breaks window
m_windowData->init();
+ m_windowData->focusCallbackAdd("focused", focusedCallback, this);
+ m_windowData->focusCallbackAdd("unfocused", unfocusedCallback, this);
WrtDB::WidgetLocalizedInfo localizedInfo =
W3CFileLocalization::getLocalizedInfo(m_dao);
cbs->progress = DPL::MakeDelegate(this, &WrtClient::loadProgressCallback);
cbs->progressFinish = DPL::MakeDelegate(this, &WrtClient::progressFinishCallback);
cbs->loadFinish = DPL::MakeDelegate(this, &WrtClient::loadFinishCallback);
+ cbs->reset = DPL::MakeDelegate(this, &WrtClient::resetCallback);
cbs->bufferSet = DPL::MakeDelegate(this, &WrtClient::setLayout);
cbs->bufferUnset = DPL::MakeDelegate(this, &WrtClient::unsetLayout);
cbs->webkitExit = DPL::MakeDelegate(this, &WrtClient::webkitExitCallback);
{
LogDebug("add new webkit buffer to window");
Assert(newBuffer);
-
- elm_object_part_content_set(m_windowData->m_user_layout,
- ELM_SWALLOW_CONTENT,
- newBuffer);
-
+ m_windowData->setEvasObjectForLayout(newBuffer);
evas_object_show(newBuffer);
}
LogDebug("remove current webkit buffer from window");
Assert(currentBuffer);
evas_object_hide(currentBuffer);
-
- elm_object_part_content_unset(m_windowData->m_user_layout,
- ELM_SWALLOW_CONTENT);
+ m_windowData->unsetEvasObjectForLayout();
}
void WrtClient::shutdownStep()
if (m_initialized) {
m_initialized = false;
}
+ m_windowData->focusCallbackDel("focused", focusedCallback);
+ m_windowData->focusCallbackDel("unfocused", unfocusedCallback);
m_windowData.reset();
Quit();
}
This->autoRotationSetOrientation(obj);
}
+void WrtClient::focusedCallback(void* data,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
+{
+ LogInfo("entered");
+ Assert(data);
+ WrtClient* This = static_cast<WrtClient*>(data);
+ elm_object_focus_set(This->m_widget->GetCurrentWebview(), EINA_TRUE);
+}
+
+void WrtClient::unfocusedCallback(void* data,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
+{
+ LogInfo("entered");
+ Assert(data);
+ WrtClient* This = static_cast<WrtClient*>(data);
+ elm_object_focus_set(This->m_widget->GetCurrentWebview(), EINA_FALSE);
+}
+
void WrtClient::autoRotationSetOrientation(Evas_Object* obj)
{
LogInfo("entered");
ecore_main_fd_handler_del(handler);
- __wrt_launchpad_main_loop(pkt, app_argv[0], &app_argc, &app_argv);
+ process_pool_launchpad_main_loop(pkt, app_argv[0], &app_argc, &app_argv);
free(pkt);
}
s_preparedEwkContext,
MESSAGE_NAME_INITIALIZE,
tizenId.c_str());
+
}
else
{
static int appcoreLowMemoryCallback(void* data);
static int languageChangedCallback(void *data);
static void autoRotationCallback(void* data, Evas_Object* obj, void* event);
+ static void focusedCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void unfocusedCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
//view-mode
void setInitialViewMode();
void launchStep();
void shutdownStep();
void loadFinishCallback(Evas_Object* webview);
+ void resetCallback(bool result);
void progressStartedCallback();
void loadProgressCallback(Evas_Object* webview, double value);
void progressFinishCallback();
_static_ void __modify_bundle(bundle * kb, int caller_pid, app_info_from_db * menu_info, int cmd);
_static_ void __set_oom();
_static_ void __set_env(app_info_from_db * menu_info, bundle * kb);
-_static_ int __wrt_prepare_exec(const char *pkg_name, const char *app_path, app_info_from_db * menu_info, bundle * kb);
-_static_ void __wrt_launchpad_main_loop(app_pkt_t* pkt, char* out_app_path, int* out_argc, char ***out_argv);
// Implementation
-
_static_ char** __create_argc_argv(bundle * kb, int *margc)
{
char **argv;
}
}
-_static_ int __wrt_prepare_exec(const char *pkg_name,
- const char *app_path, app_info_from_db * menu_info,
- bundle * kb)
-{
- const char *file_name;
- char process_name[WRT_AUL_PR_NAME];
-
- /* SET PRIVILEGES*/
- 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;
- }
-
- /* SET PROCESS NAME*/
- if (app_path == NULL) {
- _D("app_path should not be NULL - check menu db");
- return -1;
- }
- file_name = strrchr(app_path, '/') + 1;
- if (file_name == NULL) {
- _D("can't locate file name to execute");
- return -1;
- }
- memset(process_name, '\0', WRT_AUL_PR_NAME);
- snprintf(process_name, WRT_AUL_PR_NAME, "%s", file_name);
- prctl(PR_SET_NAME, process_name);
-
- /* SET ENVIROMENT*/
- __set_env(menu_info, kb);
-
- return 0;
-}
-
-_static_ void __wrt_launchpad_main_loop(app_pkt_t* pkt, char* out_app_path, int* out_argc, char ***out_argv)
-
-{
- bundle *kb = NULL;
- app_info_from_db *menu_info = NULL;
-
- const char *pkg_name = NULL;
- const char *app_path = NULL;
-
- kb = bundle_decode(pkt->data, pkt->len);
- if (!kb) {
- _E("bundle decode error");
- exit(-1);
- }
-
- pkg_name = bundle_get_val(kb, AUL_K_PKG_NAME);
- SECURE_LOGD("pkg name : %s", pkg_name);
-
- menu_info = _get_app_info_from_bundle_by_pkgname(pkg_name, kb);
- if (menu_info == NULL) {
- _D("such pkg no found");
- exit(-1);
- }
-
- app_path = _get_app_path(menu_info);
-
- if (app_path == NULL) {
- _E("app_path is NULL");
- exit(-1);
- }
-
- if (app_path[0] != '/') {
- _E("app_path is not absolute path");
- exit(-1);
- }
-
- __modify_bundle(kb, /*cr.pid - unused parameter*/ 0, menu_info, pkt->cmd);
- pkg_name = _get_pkgname(menu_info);
- SECURE_LOGD("pkg name : %s", pkg_name);
-
- __wrt_prepare_exec(pkg_name, app_path, menu_info, kb);
-
- if (out_app_path != NULL && out_argc != NULL && out_argv != NULL)
- {
- int i;
-
- sprintf(out_app_path, "%s", app_path);
-
- *out_argv = __create_argc_argv(kb, out_argc);
- (*out_argv)[0] = out_app_path;
-
- for (i = 0; i < *out_argc; i++)
- {
- _D("input argument %d : %s##", i, (*out_argv)[i]);
- }
- }
- else
- {
- exit(-1);
- }
-
-
-#if 0 // intentional
- if (menu_info != NULL) {
- _free_app_info_from_db(menu_info);
- }
-
- if (kb != NULL) {
- bundle_free(kb);
- }
-#endif
-}
-
#endif // __LAUNCHPAD_UTIL_H_
--- /dev/null
+/*
+ * Copyright (c) 2013 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 process_pool_launchpad_util.h
+ * @author Tae-Jeong Lee (taejeong.lee@samsung.com)
+ * @version 0.1
+ * @brief Api library to support launchpad operation.
+ */
+
+#ifndef __PROCESS_POOL_LAUNCHPAD_UTIL_H_
+#define __PROCESS_POOL_LAUNCHPAD_UTIL_H_
+
+#include <launchpad_util.h>
+#include <smack_labeling_support.h>
+
+// Prototype
+_static_ int __process_pool_prepare_exec(const char *pkg_name, const char *app_path, app_info_from_db * menu_info, bundle * kb);
+_static_ void process_pool_launchpad_main_loop(app_pkt_t* pkt, char* out_app_path, int* out_argc, char ***out_argv);
+
+// Implementation
+_static_ int __process_pool_prepare_exec(const char *pkg_name,
+ const char *app_path, app_info_from_db * menu_info,
+ bundle * kb)
+{
+ const char *file_name;
+ char process_name[WRT_AUL_PR_NAME];
+
+ /* SET PRIVILEGES*/
+ char pkg_id[PKG_ID_LENGTH];
+ memset(pkg_id, '\0', PKG_ID_LENGTH);
+ snprintf(pkg_id, PKG_ID_LENGTH, "%s", pkg_name);
+
+ if (set_app_smack_label(app_path) != 0)
+ {
+ _E("set_app_smack_label() failed");
+ }
+
+ 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;
+ }
+
+ /* SET PROCESS NAME*/
+ if (app_path == NULL) {
+ _D("app_path should not be NULL - check menu db");
+ return -1;
+ }
+ file_name = strrchr(app_path, '/') + 1;
+ if (file_name == NULL) {
+ _D("can't locate file name to execute");
+ return -1;
+ }
+ memset(process_name, '\0', WRT_AUL_PR_NAME);
+ snprintf(process_name, WRT_AUL_PR_NAME, "%s", file_name);
+ prctl(PR_SET_NAME, process_name);
+
+ /* SET ENVIROMENT*/
+ __set_env(menu_info, kb);
+
+ return 0;
+}
+
+_static_ void process_pool_launchpad_main_loop(app_pkt_t* pkt, char* out_app_path, int* out_argc, char ***out_argv)
+
+{
+ bundle *kb = NULL;
+ app_info_from_db *menu_info = NULL;
+
+ const char *pkg_name = NULL;
+ const char *app_path = NULL;
+
+ kb = bundle_decode(pkt->data, pkt->len);
+ if (!kb) {
+ _E("bundle decode error");
+ exit(-1);
+ }
+
+ pkg_name = bundle_get_val(kb, AUL_K_PKG_NAME);
+ SECURE_LOGD("pkg name : %s", pkg_name);
+
+ menu_info = _get_app_info_from_bundle_by_pkgname(pkg_name, kb);
+ if (menu_info == NULL) {
+ _D("such pkg no found");
+ exit(-1);
+ }
+
+ app_path = _get_app_path(menu_info);
+
+ if (app_path == NULL) {
+ _E("app_path is NULL");
+ exit(-1);
+ }
+
+ if (app_path[0] != '/') {
+ _E("app_path is not absolute path");
+ exit(-1);
+ }
+
+ __modify_bundle(kb, /*cr.pid - unused parameter*/ 0, menu_info, pkt->cmd);
+ pkg_name = _get_pkgname(menu_info);
+ SECURE_LOGD("pkg name : %s", pkg_name);
+
+ __process_pool_prepare_exec(pkg_name, app_path, menu_info, kb);
+
+ if (out_app_path != NULL && out_argc != NULL && out_argv != NULL)
+ {
+ int i;
+
+ sprintf(out_app_path, "%s", app_path);
+
+ *out_argv = __create_argc_argv(kb, out_argc);
+ (*out_argv)[0] = out_app_path;
+
+ for (i = 0; i < *out_argc; i++)
+ {
+ _D("input argument %d : %s##", i, (*out_argv)[i]);
+ }
+ }
+ else
+ {
+ exit(-1);
+ }
+
+
+#if 0 // intentional
+ if (menu_info != NULL) {
+ _free_app_info_from_db(menu_info);
+ }
+
+ if (kb != NULL) {
+ bundle_free(kb);
+ }
+#endif
+}
+
+#endif // __PROCESS_POOL_LAUNCHPAD_UTIL_H_
\ No newline at end of file
static inline void __preload_init(int argc, char **argv)
{
- char soname[MAX_LOCAL_BUFSZ] = { 0, };
- FILE *preload_list;
- int (*func)() = NULL;
int i;
g_argc = argc;
-export WRT_PROCESS_POOL_DISABLE=ON
+#export WRT_PROCESS_POOL_DISABLE=ON
#export WRT_WILL_SEND_REQUEST_LOG_ENABLE=ON
#export WRT_LOAD_PLUGINS_LOG_ENABLE=ON