#include <dpl/localization/w3c_file_localization.h>
#include <dpl/localization/LanguageTagsProvider.h>
#include <popup-runner/PopupInvoker.h>
-#include <prepare_external_storage.h>
#include <vconf.h>
#include "auto_rotation_support.h"
#include "client_command_line_parser.h"
#include "client_ide_support.h"
+#include "client_security_support.h"
#include "client_service_support.h"
+#include "client_submode_support.h"
//W3C PACKAGING enviroment variable name
#define W3C_DEBUG_ENV_VARIABLE "DEBUG_LOAD_FINISH"
const std::string VIEWMODE_TYPE_MAXIMIZED = "maximized";
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 BUNDLE_PATH = LIBDIR_PREFIX "/usr/lib/libwrt-injected-bundle.so";
const char* const MESSAGE_NAME_INITIALIZE = "ToInjectedBundle::INIT";
+const unsigned int UID_ROOT = 0;
// process pool
const char* const DUMMY_PROCESS_PATH = "/usr/bin/wrt_launchpad_daemon_candidate";
WrtClient::WrtClient(int argc, char **argv) :
Application(argc, argv, "wrt-client", false),
DPL::TaskDecl<WrtClient>(this),
- m_appControlIndex(DPL::OptionalUInt()),
m_launched(false),
m_initializing(false),
m_initialized(false),
m_initialViewMode(VIEWMODE_TYPE_MAXIMIZED),
m_currentViewMode(VIEWMODE_TYPE_MAXIMIZED),
m_isWebkitFullscreen(false),
- m_isFullscreenByPlatform(false)
+ m_isFullscreenByPlatform(false),
+ m_submodeSupport(new ClientModule::SubmodeSupport())
{
Touch();
LogDebug("App Created");
LogWarning("Widget is not running to be suspended");
return;
}
+ if (m_submodeSupport->isNeedTerminateOnSuspend()) {
+ LogDebug("Current mode cannot support suspend");
+ elm_exit();
+ return;
+ }
m_widget->Suspend();
m_widgetState = WidgetState_Suspended;
}
if (m_tizenId.empty()) {
showHelpAndQuit();
} else {
- m_appControlIndex =
- ClientModule::CommandLineParser::getAppControlIndex(m_argc,
- m_argv);
setDebugMode(b);
setStep();
}
ADD_PROFILING_POINT("getRunnableWidgetObject", "start");
m_widget = WRT::CoreModuleSingleton::Instance()
- .getRunnableWidgetObject(m_tizenId, m_appControlIndex);
+ .getRunnableWidgetObject(m_tizenId);
ADD_PROFILING_POINT("getRunnableWidgetObject", "stop");
if (!m_widget) {
WrtDB::WidgetSettings widgetSettings;
m_dao->getWidgetSettings(widgetSettings);
m_settingList.reset(new WidgetSettingList(widgetSettings));
+ m_submodeSupport->initialize(DPL::FromASCIIString(m_tizenId));
DPL::Optional<DPL::String> defloc = m_dao->getDefaultlocale();
if (!defloc.IsNull()) {
}
setInitialViewMode();
- PrepareExternalStorageSingleton::Instance().Initialize(m_dao->getTizenPkgId());
/* remove language change callback */
/*
//you can't show window with splash screen before PrepareView
//ewk_view_add_with_context() in viewLogic breaks window
m_windowData->init();
+ m_windowData->postInit();
+
+#if X11
+ // sub-mode support
+ if (m_submodeSupport->isInlineMode()) {
+ if (m_submodeSupport->transientWindow(
+ elm_win_xwindow_get(
+ m_windowData->getEvasObject(Layer::WINDOW))))
+ {
+ LogDebug("Success to set submode");
+ } else {
+ LogWarning("Fail to set submode");
+ }
+ }
+#endif
m_windowData->smartCallbackAdd(Layer::FOCUS,
"focused",
focusedCallback,
}
}
+void WrtClient::ExitCallback(void* data,
+ Evas_Object * /*obj*/,
+ void * /*event_info*/)
+{
+ LogInfo("ExitCallback");
+ Assert(data);
+
+ WrtClient* This = static_cast<WrtClient*>(data);
+
+ This->OnTerminate();
+}
+
void WrtClient::setCtxpopupItem(void)
{
WindowData::CtxpopupItemDataList data;
void WrtClient::ctxpopupShare(void)
{
LogDebug("share");
+#ifdef X11
const char* url = ewk_view_url_get(m_widget->GetCurrentWebview());
if (!url) {
LogError("url is empty");
} else {
LogDebug("fail");
}
+ evas_object_smart_callback_add(m_windowData->m_win,
+ "delete,request",
+ &WrtClient::ExitCallback,
+ this);
+#endif
}
void WrtClient::ctxpopupReload(void)
void WrtClient::ctxpopupLaunchBrowser(void)
{
LogDebug("launchBrowser");
+#ifdef X11
const char* url = ewk_view_url_get(m_widget->GetCurrentWebview());
if (!url) {
LogError("url is empty");
} else {
LogDebug("fail");
}
+#endif
}
void WrtClient::hwkeyCallback(const std::string& key)
// windowed UX - hosted application
if (key == KeyName::BACK) {
if (m_isWebkitFullscreen) {
- ewk_view_fullscreen_exit(m_widget->GetCurrentWebview());
+ // FIXME!!! This method has not yet landed in the tizen 3.0
+ // webkit-efl source tree
+ //ewk_view_fullscreen_exit(m_widget->GetCurrentWebview());
} else {
m_widget->Backward();
}
// packaged application
if (key == KeyName::BACK) {
if (m_isFullscreenByPlatform) {
- ewk_view_fullscreen_exit(m_widget->GetCurrentWebview());
+ // FIXME!!! This method has not yet landed in the tizen 3.0
+ // webkit-efl source tree
+ //ewk_view_fullscreen_exit(m_widget->GetCurrentWebview());
}
}
}
m_widget->Hide();
// AutoRotation, focusCallback use m_widget pointer internally.
// It must be unset before m_widget is released.
+ m_submodeSupport->deinitialize();
unsetWindowOrientation();
m_windowData->smartCallbackDel(Layer::FOCUS,
"focused",
unfocusedCallback);
m_widget.reset();
ewk_context_delete(s_preparedEwkContext);
- PrepareExternalStorageSingleton::Instance().Deinitialize();
WRT::CoreModuleSingleton::Instance().Terminate();
}
if (m_initialized) {
{
int fd = ecore_main_fd_handler_fd_get(handler);
+ if (fd == -1)
+ {
+ LogDebug("ECORE_FD_GET");
+ exit(-1);
+ }
+
if (ecore_main_fd_handler_active_get(handler, ECORE_FD_ERROR))
{
LogDebug("ECORE_FD_ERROR");
-
- if (fd != -1)
- {
- close(fd);
- }
-
+ close(fd);
exit(-1);
- return ECORE_CALLBACK_CANCEL;
}
if (ecore_main_fd_handler_active_get(handler, ECORE_FD_READ))
memset(pkt, 0, AUL_SOCK_MAXBUFF);
int recv_ret = recv(fd, pkt, AUL_SOCK_MAXBUFF, 0);
-
- if (fd != -1)
- {
- close(fd);
- }
+ close(fd);
if (recv_ret == -1)
{
LogDebug("recv error!");
+ free(pkt);
exit(-1);
}
- LogDebug("recv_ret : " << recv_ret << ", pkt->len : " << pkt->len);
+ LogDebug("recv_ret : " << recv_ret << ", pkt->len : " << pkt->len);
ecore_main_fd_handler_del(handler);
-
process_pool_launchpad_main_loop(pkt, app_argv[0], &app_argc, &app_argv);
-
free(pkt);
}
-
ecore_main_loop_quit();
- return ECORE_CALLBACK_CANCEL;
}
return ECORE_CALLBACK_CANCEL;
void set_env()
{
- // set evas backend type
- if (!getenv("ELM_ENGINE"))
- {
- if (!setenv("ELM_ENGINE", "gl", 1))
- {
- LogDebug("Enable backend");
- }
- }
- else
- {
- LogDebug("ELM_ENGINE : " << getenv("ELM_ENGINE"));
- }
-
#ifndef TIZEN_PUBLIC
setenv("COREGL_FASTPATH", "1", 1);
#endif
app_argc = argc;
app_argv = argv;
+#ifndef X11
+ // Mesa does a bad job detecting the correct EGL
+ // platform to use, and ends up assuming that the
+ // wrt-client is using X
+ setenv("EGL_PLATFORM", "wayland", 1);
+#endif
+
UNHANDLED_EXCEPTION_HANDLER_BEGIN
{
ADD_PROFILING_POINT("main-entered", "point");
// This change is needed for getting elementary profile
// /opt/home/app/.elementary/config/mobile/base.cfg
const char* backupEnv = getenv(HOME);
+ if (!backupEnv) {
+ // If getenv return "NULL", set empty string
+ backupEnv = "";
+ }
setenv(HOME, APP_HOME_PATH, 1);
LogDebug("elm_init()");
elm_init(argc, argv);
ClientModule::CommandLineParser::getTizenId(argc, argv);
if (!tizenId.empty()) {
+ if (UID_ROOT == getuid()) {
+ // Drop root permission
+ // Only launch web application by console command case has root permission
+ if (!ClientModule::SecuritySupport::setAppPrivilege(tizenId)) {
+ LogError("Fail to set app privilege : [" << tizenId << "]");
+ exit(-1);
+ }
+ }
+
LogDebug("Launching by fork mode");
// Language env setup
appcore_set_i18n("wrt-client", NULL);