#include <dpl/log/log.h>
#include <dpl/optional_typedefs.h>
#include <dpl/exception.h>
-#include <common/application_data.h>
+#include <application_data.h>
#include <core_module.h>
#include <localization_setting.h>
#include <widget_deserialize_model.h>
#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 <process_pool.h>
#include <process_pool_launchpad_util.h>
-#include <appsvc.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"
// window signal callback
-const char *EDJE_SHOW_BACKWARD_SIGNAL = "show,backward,signal";
const char *EDJE_SHOW_PROGRESS_SIGNAL = "show,progress,signal";
const char *EDJE_HIDE_PROGRESS_SIGNAL = "hide,progress,signal";
const std::string VIEWMODE_TYPE_FULLSCREEN = "fullscreen";
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_sdkLauncherPid(0),
m_debugMode(false),
- m_debuggerPort(0),
m_returnStatus(ReturnStatus::Succeeded),
m_widgetState(WidgetState::WidgetState_Stopped),
m_initialViewMode(VIEWMODE_TYPE_MAXIMIZED),
- m_currentViewMode(VIEWMODE_TYPE_MAXIMIZED)
+ m_currentViewMode(VIEWMODE_TYPE_MAXIMIZED),
+ m_isWebkitFullscreen(false),
+ m_isFullscreenByPlatform(false),
+ m_submodeSupport(new ClientModule::SubmodeSupport())
{
Touch();
LogDebug("App Created");
void WrtClient::OnStop()
{
- LogInfo("Stopping Dummy Client");
+ LogDebug("Stopping Dummy Client");
}
void WrtClient::OnCreate()
{
- LogInfo("On Create");
+ LogDebug("On Create");
ADD_PROFILING_POINT("OnCreate callback", "point");
ewk_init();
}
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;
}
return;
}
m_widget->Reset();
- m_windowData->emitSignalForUserLayout(EDJE_SHOW_BACKWARD_SIGNAL, "");
m_widgetState = WidgetState_Running;
} else {
- if (true == checkArgument()) {
- setStep();
- } else {
+ m_tizenId =
+ ClientModule::CommandLineParser::getTizenId(m_argc, m_argv);
+ if (m_tizenId.empty()) {
showHelpAndQuit();
+ } else {
+ setDebugMode(b);
+ setStep();
}
}
Quit();
}
-bool WrtClient::checkArgument()
-{
- std::string tizenId = getTizenIdFromArgument(m_argc, m_argv);
-
- if (tizenId.empty()) {
- // Just show help
- return false;
- } else {
- std::size_t pos =
- tizenId.find(WrtDB::AppControlPrefix::PROCESS_PREFIX);
- if (pos != std::string::npos) {
- std::string id = tizenId.substr(pos);
- id.erase(strlen(WrtDB::AppControlPrefix::PROCESS_PREFIX));
- std::stringstream s(id);
- unsigned int appControlIndex;
- s >> appControlIndex;
- m_appControlIndex = appControlIndex;
- tizenId.erase(pos);
- LogDebug("app-control execute-index : " << appControlIndex);
- }
- m_tizenId = tizenId;
- LogDebug("Tizen id: " << m_tizenId);
- return true;
- }
-}
-
-std::string WrtClient::getTizenIdFromArgument(int argc, char **argv)
-{
- LogInfo("checkArgument");
- std::string arg = argv[0];
-
- if (arg.empty()) {
- return "";
- }
-
- if (arg.find("wrt-client") != std::string::npos) {
- if (argc <= 1) {
- return "";
- }
-
- arg = argv[1];
-
- if (arg == "-h" || arg == "--help") {
- return "";
- } else if (arg == "-l" || arg == "--launch" ||
- arg == "-t" || arg == "--tizen")
- {
- if (argc != 3) {
- return "";
- }
- return argv[2];
- } else {
- return "";
- }
- } else {
- // Launch widget based on application basename
- size_t pos = arg.find_last_of('/');
-
- if (pos != std::string::npos) {
- arg = arg.erase(0, pos + 1);
- }
-
- return arg;
- }
-}
-
void WrtClient::setStep()
{
- LogInfo("setStep");
+ LogDebug("setStep");
AddStep(&WrtClient::initStep);
-
- setSdkLauncherDebugData();
-
AddStep(&WrtClient::launchStep);
AddStep(&WrtClient::shutdownStep);
DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(NextStepEvent());
}
-void WrtClient::setSdkLauncherDebugData()
-{
- LogDebug("setSdkLauncherDebugData");
-
- /* check bundle from sdk launcher */
- bundle *bundleFromSdkLauncher;
- bundleFromSdkLauncher = bundle_import_from_argv(m_argc, m_argv);
- const char *bundle_debug = bundle_get_val(bundleFromSdkLauncher, "debug");
- const char *bundle_pid = bundle_get_val(bundleFromSdkLauncher, "pid");
- if (bundle_debug != NULL && bundle_pid != NULL) {
- if (strcmp(bundle_debug, "true") == 0) {
- m_debugMode = true;
- m_sdkLauncherPid = atoi(bundle_pid);
- } else {
- m_debugMode = false;
- }
- }
- bundle_free(bundleFromSdkLauncher);
-}
-
-bool WrtClient::checkDebugMode(SDKDebugData* debugData)
+void WrtClient::setDebugMode(bundle* b)
{
- LogError("Checking for debug mode");
- Assert(m_dao);
-
- bool debugMode = debugData->debugMode;
-
- LogInfo("[DEBUG_MODE] Widget is launched in " <<
- (debugMode ? "DEBUG" : "RETAIL") <<
- " mode.");
-
- return debugMode;
+ m_debugMode = ClientModule::IDESupport::getDebugMode(b);
+ LogDebug("debug mode : " << m_debugMode);
}
void WrtClient::OnEventReceived(const NextStepEvent& /*event*/)
m_splashScreen->stopSplashScreenBuffered();
}
- SDKDebugData* debug = new SDKDebugData;
- debug->debugMode = m_debugMode;
- debug->pid = new unsigned long(getpid());
-
- LogInfo("Post result of launch");
-
- // Start inspector server, if current mode is debugger mode.
- // In the WK2 case, ewk_view_inspector_server_start should
- // be called after WebProcess is created.
- if (checkDebugMode(debug)) {
- debug->portnum =
- ewk_view_inspector_server_start(m_widget->GetCurrentWebview(), 0);
- if (debug->portnum == 0) {
- LogWarning("Failed to get portnum");
- } else {
- LogInfo("Assigned port number for inspector : "
- << debug->portnum);
- }
- } else {
- LogDebug("Debug mode is disabled");
- }
+ LogDebug("Post result of launch");
//w3c packaging test debug (message on 4>)
const char * makeScreen = getenv(W3C_DEBUG_ENV_VARIABLE);
PostEvent(NextStepEvent());
}
- if (debug->debugMode) {
- LogDebug("Send RT signal to wrt-launcher(pid: " << m_sdkLauncherPid);
- union sigval sv;
- /* send real time signal with result to wrt-launcher */
- if (webview) {
- LogDebug("userData->portnum : " << debug->portnum);
- sv.sival_int = debug->portnum;
- } else {
- sv.sival_int = -1;
+ if (m_debugMode) {
+ unsigned int portNum =
+ ewk_view_inspector_server_start(m_widget->GetCurrentWebview(), 0);
+ LogDebug("Port for inspector : " << portNum);
+ bool ret = ClientModule::IDESupport::sendReply(
+ ApplicationDataSingleton::Instance().getBundle(),
+ portNum);
+ if (!ret) {
+ LogWarning("Fail to send reply");
}
-
- bundle* request = NULL;
- appsvc_create_result_bundle(
- ApplicationDataSingleton::Instance().getBundle(),
- &request);
- char port[10] = {0,};
- sprintf(port, "%d", debug->portnum);
- appsvc_add_data(request, "port", port);
- appsvc_send_result(request, APPSVC_RES_OK);
}
ApplicationDataSingleton::Instance().freeBundle();
-
- LogDebug("Cleaning wrtClient launch resources...");
- delete debug->pid;
- delete debug;
}
void WrtClient::resetCallback(bool result)
if (m_settingList->getProgressBarPresence() == ProgressBar_Enable ||
m_currentViewMode == VIEWMODE_TYPE_WINDOWED)
{
- m_windowData->emitSignalForUserLayout(EDJE_SHOW_PROGRESS_SIGNAL, "");
+ m_windowData->signalEmit(Layer::MAIN_LAYOUT,
+ EDJE_SHOW_PROGRESS_SIGNAL,
+ "");
m_windowData->updateProgress(0);
}
}
if (m_settingList->getProgressBarPresence() == ProgressBar_Enable ||
m_currentViewMode == VIEWMODE_TYPE_WINDOWED)
{
- m_windowData->emitSignalForUserLayout(EDJE_HIDE_PROGRESS_SIGNAL, "");
+ m_windowData->signalEmit(Layer::MAIN_LAYOUT,
+ EDJE_HIDE_PROGRESS_SIGNAL,
+ "");
}
}
NextStepEvent());
}
-void WrtClient::toggleFullscreenCallback(bool fullscreen)
+void WrtClient::enterFullscreenCallback(Evas_Object* /*obj*/,
+ bool isFullscreenByPlatform)
{
- LogError("toggleFullscreen");
-
- if (fullscreen) {
- // enter fullscreen
- m_windowData->toggleFullscreen(true);
- m_currentViewMode = VIEWMODE_TYPE_FULLSCREEN;
- } else {
- // exit fullscreen
- m_windowData->toggleFullscreen(false);
- m_currentViewMode = m_initialViewMode;
+ // enter fullscreen
+ m_windowData->toggleFullscreen(true);
+ m_currentViewMode = VIEWMODE_TYPE_FULLSCREEN;
+ m_isWebkitFullscreen = true;
+ if (isFullscreenByPlatform) {
+ m_isFullscreenByPlatform = true;
}
}
+void WrtClient::exitFullscreenCallback(Evas_Object* /*obj*/)
+{
+ // exit fullscreen
+ m_windowData->toggleFullscreen(false);
+ m_currentViewMode = m_initialViewMode;
+ m_isWebkitFullscreen = false;
+ m_isFullscreenByPlatform = false;
+}
+
void WrtClient::launchStep()
{
ADD_PROFILING_POINT("launchStep", "start");
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 */
/*
s_preparedWindowData = NULL;
}
ADD_PROFILING_POINT("CreateWindow", "stop");
+ if (!m_windowData->initScreenReaderSupport(
+ m_settingList->getAccessibility() == Accessibility_Enable))
+ {
+ LogWarning("Fail to set screen reader support set");
+ }
// rotate window to initial value
setWindowInitialOrientation();
DPL::OptionalString splashImgSrc = m_dao->getSplashImgSrc();
if (!splashImgSrc.IsNull())
{
- m_splashScreen.reset(new SplashScreenSupport(m_windowData->m_win,
- (DPL::ToUTF8String(*splashImgSrc)).c_str(),
- m_currentViewMode != VIEWMODE_TYPE_FULLSCREEN,
- m_settingList->getRotationValue() == Screen_Landscape));
+ m_splashScreen.reset(
+ new SplashScreenSupport(
+ m_windowData->getEvasObject(Layer::WINDOW),
+ (DPL::ToUTF8String(*splashImgSrc)).c_str(),
+ m_currentViewMode != VIEWMODE_TYPE_FULLSCREEN,
+ m_settingList->getRotationValue() == Screen_Landscape));
m_splashScreen->startSplashScreen();
}
ADD_PROFILING_POINT("Create splash screen", "stop");
DPL::OptionalString startUrl = W3CFileLocalization::getStartFile(m_dao);
- if (!m_widget->PrepareView(DPL::ToUTF8String(*startUrl),
- m_windowData->m_win, s_preparedEwkContext))
+ if (!m_widget->PrepareView(
+ DPL::ToUTF8String(*startUrl),
+ m_windowData->getEvasObject(Layer::WINDOW),
+ s_preparedEwkContext))
{
DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
NextStepEvent());
//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);
+ 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,
+ this);
+ m_windowData->smartCallbackAdd(Layer::FOCUS,
+ "unfocused",
+ unfocusedCallback,
+ this);
WrtDB::WidgetLocalizedInfo localizedInfo =
W3CFileLocalization::getLocalizedInfo(m_dao);
if (!(localizedInfo.name.IsNull())) {
name = DPL::ToUTF8String(*(localizedInfo.name));
}
- elm_win_title_set(m_windowData->m_win, name.c_str());
+ elm_win_title_set(m_windowData->getEvasObject(Layer::WINDOW),
+ name.c_str());
// window show
- evas_object_show(m_windowData->m_win);
+ evas_object_show(m_windowData->getEvasObject(Layer::WINDOW));
initializeWindowModes();
NextStepEvent());
return;
}
- LogInfo("Widget launch accepted. Entering running state");
+ LogDebug("Widget launch accepted. Entering running state");
m_widgetState = WidgetState_Running;
cbs->progressStarted = DPL::MakeDelegate(this, &WrtClient::progressStartedCallback);
cbs->bufferUnset = DPL::MakeDelegate(this, &WrtClient::unsetLayout);
cbs->webkitExit = DPL::MakeDelegate(this, &WrtClient::webkitExitCallback);
cbs->webCrash = DPL::MakeDelegate(this, &WrtClient::webCrashCallback);
- cbs->toggleFullscreen = DPL::MakeDelegate(this, &WrtClient::toggleFullscreenCallback);
+ cbs->enterFullscreen = DPL::MakeDelegate(this, &WrtClient::enterFullscreenCallback);
+ cbs->exitFullscreen = DPL::MakeDelegate(this, &WrtClient::exitFullscreenCallback);
cbs->setOrientation = DPL::MakeDelegate(this, &WrtClient::setWindowOrientation);
cbs->hwkey = DPL::MakeDelegate(this, &WrtClient::hwkeyCallback);
m_widget->SetUserDelegates(cbs);
m_widget->Show();
- m_windowData->emitSignalForUserLayout(EDJE_SHOW_BACKWARD_SIGNAL, "");
ADD_PROFILING_POINT("launchStep", "stop");
}
backbutton);
}
-void WrtClient::backButtonCallback(void* data,
- Evas_Object * /*obj*/,
- void * /*event_info*/)
-{
- LogInfo("BackButtonCallback");
- Assert(data);
-
- WrtClient* This = static_cast<WrtClient*>(data);
- This->m_widget->Backward();
-}
-
Eina_Bool WrtClient::naviframeBackButtonCallback(void* data,
Elm_Object_Item* /*it*/)
{
- LogInfo("BackButtonCallback");
+ LogDebug("BackButtonCallback");
Assert(data);
WrtClient* This = static_cast<WrtClient*>(data);
int WrtClient::appcoreLowMemoryCallback(void* /*data*/)
{
- LogInfo("appcoreLowMemoryCallback");
+ LogDebug("appcoreLowMemoryCallback");
//WrtClient* This = static_cast<WrtClient*>(data);
// TODO call RunnableWidgetObject API regarding low memory
} else if (rotationValue == Screen_Landscape) {
setWindowOrientation(OrientationAngle::Window::Landscape::PRIMARY);
} else if (rotationValue == Screen_AutoRotation) {
- if (!AutoRotationSupport::setAutoRotation(m_windowData->m_win,
- autoRotationCallback,
- this))
+ if (!AutoRotationSupport::setAutoRotation(
+ m_windowData->getEvasObject(Layer::WINDOW),
+ autoRotationCallback,
+ this))
{
LogError("Fail to set auto rotation");
}
WidgetSettingScreenLock rotationValue = m_settingList->getRotationValue();
if (rotationValue == Screen_AutoRotation) {
- AutoRotationSupport::unsetAutoRotation(m_windowData->m_win, autoRotationCallback);
+ AutoRotationSupport::unsetAutoRotation(
+ m_windowData->getEvasObject(Layer::WINDOW),
+ autoRotationCallback);
}
}
}
}
+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");
return;
}
if (ClientModule::ServiceSupport::launchShareService(
- elm_win_xwindow_get(m_windowData->m_win),
+ elm_win_xwindow_get(m_windowData->getEvasObject(Layer::WINDOW)),
url))
{
- LogInfo("success");
+ LogDebug("success");
} else {
- LogInfo("fail");
+ 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");
return;
}
if (ClientModule::ServiceSupport::launchViewService(
- elm_win_xwindow_get(m_windowData->m_win),
+ elm_win_xwindow_get(m_windowData->getEvasObject(Layer::WINDOW)),
url))
{
- LogInfo("success");
+ LogDebug("success");
} else {
- LogInfo("fail");
+ LogDebug("fail");
}
+#endif
}
void WrtClient::hwkeyCallback(const std::string& key)
if (m_settingList->getBackButtonPresence() == BackButton_Enable
|| m_currentViewMode == VIEWMODE_TYPE_WINDOWED)
{
+ // windowed UX - hosted application
if (key == KeyName::BACK) {
- m_widget->Backward();
+ if (m_isWebkitFullscreen) {
+ // 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();
+ }
} else if (key == KeyName::MENU) {
// UX isn't confirmed
// m_windowData->showCtxpopup();
}
+ } else {
+ // packaged application
+ if (key == KeyName::BACK) {
+ if (m_isFullscreenByPlatform) {
+ // FIXME!!! This method has not yet landed in the tizen 3.0
+ // webkit-efl source tree
+ //ewk_view_fullscreen_exit(m_widget->GetCurrentWebview());
+ }
+ }
}
}
-void WrtClient::setLayout(Evas_Object* newBuffer)
+void WrtClient::setLayout(Evas_Object* webview)
{
LogDebug("add new webkit buffer to window");
- Assert(newBuffer);
- m_windowData->setEvasObjectForLayout(newBuffer);
- evas_object_show(newBuffer);
- evas_object_show(m_windowData->m_win);
+ Assert(webview);
+ m_windowData->setWebview(webview);
+ evas_object_show(webview);
+ evas_object_show(m_windowData->getEvasObject(Layer::WINDOW));
}
-void WrtClient::unsetLayout(Evas_Object* currentBuffer)
+void WrtClient::unsetLayout(Evas_Object* webview)
{
LogDebug("remove current webkit buffer from window");
- Assert(currentBuffer);
- evas_object_hide(currentBuffer);
- m_windowData->unsetEvasObjectForLayout();
+ Assert(webview);
+ evas_object_hide(webview);
+ m_windowData->unsetWebview();
}
void WrtClient::shutdownStep()
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->focusCallbackDel("focused", focusedCallback);
- m_windowData->focusCallbackDel("unfocused", unfocusedCallback);
+ m_windowData->smartCallbackDel(Layer::FOCUS,
+ "focused",
+ focusedCallback);
+ m_windowData->smartCallbackDel(Layer::FOCUS,
+ "unfocused",
+ unfocusedCallback);
m_widget.reset();
ewk_context_delete(s_preparedEwkContext);
- PrepareExternalStorageSingleton::Instance().Deinitialize();
WRT::CoreModuleSingleton::Instance().Terminate();
}
if (m_initialized) {
void WrtClient::autoRotationCallback(void* data, Evas_Object* obj, void* /*event*/)
{
- LogInfo("entered");
+ LogDebug("entered");
Assert(data);
Assert(obj);
WrtClient* This = static_cast<WrtClient*>(data);
-
This->autoRotationSetOrientation(obj);
}
Evas_Object* /*obj*/,
void* /*eventInfo*/)
{
- LogInfo("entered");
+ LogDebug("entered");
Assert(data);
WrtClient* This = static_cast<WrtClient*>(data);
elm_object_focus_set(This->m_widget->GetCurrentWebview(), EINA_TRUE);
Evas_Object* /*obj*/,
void* /*eventInfo*/)
{
- LogInfo("entered");
+ LogDebug("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");
+ LogDebug("entered");
Assert(obj);
AutoRotationSupport::setOrientation(obj, m_widget->GetCurrentWebview(),
{
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;
static void vconf_changed_handler(keynode_t* /*key*/, void* /*data*/)
{
- LogInfo("VCONFKEY_LANGSET vconf-key was changed!");
+ LogDebug("VCONFKEY_LANGSET vconf-key was changed!");
// When system language is changed, the candidate process will be created again.
exit(-1);
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");
if (argc > 1 && argv[1] != NULL && !strcmp(argv[1], "-d"))
{
- LogInfo("Entered dummy process mode");
+ LogDebug("Entered dummy process mode");
sprintf(argv[0], "%s ",
DUMMY_PROCESS_PATH);
// Set 'root' home directory
setenv(HOME, ROOT_HOME_PATH, 1);
- LogInfo("Prepare ewk_context");
+ LogDebug("Prepare ewk_context");
appcore_set_i18n("wrt-client", NULL);
ewk_set_arguments(argc, argv);
setenv("WRT_LAUNCHING_PERFORMANCE", "1", 1);
if (s_preparedEwkContext == NULL)
{
- LogInfo("Creating webkit context was failed!");
+ LogDebug("Creating webkit context was failed!");
exit(-1);
}
if (client_fd == -1)
{
- LogInfo("Connecting process_pool_server was failed!");
+ LogDebug("Connecting process_pool_server was failed!");
exit(-1);
}
// register language changed callback
vconf_notify_key_changed(VCONFKEY_LANGSET, vconf_changed_handler, NULL);
- LogInfo("Prepare window_data");
+ LogDebug("Prepare window_data");
// Temporarily change HOME path to app
// 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);
- LogInfo("elm_init()");
+ LogDebug("elm_init()");
elm_init(argc, argv);
setenv(HOME, backupEnv, 1);
- LogInfo("WindowData()");
+ LogDebug("WindowData()");
s_preparedWindowData = new WindowData(static_cast<unsigned long>(getpid()));
Ecore_Fd_Handler* fd_handler = ecore_main_fd_handler_add(client_fd,
if (fd_handler == NULL)
{
- LogInfo("fd_handler is NULL");
+ LogDebug("fd_handler is NULL");
exit(-1);
}
// deregister language changed callback
vconf_ignore_key_changed(VCONFKEY_LANGSET, vconf_changed_handler);
- std::string tizenId = WrtClient::getTizenIdFromArgument(argc, argv);
+ std::string tizenId =
+ ClientModule::CommandLineParser::getTizenId(argc, argv);
ewk_context_message_post_to_injected_bundle(
s_preparedEwkContext,
MESSAGE_NAME_INITIALIZE,
else
{
// This code is to fork a web process without exec.
- std::string tizenId = WrtClient::getTizenIdFromArgument(argc, argv);
+ std::string tizenId =
+ ClientModule::CommandLineParser::getTizenId(argc, argv);
+
if (!tizenId.empty()) {
- std::size_t pos =
- tizenId.find(WrtDB::AppControlPrefix::PROCESS_PREFIX);
- if (pos != std::string::npos) {
- tizenId.erase(pos);
+ 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");
if (s_preparedEwkContext == NULL)
{
- LogInfo("Creating webkit context was failed!");
+ LogDebug("Creating webkit context was failed!");
Wrt::Popup::PopupInvoker().showInfo("Error", "Creating webkit context was failed.", "OK");
exit(-1);
}