#include <dpl/assert.h>
#include <dpl/sstream.h>
#include <dpl/wrt-dao-ro/common_dao_types.h>
+#include <dpl/utils/file_utils.h>
#include "root_parser.h"
#include "widget_parser.h"
#include "parser_runner.h"
#include <widget_install/task_certify.h>
#include <widget_install/task_widget_config.h>
#include <widget_install/task_db_update.h>
+#include <widget_install/task_file_manipulation.h>
#include <widget_install/task_ace_check.h>
#include <widget_install/task_smack.h>
#include <widget_install/task_manifest_file.h>
m_exceptionCaught(Exceptions::Success)
{
// Check installation type (config.xml or widget.wgt)
- m_installerContext.browserRequest = hasExtension(widgetPath, XML_EXTENSION);
+ bool browserRequest = hasExtension(widgetPath, XML_EXTENSION);
- LogInfo("Hosted app installation: " << m_installerContext.browserRequest);
+ LogInfo("Hosted app installation: " << browserRequest);
struct timeval tv;
gettimeofday(&tv, NULL);
m_installerContext.widgetHandle = handle;
m_installerContext.m_quiet = m_jobStruct.m_quiet;
- m_installerContext.widgetConfig.pType = checkPackageType(widgetPath);
+ if(!browserRequest)
+ {
+ m_installerContext.widgetConfig.pType = checkPackageType(widgetPath);
+ }
+ else
+ {
+ m_installerContext.widgetConfig.pType = WrtDB::PKG_TYPE_TIZEN_WEBAPP;
+ }
+ LogDebug("widgetPath:" << widgetPath);
- ConfigParserData configData = getWidgetDataFromXML(widgetPath,
- m_installerContext.browserRequest,
+ ConfigParserData configData = getWidgetDataFromXML(widgetPath, browserRequest,
m_installerContext.widgetConfig.pType);
WidgetUpdateInfo update = detectWidgetUpdate(configData);
+
bool needEncryption = detectResourceEncryption(configData);
+
// Configure installation
- ConfigureResult result = ConfigureInstallation(widgetPath,
- m_installerContext.browserRequest, update);
+ ConfigureResult result = ConfigureInstallation(widgetPath, update);
if (!setTizenId(configData)) {
result = ConfigureResult::Failed;
} else {
LogInfo("WidgetHandle: " << m_installerContext.widgetHandle);
LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname);
+ configureWidgetLocation(widgetPath, browserRequest);
+
// send start signal of pkgmgr
PkgmgrSignalSingleton::Instance().setPkgname(
DPL::ToUTF8String(
PKGMGR_START_KEY,
PKGMGR_START_INSTALL);
}
-
if (result == ConfigureResult::Ok) {
LogInfo("Configure installation succeeded");
AddTask(new TaskRecovery(m_installerContext));
// Create installation tasks
- if (!m_installerContext.browserRequest) {
+ if (!m_installerContext.locations->browserRequest()) {
AddTask(new TaskUnzip(m_installerContext));
}
AddTask(new TaskWidgetConfig(m_installerContext));
+ if (m_installerContext.locations->browserRequest()) {
+ AddTask(new TaskPrepareFiles(m_installerContext));
+ }
AddTask(new TaskCertify(m_installerContext));
if (needEncryption) {
AddTask(new TaskEncryptResource(m_installerContext));
}
AddTask(new TaskDbUpdate(m_installerContext));
+ AddTask(new TaskFileManipulation(m_installerContext));
// TODO: Update progress information for this task
AddTask(new TaskPrivateStorage(m_installerContext));
LogInfo("Configure installation updated");
LogInfo("Widget Update");
- if (!m_installerContext.browserRequest) {
+ if (!m_installerContext.locations->browserRequest()) {
AddTask(new TaskUnzip(m_installerContext));
}
AddTask(new TaskWidgetConfig(m_installerContext));
+ if (m_installerContext.locations->browserRequest()) {
+ AddTask(new TaskPrepareFiles(m_installerContext));
+ }
AddTask(new TaskCertify(m_installerContext));
AddTask(new TaskUpdateFiles(m_installerContext));
return m_installerContext.widgetHandle;
}
+void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath, bool browserRequest)
+{
+ Try
+ {
+ m_installerContext.locations = WidgetLocation(DPL::ToUTF8String(*m_installerContext.widgetConfig.pkgname),
+ widgetPath, browserRequest, m_installerContext.widgetConfig.pType);
+ }
+ Catch(FileUtils::CreateDirectoryException)
+ {
+ LogError("Failed to create temporary path for widget");
+ ReThrowMsg(FileUtils::CreateDirectoryException, "Failed to create temporary path for widget");
+ }
+
+ LogInfo("widgetSource " << widgetPath);
+}
+
JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
const std::string &widgetSource,
- bool fromBrowser,
const WidgetUpdateInfo &update)
{
LogInfo(
LogInfo("Whether widget policy allow proceed: " << canProceed);
// Init installer context
- m_installerContext.widgetSource = widgetSource;
- m_installerContext.tempWidgetPath = std::string();
-
- // setup config xml path
- if (fromBrowser) {
- LogInfo("widgetSource " << widgetSource);
- size_t slash = widgetSource.find_last_of("\\/");
- if (std::string::npos != slash) {
- m_installerContext.tempWidgetPath = widgetSource.substr(0, slash+1);
- } else {
- m_installerContext.tempWidgetPath = ".";
- }
- }
-
m_installerContext.installStep = InstallerContext::INSTALL_START;
m_installerContext.job = this;
m_installerContext.existingWidgetInfo = update.existingWidgetInfo;