-#git:framework/web/wrt wrt_0.8.185
+#git:framework/web/wrt wrt_0.8.186
Name: wrt
Summary: web runtime
-Version: 0.8.185
+Version: 0.8.186
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
#include <dpl/assert.h>
#include <dpl/exception.h>
#include <dpl/singleton_impl.h>
+#include <dpl/optional_typedefs.h>
#include "localization_setting.h"
#include <dpl/wrt-dao-ro/global_config.h>
#include <profiling_util.h>
MainThreadSingleton::Instance().DetachDatabases();
m_initialized = false;
}
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
+
RunnableWidgetObjectPtr getRunnableWidgetObject(
const std::string& tizenId,
- DPL::Optional<unsigned> serviceIndex)
-#else
- RunnableWidgetObjectPtr getRunnableWidgetObject(
- const std::string& tizenId)
-#endif
+ DPL::OptionalUInt appControlIndex)
{
try {
RunnableWidgetObjectPtr runnable;
WidgetModelPtr model =
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
- Domain::deserializeWidgetModel(tizenId, serviceIndex);
-#else
- Domain::deserializeWidgetModel(tizenId);
-#endif
+ Domain::deserializeWidgetModel(tizenId, appControlIndex);
if (!!model) {
runnable.reset(new RunnableWidgetObject(model));
}
{
return m_impl->Terminate();
}
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
+
RunnableWidgetObjectPtr CoreModule::getRunnableWidgetObject(
const std::string& tizenId,
- DPL::Optional<unsigned> serviceIndex)
-#else
-RunnableWidgetObjectPtr CoreModule::getRunnableWidgetObject(
- const std::string& tizenId)
-#endif
+ DPL::OptionalUInt appControlIndex)
{
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
- return m_impl->getRunnableWidgetObject(tizenId, serviceIndex);
-#else
- return m_impl->getRunnableWidgetObject(tizenId);
-#endif
+ return m_impl->getRunnableWidgetObject(tizenId, appControlIndex);
}
CoreModule::NetworkAccessMode CoreModule::homeNetworkAccess()
#include <dpl/wrt-dao-ro/wrt_db_types.h>
#include "i_runnable_widget_object.h"
#include <dpl/singleton.h>
+#include <dpl/optional_typedefs.h>
#include <memory>
#include <EWebKit2.h>
* @param packageName
* @return NULL on fail
*/
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
RunnableWidgetObjectPtr getRunnableWidgetObject(
const std::string& tizenId,
- DPL::Optional<unsigned> serviceIndex);
-#else
- RunnableWidgetObjectPtr getRunnableWidgetObject(
- const std::string& tizenId);
-#endif
+ DPL::OptionalUInt appControlIndex = DPL::OptionalUInt());
/**
* Gets from database global property of homeNetworkAccess
* @return homeNetworkAccess value
return;
}
- WidgetSettings widgetSettings;
+ WrtDB::WidgetSettings widgetSettings;
dao.getWidgetSettings(widgetSettings);
WidgetSettingList settings(widgetSettings);
bool backgroundSupport = false;
m_BackgroundSupport(BackgroundSupport_Disable)
{}
-WidgetSettingList::WidgetSettingList(WidgetSettings &widgetSettings)
+WidgetSettingList::WidgetSettingList(WrtDB::WidgetSettings &widgetSettings)
{
m_RotationLock = Screen_Portrait;
m_IndicatorPresence = Indicator_Enable;
public:
WidgetSettingList();
- WidgetSettingList(WidgetSettings &widgetSettings);
+ WidgetSettingList(WrtDB::WidgetSettings &widgetSettings);
WidgetSettingScreenLock getRotationValue() const;
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/log/log.h>
+#include <dpl/optional_typedefs.h>
// to apply widget default locales instead of calling localizeWidgetModel()
#include <dpl/localization/LanguageTagsProvider.h>
namespace Domain {
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId,
- DPL::Optional<unsigned> serviceIndex)
-#else
-std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId)
-#endif
+ DPL::OptionalUInt appControlIndex)
{
std::shared_ptr<WidgetModel> model;
DPL::String dplTizenId(DPL::FromUTF8String(tizenId));
if (WrtDB::WidgetDAOReadOnly::isWidgetInstalled(dplTizenId)) {
LogDebug("Widget installed - creating model");
model.reset(new WidgetModel(tizenId));
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
- model->AppServiceIndex.Set(serviceIndex);
-#endif
+ model->AppControlIndex.Set(appControlIndex);
WrtDB::WidgetDAOReadOnly dao(dplTizenId);
DPL::Optional<DPL::String> defloc = model->defaultlocale.Get();
dao.getWidgetAccessInfo(widgetAccessInfoList);
model->AccessList.Set(widgetAccessInfoList);
- // Widget application service information data
- WidgetApplicationServiceList widgetApplicationServiceList;
- // widgetApplicationServiceList is output parameter
- dao.getAppServiceList(widgetApplicationServiceList);
- model->AppServiceList.Set(widgetApplicationServiceList);
+ // Widget app-control information data
+ WrtDB::WidgetAppControlList widgetApplicationControlList;
+ // widgetApplicationControlList is output parameter
+ dao.getAppControlList(widgetApplicationControlList);
+ model->AppControlList.Set(widgetApplicationControlList);
// Set Widget Settings
- WidgetSettings widgetSettings;
+ WrtDB::WidgetSettings widgetSettings;
dao.getWidgetSettings(widgetSettings);
model->SettingList.Set(widgetSettings);
} else {
#include <string>
#include <widget_model.h>
#include <dpl/wrt-dao-ro/wrt_db_types.h>
+#include <dpl/optional_typedefs.h>
namespace Domain {
/**
* @param[in] service index, NULL for widget content
* @retval WidgetModel
*/
- #ifdef MULTIPROCESS_SERVICE_SUPPORT
std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId,
- DPL::Optional<unsigned> serviceIndex);
- #else
-std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId);
- #endif
+ DPL::OptionalUInt appControlIndex=DPL::OptionalUInt());
} //Namespace Domain
#endif // ifndef WRT_ENGINE_SRC_DOMAIN_WIDGET_DESERIALIZE_MODEL_H_
BindToWidgetDAO<bool, &WidgetDAOReadOnly::isTestWidget>::Get),
SettingList(this),
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
- AppServiceIndex(this),
-#endif
- AppServiceList(this)
+ AppControlList(this),
+ AppControlIndex(this)
{}
#include <dpl/event/model.h>
#include <dpl/event/property.h>
#include <dpl/optional.h>
+#include <dpl/optional_typedefs.h>
#include <string>
#include "widget_data_types.h"
DPL::Event::Property<WidgetSettingList> SettingList;
/**
- * @brief Widget Application Service list
+ * @brief Widget app-control list
*/
- DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
- DPL::Event::Property<DPL::Optional<unsigned> > AppServiceIndex;
-#endif
+ DPL::Event::Property<WrtDB::WidgetAppControlList> AppControlList;
+ DPL::Event::Property<DPL::OptionalUInt> AppControlIndex;
+
WidgetModel(const std::string &tizenId);
private:
#include <dpl/string.h>
#include <dpl/log/log.h>
#include <dpl/localization/w3c_file_localization.h>
+#include <dpl/optional_typedefs.h>
#include <widget_model.h>
#include <bundle.h>
#include <appsvc.h>
namespace ViewModule {
namespace UriSupport {
namespace {
+struct AppControlCompareData {
+std::string operation;
+std::string uri;
+std::string scheme;
+std::string mime;
+};
enum ServiceDataType
{
SERVICE_DATA_TYPE_OPERATION,
return false;
}
}
+
+std::string getAppControlSrc(
+ WrtDB::WidgetAppControlList appControlLost,
+ AppControlCompareData data)
+{
+ LogDebug(" - operation : " << data.operation);
+ LogDebug(" - uri : " << data.uri);
+ LogDebug(" - scheme : " << data.scheme);
+ LogDebug(" - mimetype : " << data.mime);
+
+ FOREACH(appControlIt, appControlLost)
+ {
+ if (compareServiceData(SERVICE_DATA_TYPE_OPERATION, DPL::ToUTF8String(appControlIt->operation), data.operation))
+ {
+ if (compareServiceData(SERVICE_DATA_TYPE_URI_SCHEME, DPL::ToUTF8String(appControlIt->uri), data.scheme) ||
+ compareServiceData(SERVICE_DATA_TYPE_URI, DPL::ToUTF8String(appControlIt->uri), data.uri) )
+ {
+ if (compareServiceData(SERVICE_DATA_TYPE_MIME, DPL::ToUTF8String(appControlIt->mime), data.mime))
+ {
+ LogDebug("Matched with : " << appControlIt->src);
+ LogDebug(" - operation : " << appControlIt->operation);
+ LogDebug(" - uri : " << appControlIt->uri);
+ LogDebug(" - mimetype : " << appControlIt->mime);
+ return DPL::ToUTF8String(appControlIt->src);
+ }
+ }
+ }
+ }
+ return std::string();
+}
+
}
std::string prepareUrl(const std::string &url, const std::string &insert)
return "";
}
-std::string getAppServiceUri(bundle *bundle, WidgetModel *widgetModel)
+std::string getAppControlUri(bundle *bundle, WidgetModel *widgetModel)
{
if (!bundle)
{
return std::string("");
}
+ AppControlCompareData data;
+ // get operation. Operation is mandatory.
const char* value = NULL;
value = appsvc_get_operation(bundle);
- std::string operation = value ? value : "";
- if (operation.empty()) {
+ data.operation = value ? value : "";
+ // ignore operation is NULL case
+ if (data.operation.empty()) {
+ LogDebug("Operation is NULL");
return std::string("");
}
+ // get mime
value = appsvc_get_mime(bundle);
- std::string mime = value ? value : "";
+ data.mime = value ? value : "";
+ // get uri
value = appsvc_get_uri(bundle);
- std::string uri = value ? value : "";
- std::string scheme;
+ data.uri = value ? value : "";
- if (uri.empty()) {
- LogError("Launch with no bundle data");
- } else {
- // get scheme by iri
- std::unique_ptr<iri_t> iri(iri_parse(uri.c_str()));
+ LogDebug("Passed AppControl data");
+ LogDebug(" - operation : " << data.operation);
+ LogDebug(" - uri : " << data.uri);
+ LogDebug(" - mimetype : " << data.mime);
+
+
+ // get scheme and mime
+ std::string originScheme = "";
+ std::string originPath = "";
+ if (!data.uri.empty()) {
+ std::unique_ptr<iri_t> iri(iri_parse(data.uri.c_str()));
if (!iri.get()) {
LogDebug("Fail to get iri");
- return std::string("");
+ originScheme = "";
+ originPath = "";
}
if (iri->scheme) {
- if (std::string(iri->scheme) != SCHEME_TYPE_FILE) {
- scheme = iri->scheme;
- }
+ originScheme = iri->scheme;
}
if (iri->path) {
- uri = iri->path;
+ originPath = iri->path;
}
- }
- // get mime type by aul api in case of mime type is empty
- if (mime.empty() && !uri.empty()) {
- char mimetype[128] = {0,};
- if (AUL_R_OK ==
- aul_get_mime_from_file(uri.c_str(),
- mimetype,
- sizeof(mimetype)))
- {
- mime = mimetype;
+ // checking condition that mime is empthy and uri is available
+ if (data.mime.empty() && !data.uri.empty()) {
+ // checking passed uri is local file
+ // case 1. uri = file:///xxxx
+ // case 2. uri = /xxxx
+ if (!data.scheme.empty() && data.scheme != SCHEME_TYPE_FILE) {
+ LogDebug("Passed uri isn't local file");
+ } else {
+ char mimetype[128] = {0,};
+ if (AUL_R_OK ==
+ aul_get_mime_from_file(iri->path,
+ mimetype,
+ sizeof(mimetype)))
+ {
+ data.mime = mimetype;
+ }
+ }
}
}
- LogDebug("AppService Information");
- LogDebug(" - operation : " << operation);
- LogDebug(" - uri : " << uri);
- LogDebug(" - scheme : " << scheme);
- LogDebug(" - mimetype : " << mime);
-
- WidgetApplicationServiceList appServiceList = widgetModel->AppServiceList.Get();
-
+ WrtDB::WidgetAppControlList appControlList =
+ widgetModel->AppControlList.Get();
+ if (!appControlList.empty()) {
#ifdef MULTIPROCESS_SERVICE_SUPPORT
- DPL::Optional<unsigned> index = widgetModel->AppServiceIndex.Get();
- if (!index.IsNull())
- {
- FOREACH(appServiceIt, appServiceList)
- {
- if (appServiceIt->index == *index)
- {
- return DPL::ToUTF8String(appServiceIt->src);
+ DPL::OptionalUInt index = widgetModel->AppControlIndex.Get();
+ if (!index.IsNull()) {
+ FOREACH(appControlIt, appControlList) {
+ if (appControlIt->index == *index) {
+ return DPL::ToUTF8String(appControlIt->src);
+ }
}
}
- }
#else
- FOREACH(appServiceIt, appServiceList)
- {
- if (compareServiceData(SERVICE_DATA_TYPE_OPERATION, DPL::ToUTF8String(appServiceIt->operation), operation))
- {
- if (compareServiceData(SERVICE_DATA_TYPE_URI_SCHEME, DPL::ToUTF8String(appServiceIt->scheme), scheme) ||
- compareServiceData(SERVICE_DATA_TYPE_URI, DPL::ToUTF8String(appServiceIt->scheme), uri) )
- {
- if (compareServiceData(SERVICE_DATA_TYPE_MIME, DPL::ToUTF8String(appServiceIt->mime), mime))
- {
- LogDebug("AppService Matched with : " << appServiceIt->src);
- LogDebug(" - operation : " << appServiceIt->operation);
- LogDebug(" - scheme : " << appServiceIt->scheme);
- LogDebug(" - mimetype : " << appServiceIt->mime);
+ // case 0, operation only
+ // scheme =
+ // uri =
+ if (data.uri.empty()) {
+ LogDebug("AppControl case 0 (NULL, NULL)");
+ std::string src = getAppControlSrc(appControlList, data);
+ if (!src.empty()) {
+ return src;
+ }
+ return std::string();
+ }
- return DPL::ToUTF8String(appServiceIt->src);
- }
+ // case 1
+ // scheme = nfc
+ // uri = nfc:///xxx/xxx
+ if (!originScheme.empty()) {
+ data.scheme = originScheme;
+ LogDebug("AppControl case 1 (file, file:///xxx/xxx)");
+ std::string src = getAppControlSrc(appControlList, data);
+ if (!src.empty()) {
+ return src;
+ }
+ }
+
+ // case 2
+ // scheme =
+ // uri = file:///xxx/xxx
+ data.scheme = "";
+ LogDebug("AppControl case 2 (NULL, file:///xxx/xxx)");
+ std::string src = getAppControlSrc(appControlList, data);
+ if (!src.empty()) {
+ return src;
+ }
+
+ // case 3
+ // scheme = file
+ // uri = /xxx/xxx
+ if (!originScheme.empty() && !originPath.empty()) {
+ data.scheme = originScheme;
+ data.uri = originPath;
+ LogDebug("AppControl case 3 (file, /xxx/xxx)");
+ std::string src = getAppControlSrc(appControlList, data);
+ if (!src.empty()) {
+ return src;
+ }
+ }
+
+ // case 4
+ // scheme =
+ // uri = /xxx/xxx
+ if (!originPath.empty()) {
+ data.scheme = "";
+ data.uri = originPath;
+ LogDebug("AppControl case 4 (NULL, /xxx/xxx)");
+ std::string src = getAppControlSrc(appControlList, data);
+ if (!src.empty()) {
+ return src;
}
}
- }
#endif
+ }
- if (!scheme.empty()) {
- LogDebug("Scheme parts: " << scheme << ", " << uri);
+ if (!originScheme.empty()) {
+ LogDebug("Scheme parts: " << originScheme << ", " << originPath);
return getCustomHandlerProtocolUri(
- widgetModel, scheme, uri);
+ widgetModel, originScheme, originPath);
}
- if (mime != "") {
+ if (data.mime != "") {
value = appsvc_get_data(bundle, APPSVC_DATA_SELECTED);
if (value != NULL) {
LogDebug("Use mime type for: " << value);
return getCustomHandlerContentUri(
- widgetModel, mime, std::string(value));
+ widgetModel, data.mime, std::string(value));
} else {
LogError("Selected file for mime is null, nothind to do");
}
std::string startUri;
LogDebug("default uri: " << defaultUri);
bundle *originBundle = ApplicationDataSingleton::Instance().getBundle();
- // search application service
- startUri = getAppServiceUri(originBundle, widgetModel).c_str();
- LogInfo("application service start uri is " << startUri);
+ // search app-control data
+ startUri = getAppControlUri(originBundle, widgetModel).c_str();
+ LogInfo("app-control start uri is " << startUri);
if (startUri == "") {
- LogInfo("application service doesn't have matched data");
+ LogInfo("app-control data doesn't have matched data");
startUri = defaultUri;
}
std::string appPath;
std::string tzAppId = DPL::ToUTF8String(dao.getTzAppId());
std::string tzPkgId = DPL::ToUTF8String(dao.getTizenPkgId());
-
- appPath = appPath + GetUserInstalledWidgetPath() + "/" +
- tzPkgId + GetUserWidgetExecPath() + "/" + tzAppId;
+ DPL::OptionalString installedPath = dao.getWidgetInstalledPath();
+ if (installedPath.IsNull()) {
+ appPath = std::string(GetUserInstalledWidgetPath()) + "/" +
+ tzPkgId + GetUserWidgetExecPath() + "/" + tzAppId;
+ } else {
+ appPath = DPL::ToUTF8String(*installedPath) +
+ GetUserWidgetExecPath() + "/" + tzAppId;
+ }
LogDebug("set_app_privilege(" << appPath << ")");
set_app_privilege(tzPkgId.c_str(), PRIVILEGE_APP_TYPE, appPath.c_str());
}
+
#ifdef CORS_WHITELISTING_ENABLED
bypassCORSforWARPAccessList(dao);
#endif
{
Assert(model);
Assert(isService(model));
- WidgetApplicationServiceList appServiceList = model->AppServiceList.Get();
- unsigned index = *model->AppServiceIndex.Get();
- FOREACH(appServiceIt, appServiceList)
+ WrtDB::WidgetAppControlList appControlList = model->AppControlList.Get();
+ unsigned index = *model->AppControlIndex.Get();
+ FOREACH(appControlIt, appControlList)
{
- if (index == appServiceIt->index)
+ if (index == appControlIt->index)
{
- switch(appServiceIt->disposition) {
- case WidgetApplicationService::Disposition::INLINE:
- LogDebug("Service disposition: INLINE");
+ switch(appControlIt->disposition) {
+ case WrtDB::WidgetAppControl::Disposition::INLINE:
+ LogDebug("Control disposition: INLINE");
return INLINE;
default:
break;
bool isService(WidgetModel *model)
{
- return !model->AppServiceIndex.Get().IsNull();
+ return !model->AppControlIndex.Get().IsNull();
}
}
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),
// Just show help
return false;
} else {
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
- const char * SERVICE_POSTFIX = "-__SERVICE_PROCESS__";
- std::size_t pos = tizenId.find(SERVICE_POSTFIX);
+ std::size_t pos =
+ tizenId.find(WrtDB::AppControlPrefix::PROCESS_PREFIX);
if (pos != std::string::npos) {
std::string id = tizenId.substr(pos);
- id.erase(strlen(SERVICE_POSTFIX));
+ id.erase(strlen(WrtDB::AppControlPrefix::PROCESS_PREFIX));
std::stringstream s(id);
- unsigned serviceIndex;
- s >> serviceIndex;
- m_serviceIndex = serviceIndex;
+ unsigned int appControlIndex;
+ s >> appControlIndex;
+ m_appControlIndex = appControlIndex;
tizenId.erase(pos);
- LogDebug("service index " << serviceIndex);
+ LogDebug("app-control execute-index : " << appControlIndex);
}
-#endif
m_tizenId = tizenId;
LogDebug("Tizen id: " << m_tizenId);
return true;
LogDebug("Launching widget ...");
ADD_PROFILING_POINT("getRunnableWidgetObject", "start");
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
- m_widget = WRT::CoreModuleSingleton::Instance()
- .getRunnableWidgetObject(m_tizenId, m_serviceIndex);
-#else
m_widget = WRT::CoreModuleSingleton::Instance()
- .getRunnableWidgetObject(m_tizenId);
-#endif
+ .getRunnableWidgetObject(m_tizenId, m_appControlIndex);
ADD_PROFILING_POINT("getRunnableWidgetObject", "stop");
if (!m_widget) {
bool fullscreen = false;
bool backbutton = false;
if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
- WidgetSettings widgetSettings;
+ WrtDB::WidgetSettings widgetSettings;
m_dao->getWidgetSettings(widgetSettings);
WidgetSettingList settings(widgetSettings);
backbutton =
Assert(m_windowData);
Assert(m_dao);
- WidgetSettings widgetSettings;
+ WrtDB::WidgetSettings widgetSettings;
m_dao->getWidgetSettings(widgetSettings);
WidgetSettingList settings(widgetSettings);
WidgetSettingScreenLock rotationValue = settings.getRotationValue();
Assert(m_widget);
Assert(m_dao);
- WidgetSettings widgetSettings;
+ WrtDB::WidgetSettings widgetSettings;
m_dao->getWidgetSettings(widgetSettings);
WidgetSettingList settings(widgetSettings);
WidgetSettingScreenLock rotationValue = settings.getRotationValue();
{
Assert(m_windowData);
Assert(m_dao);
- WidgetSettings widgetSettings;
+ WrtDB::WidgetSettings widgetSettings;
m_dao->getWidgetSettings(widgetSettings);
WidgetSettingList settings(widgetSettings);
if (settings.getBackButtonPresence() == BackButton_Enable) {
std::string tizenId = WrtClient::getTizenIdFromArgument(argc, argv);
PluginModuleSupport::init(s_preparedEwkContext, tizenId);
-
}
else
{
// This code is to fork a web process without exec.
std::string tizenId = WrtClient::getTizenIdFromArgument(argc, argv);
-
- if (!tizenId.empty())
- {
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
- std::size_t pos = tizenId.find("-__SERVICE_PROCESS__");
+ if (!tizenId.empty()) {
+ std::size_t pos =
+ tizenId.find(WrtDB::AppControlPrefix::PROCESS_PREFIX);
if (pos != std::string::npos) {
tizenId.erase(pos);
}
-#endif
+
LogDebug("Launching by fork mode");
// Language env setup
appcore_set_i18n("wrt-client", NULL);
#include <dpl/event/controller.h>
#include <dpl/type_list.h>
#include <dpl/task.h>
+#include <dpl/optional_typedefs.h>
#include <bundle.h>
#include <i_runnable_widget_object.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
// Private data
std::string m_tizenId;
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
- DPL::Optional<unsigned> m_serviceIndex;
-#endif
+ DPL::OptionalUInt m_appControlIndex;
+
bool m_launched;
bool m_initializing;
bool m_initialized;