From 72f255afa20a7cbf63022f718e754c09f1700af8 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Thu, 2 May 2013 11:41:40 +0900 Subject: [PATCH] Refactoring install type [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] Refactoring install type [SCMRequest] N/A Change-Id: I39fc9c964d48b7d59b4c4ca4fc1ab49a127edf25 --- src/commons/wrt_install_mode.h | 75 ++++++++++++++++++++++ src/jobs/widget_install/job_widget_install.cpp | 49 +++++--------- src/jobs/widget_install/task_ace_check.cpp | 4 +- src/jobs/widget_install/task_certify.cpp | 8 +-- src/jobs/widget_install/task_file_manipulation.cpp | 8 +-- src/jobs/widget_install/task_manifest_file.cpp | 4 +- src/jobs/widget_install/task_smack.cpp | 6 +- src/jobs/widget_install/widget_install_context.h | 2 + src/jobs/widget_install/widget_installer_struct.h | 21 ++---- src/wrt-installer/wrt-installer.cpp | 47 ++++++++------ src/wrt-installer/wrt-installer.h | 3 +- src/wrt-installer/wrt_installer_api.cpp | 43 +++---------- src/wrt-installer/wrt_installer_api.h | 20 +----- 13 files changed, 146 insertions(+), 144 deletions(-) create mode 100644 src/commons/wrt_install_mode.h diff --git a/src/commons/wrt_install_mode.h b/src/commons/wrt_install_mode.h new file mode 100644 index 0000000..a545f9c --- /dev/null +++ b/src/commons/wrt_install_mode.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2011 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 wrt_install_mode.h + * @author Jihoon Chung (jihoon.chung@samgsung.com) + * @version + * @brief Definition file of widget install mode class + */ + +#ifndef WRT_INSTALL_MODE_H +#define WRT_INSTALL_MODE_H + +class InstallMode +{ + public: + enum class Command + { + INSTALL, + REINSTALL + }; + enum class Location + { + INTERNAL, + EXTERNAL + }; + enum class RootPath + { + RW, + RO + }; + enum class ExtensionType + { + WGT, + DIR + }; + enum class InstallTime + { + NORMAL, + PRELOAD + }; + + InstallMode(Command cmd = Command::INSTALL, + Location lo = Location::INTERNAL, + RootPath root = RootPath::RW, + ExtensionType extensionType = ExtensionType::WGT, + InstallTime time = InstallTime::NORMAL) : + command(cmd), + location(lo), + rootPath(root), + extension(extensionType), + installTime(time) + {}; + + Command command; + Location location; + RootPath rootPath; + ExtensionType extension; + InstallTime installTime; +}; + +#endif // WRT_INSTALL_MODE_H + diff --git a/src/jobs/widget_install/job_widget_install.cpp b/src/jobs/widget_install/job_widget_install.cpp index d733180..1382f0e 100644 --- a/src/jobs/widget_install/job_widget_install.cpp +++ b/src/jobs/widget_install/job_widget_install.cpp @@ -162,6 +162,7 @@ JobWidgetInstall::JobWidgetInstall( JobContextBase(installerStruct), m_exceptionCaught(Jobs::Exceptions::Success) { + m_installerContext.mode = m_jobStruct.m_installMode; ConfigureResult result = PrePareInstallation(widgetPath); if (result == ConfigureResult::Ok) { @@ -208,8 +209,8 @@ JobWidgetInstall::JobWidgetInstall( LogInfo("Widget Update"); m_installerContext.job->SetProgressFlag(true); - if (m_jobStruct.m_installMode == - InstallMode::REINSTALL_MODE_DIRECTORY) + if (m_installerContext.mode.command == + InstallMode::Command::REINSTALL) { AddTask(new TaskPrepareReinstall(m_installerContext)); } @@ -284,9 +285,7 @@ ConfigureResult JobWidgetInstall::PrePareInstallation( Try { std::string tempDir; - if (m_jobStruct.m_installMode == - InstallMode::REINSTALL_MODE_DIRECTORY) - { + if (m_installerContext.mode.extension == InstallMode::ExtensionType::DIR) { std::ostringstream tempPathBuilder; tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath(); tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath(); @@ -296,8 +295,8 @@ ConfigureResult JobWidgetInstall::PrePareInstallation( } else { tempDir = Jobs::WidgetInstall::createTempPath( - m_jobStruct.m_installMode == - InstallMode::INSTALL_MODE_PRELOAD); + m_installerContext.mode.installTime == + InstallMode::InstallTime::PRELOAD); } m_isDRM = isDRMWidget(widgetPath); @@ -318,8 +317,7 @@ ConfigureResult JobWidgetInstall::PrePareInstallation( tempDir, m_installerContext.widgetConfig.packagingType, m_isDRM, - m_jobStruct.m_installMode == - InstallMode::REINSTALL_MODE_DIRECTORY); + m_installerContext.mode.command == InstallMode::Command::REINSTALL); LogDebug("widget packaging type : " << m_installerContext.widgetConfig.packagingType.pkgType); @@ -447,24 +445,12 @@ void JobWidgetInstall::setTizenId( void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath, const std::string& tempPath) { - if (m_jobStruct.m_installMode == - InstallMode::REINSTALL_MODE_DIRECTORY) - { - // replace widget path to installed path - m_installerContext.locations = - WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig. - tzPkgid), - widgetPath, tempPath, - m_installerContext.widgetConfig.packagingType, - m_installerContext.locationType); - } else { - m_installerContext.locations = - WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig. - tzPkgid), - widgetPath, tempPath, - m_installerContext.widgetConfig.packagingType, - m_installerContext.locationType); - } + m_installerContext.locations = + WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig. + tzPkgid), + widgetPath, tempPath, + m_installerContext.widgetConfig.packagingType, + m_installerContext.locationType); m_installerContext.locations->registerAppid( DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid)); @@ -638,8 +624,7 @@ ConfigureResult JobWidgetInstall::checkWidgetUpdate( m_installerContext.widgetConfig.tzAppid = update.tzAppId; if (isUpperVersion(update.existingVersion, update.incomingVersion) || - (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY) || - (m_jobStruct.m_installMode == InstallMode::REINSTALL_MODE_DIRECTORY)) + m_installerContext.mode.extension == InstallMode::ExtensionType::DIR) { LogInfo("Whether widget policy allow proceed ok"); return ConfigureResult::Updated; @@ -991,9 +976,7 @@ WrtDB::PackagingType JobWidgetInstall::checkPackageType( const std::string &tempPath) { // Check installation type (direcotory/ or config.xml or widget.wgt) - if (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY || - m_jobStruct.m_installMode == InstallMode::REINSTALL_MODE_DIRECTORY) - { + if (m_installerContext.mode.extension == InstallMode::ExtensionType::DIR) { LogDebug("Install directly from directory"); return PKG_TYPE_DIRECTORY_WEB_APP; } @@ -1129,7 +1112,7 @@ void JobWidgetInstall::setInstallLocationType( { m_installerContext.locationType = INSTALL_LOCATION_TYPE_NOMAL; - if (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_PRELOAD) { + if (m_installerContext.mode.installTime == InstallMode::InstallTime::PRELOAD) { m_installerContext.locationType = INSTALL_LOCATION_TYPE_PRELOAD; } else { diff --git a/src/jobs/widget_install/task_ace_check.cpp b/src/jobs/widget_install/task_ace_check.cpp index 4b9f5a6..b3d7e4a 100644 --- a/src/jobs/widget_install/task_ace_check.cpp +++ b/src/jobs/widget_install/task_ace_check.cpp @@ -76,9 +76,7 @@ void TaskAceCheck::StepAceCheck() ace_policy_result_t policyResult = ACE_DENY; //TODO: remove dao.getHandle() - if (m_context.job->getInstallerStruct().m_installMode - == InstallMode::INSTALL_MODE_PRELOAD) - { + if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD) { LogDebug("This widget is prealoaded. So ace check will be skiped"); policyResult = ACE_PERMIT; } else { diff --git a/src/jobs/widget_install/task_certify.cpp b/src/jobs/widget_install/task_certify.cpp index 128f022..cddc237 100644 --- a/src/jobs/widget_install/task_certify.cpp +++ b/src/jobs/widget_install/task_certify.cpp @@ -253,10 +253,10 @@ void TaskCertify::stepSignature() result = validator.check(data, widgetPath); - if (m_contextData.widgetConfig.packagingType - == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP || - m_contextData.job->getInstallerStruct().m_installMode - == InstallMode::INSTALL_MODE_PRELOAD) + if (m_contextData.widgetConfig.packagingType == + WrtDB::PKG_TYPE_DIRECTORY_WEB_APP || + m_contextData.mode.installTime == + InstallMode::InstallTime::PRELOAD) { // In directory installation mode, the validation is skipped. diff --git a/src/jobs/widget_install/task_file_manipulation.cpp b/src/jobs/widget_install/task_file_manipulation.cpp index 4e25780..111305b 100644 --- a/src/jobs/widget_install/task_file_manipulation.cpp +++ b/src/jobs/widget_install/task_file_manipulation.cpp @@ -186,9 +186,7 @@ void TaskFileManipulation::StepCreateDirs() LogDebug("Create resource directory"); WrtUtilMakeDir(widgetBinPath); WrtUtilMakeDir(widgetSrcPath); - if (m_context.job->getInstallerStruct().m_installMode - == InstallMode::INSTALL_MODE_PRELOAD) - { + if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD) { std::string userWidgetDir = m_context.locations->getUserDataRootDir(); WrtUtilMakeDir(userWidgetDir); } @@ -236,9 +234,7 @@ void TaskFileManipulation::StepRenamePath() void TaskFileManipulation::StepLinkForPreload() { - if (m_context.job->getInstallerStruct().m_installMode - == InstallMode::INSTALL_MODE_PRELOAD) - { + if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD) { std::string srcDir = m_context.locations->getUserDataRootDir() + WrtDB::GlobalConfig::GetWidgetSrcPath(); diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp index 7074609..24aa446 100644 --- a/src/jobs/widget_install/task_manifest_file.cpp +++ b/src/jobs/widget_install/task_manifest_file.cpp @@ -563,9 +563,7 @@ void TaskManifestFile::commitManifest() LogDebug("Commiting manifest file : " << manifest_file); std::ostringstream destFile; - if (m_context.job->getInstallerStruct().m_installMode - == InstallMode::INSTALL_MODE_PRELOAD) - { + if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD) { destFile << "/usr/share/packages" << "/"; //TODO constant with path } else { destFile << "/opt/share/packages" << "/"; //TODO constant with path diff --git a/src/jobs/widget_install/task_smack.cpp b/src/jobs/widget_install/task_smack.cpp index a5624a9..e6db95a 100644 --- a/src/jobs/widget_install/task_smack.cpp +++ b/src/jobs/widget_install/task_smack.cpp @@ -131,9 +131,7 @@ void TaskSmack::SmackPrivilegeStep() const char* perm_list[0]; perm_list[0] = NULL; #endif - if (m_context.job->getInstallerStruct().m_installMode - != InstallMode::INSTALL_MODE_PRELOAD) - { + if (m_context.mode.installTime != InstallMode::InstallTime::PRELOAD) { int result = app_add_permissions( DPL::ToUTF8String(tzPkgid).c_str(), perm_list); if (PC_OPERATION_SUCCESS != result) { @@ -175,7 +173,7 @@ void TaskSmack::SmackTemporaryStep() #endif } -void TaskSmack::SetEndofInstallation() +void TaskSmack::SetEndofInstallation() { m_context.job->UpdateProgress( InstallerContext::INSTALL_END, diff --git a/src/jobs/widget_install/widget_install_context.h b/src/jobs/widget_install/widget_install_context.h index bd96390..a981670 100644 --- a/src/jobs/widget_install/widget_install_context.h +++ b/src/jobs/widget_install/widget_install_context.h @@ -30,6 +30,7 @@ #include #include #include +#include namespace Jobs { namespace WidgetInstall { @@ -100,6 +101,7 @@ struct InstallerContext std::string installInfo; /// InstallLocationType locationType; bool isUpdateMode; + InstallMode mode; }; #endif // INSTALLER_CONTEXT_H diff --git a/src/jobs/widget_install/widget_installer_struct.h b/src/jobs/widget_install/widget_installer_struct.h index 0ebe48a..6f0c176 100644 --- a/src/jobs/widget_install/widget_installer_struct.h +++ b/src/jobs/widget_install/widget_installer_struct.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -45,17 +46,6 @@ typedef void (*InstallerProgressCallback)(void *userParam, ProgressPercent percent, const ProgressDescription &); -namespace InstallMode { -enum Type -{ - WRONG_INSTALL_MODE = -1, - INSTALL_MODE_WGT, - INSTALL_MODE_DIRECTORY, - INSTALL_MODE_PRELOAD, - REINSTALL_MODE_DIRECTORY -}; -} - //TODO into namespace //InstallationStruct typedef Jobs::JobCallbacksBase pkgmgrInterface; // It must be empty-constructible as a parameter of generic event - WidgetInstallationStruct() : - m_installMode(InstallMode::Type::INSTALL_MODE_WGT) - {} - + WidgetInstallationStruct() {}; WidgetInstallationStruct( InstallerFinishedCallback finished, InstallerProgressCallback progress, void *param, - InstallMode::Type mode, + InstallMode mode, std::shared_ptr _pkgmgrInterface ) : diff --git a/src/wrt-installer/wrt-installer.cpp b/src/wrt-installer/wrt-installer.cpp index 8625033..b2bccad 100644 --- a/src/wrt-installer/wrt-installer.cpp +++ b/src/wrt-installer/wrt-installer.cpp @@ -82,7 +82,6 @@ struct PluginInstallerData WrtInstaller::WrtInstaller(int argc, char **argv) : Application(argc, argv, "backend", false), DPL::TaskDecl(this), - m_installMode(WRT_INSTALL_MODE_UNKNOWN), m_packagePath(), m_initialized(false), m_numPluginsToInstall(0), @@ -175,10 +174,10 @@ void WrtInstaller::OnCreate() struct stat info; if (-1 != stat(m_argv[2], &info) && S_ISDIR(info.st_mode)) { LogInfo("Installing package directly from directory"); - m_installMode = WRT_INSTALL_MODE_INSTALL_DIRECTORY; + m_installMode.extension = InstallMode::ExtensionType::DIR; } else { LogInfo("Installing from regular location"); - m_installMode = WRT_INSTALL_MODE_INSTALL_WGT; + m_installMode.extension = InstallMode::ExtensionType::WGT; } m_packagePath = m_argv[2]; @@ -189,7 +188,7 @@ void WrtInstaller::OnCreate() return showHelpAndQuit(); } m_packagePath = m_argv[2]; - m_installMode = WRT_INSTALL_MODE_INSTALL_PRELOAD; + m_installMode.installTime = InstallMode::InstallTime::PRELOAD; AddStep(&WrtInstaller::installStep); } else if (arg == "-c" || arg == "--csc-update") { // "path=/opt/system/csc/Ozq2iEG15R-2.0.0-arm.wgt:op=install:removable=true" @@ -208,7 +207,7 @@ void WrtInstaller::OnCreate() if (it->second == CSCConfiguration::VALUE_INSTALL) { LogDebug("operation = " << it->second); - m_installMode = WRT_INSTALL_MODE_INSTALL_WGT; + m_installMode.extension = InstallMode::ExtensionType::WGT; it = m_CSCconfigurationMap.find(CSCConfiguration::KEY_PATH); if (it == m_CSCconfigurationMap.end()) { return showHelpAndQuit(); @@ -249,7 +248,8 @@ void WrtInstaller::OnCreate() return showHelpAndQuit(); } LogInfo("Installing package directly from directory"); - m_installMode = WRT_INSTALL_MODE_REINSTALL; + m_installMode.command = InstallMode::Command::REINSTALL; + m_installMode.extension = InstallMode::ExtensionType::DIR; m_packagePath = m_argv[2]; AddStep(&WrtInstaller::installStep); } else { @@ -276,10 +276,10 @@ void WrtInstaller::OnCreate() struct stat info; if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) { LogInfo("Installing package directly from directory"); - m_installMode = WRT_INSTALL_MODE_INSTALL_DIRECTORY; + m_installMode.extension = InstallMode::ExtensionType::DIR; } else { LogInfo("Installing from regular location"); - m_installMode = WRT_INSTALL_MODE_INSTALL_WGT; + m_installMode.extension = InstallMode::ExtensionType::WGT; } AddStep(&WrtInstaller::installStep); break; @@ -289,7 +289,8 @@ void WrtInstaller::OnCreate() break; case PKGMGR_REQ_REINSTALL: m_packagePath = m_argv[4]; - m_installMode = WRT_INSTALL_MODE_REINSTALL; + m_installMode.command = InstallMode::Command::REINSTALL; + m_installMode.extension = InstallMode::ExtensionType::DIR; AddStep(&WrtInstaller::installStep); break; default: @@ -312,8 +313,8 @@ void WrtInstaller::OnReset(bundle* /*b*/) void WrtInstaller::OnTerminate() { LogDebug("Wrt Shutdown now"); - PluginUtils::unlockPluginInstallation(m_installMode == - WRT_INSTALL_MODE_INSTALL_PRELOAD); + PluginUtils::unlockPluginInstallation( + m_installMode.installTime == InstallMode::InstallTime::PRELOAD); if (m_initialized) { wrt_installer_shutdown(); } @@ -414,8 +415,9 @@ void WrtInstaller::installPluginsStep() if (m_startupPluginInstallation) { LogInfo("Plugin installation started because new plugin package found"); - } else if (!PluginUtils::lockPluginInstallation(m_installMode == - WRT_INSTALL_MODE_INSTALL_PRELOAD)) { + } else if (!PluginUtils::lockPluginInstallation( + m_installMode.installTime == InstallMode::InstallTime::PRELOAD)) + { LogError("Failed to open plugin installation lock file" " Plugins are currently installed by other process"); staticWrtPluginInstallationCallback(WRT_INSTALLER_ERROR_PLUGIN_INSTALLATION_FAILED, @@ -847,8 +849,9 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId, This->m_returnStatus = 0; resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS); - if (This->m_installMode == WRT_INSTALL_MODE_INSTALL_PRELOAD && - !This->m_packagePath.empty()) { + if (This->m_installMode.installTime == InstallMode::InstallTime::PRELOAD && + !This->m_packagePath.empty()) + { LogDebug("This widget is preloaded so it will be removed : " << This->m_packagePath); if (!WrtUtilRemove(This->m_packagePath)) { @@ -887,8 +890,9 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status, } //remove lock file - if (!PluginUtils::unlockPluginInstallation(This->m_installMode == - WRT_INSTALL_MODE_INSTALL_PRELOAD)) { + if (!PluginUtils::unlockPluginInstallation( + This->m_installMode.installTime == InstallMode::InstallTime::PRELOAD)) + { LogInfo("Failed to remove installation lock"); } @@ -981,16 +985,17 @@ void WrtInstaller::installNewPlugins() { LogDebug("Install new plugins"); - if (!PluginUtils::lockPluginInstallation(m_installMode == - WRT_INSTALL_MODE_INSTALL_PRELOAD)) { + if (!PluginUtils::lockPluginInstallation( + m_installMode.installTime == InstallMode::InstallTime::PRELOAD)) + { LogInfo("Lock NOT created"); return; } if (!PluginUtils::checkPluginInstallationRequired()) { LogDebug("Plugin installation not required"); - PluginUtils::unlockPluginInstallation(m_installMode == - WRT_INSTALL_MODE_INSTALL_PRELOAD); + PluginUtils::unlockPluginInstallation( + m_installMode.installTime == InstallMode::InstallTime::PRELOAD); return; } diff --git a/src/wrt-installer/wrt-installer.h b/src/wrt-installer/wrt-installer.h index da75d42..59bcc90 100644 --- a/src/wrt-installer/wrt-installer.h +++ b/src/wrt-installer/wrt-installer.h @@ -29,6 +29,7 @@ #include #include #include +#include namespace WRTInstallerNS { //anonymous DECLARE_GENERIC_EVENT_0(QuitEvent) @@ -122,7 +123,7 @@ class WrtInstaller : // Private data std::shared_ptr pkgmgrSignalInterface; - WrtInstallMode m_installMode; + InstallMode m_installMode; std::string m_packagePath; std::string m_name; bool m_initialized; diff --git a/src/wrt-installer/wrt_installer_api.cpp b/src/wrt-installer/wrt_installer_api.cpp index bb84730..83b5172 100644 --- a/src/wrt-installer/wrt_installer_api.cpp +++ b/src/wrt-installer/wrt_installer_api.cpp @@ -45,31 +45,10 @@ #include #include #include +#include using namespace WrtDB; -#ifdef __cplusplus - -#define EXPORT_API __attribute__((visibility("default"))) -extern "C" -{ -#endif -inline InstallMode::Type translateInstallMode( - WrtInstallMode installMode) -{ - if (WRT_INSTALL_MODE_INSTALL_WGT == installMode) { - return InstallMode::INSTALL_MODE_WGT; - } else if (WRT_INSTALL_MODE_INSTALL_DIRECTORY == installMode) { - return InstallMode::INSTALL_MODE_DIRECTORY; - } else if (WRT_INSTALL_MODE_INSTALL_PRELOAD == installMode) { - return InstallMode::INSTALL_MODE_PRELOAD; - } else if (WRT_INSTALL_MODE_REINSTALL == installMode) { - return InstallMode::REINSTALL_MODE_DIRECTORY; - } - Assert(true && "wrong argument is inputed"); - return InstallMode::WRONG_INSTALL_MODE; -} - static std::string cutOffFileName(const std::string& path) { size_t found = path.find_last_of("/"); @@ -102,7 +81,7 @@ static bool checkPaths() return if_ok; } -EXPORT_API void wrt_installer_init(void *userdata, +void wrt_installer_init(void *userdata, WrtInstallerInitCallback callback) { // Set DPL/LOG MID @@ -164,7 +143,7 @@ EXPORT_API void wrt_installer_init(void *userdata, return; } -EXPORT_API void wrt_installer_shutdown() +void wrt_installer_shutdown() { try { LogInfo("[WRT-API] DEINITIALIZING WRT INSTALLER..."); @@ -189,19 +168,19 @@ EXPORT_API void wrt_installer_shutdown() } } -EXPORT_API void wrt_install_widget( +void wrt_install_widget( const char *path, void* userdata, WrtInstallerStatusCallback status_cb, WrtProgressCallback progress_cb, - WrtInstallMode installMode, + InstallMode installMode, std::shared_ptr pkgmgrInterface ) { UNHANDLED_EXCEPTION_HANDLER_BEGIN { - if ( WRT_INSTALL_MODE_INSTALL_PRELOAD == installMode) { + if (InstallMode::InstallTime::PRELOAD == installMode.installTime) { DPL::Log::OldStyleLogProvider *oldStyleProvider = new DPL::Log::OldStyleLogProvider(false, false, false, true, false, true); @@ -218,13 +197,13 @@ EXPORT_API void wrt_install_widget( InstallerCallbacksTranslate::installProgressCallback, new InstallerCallbacksTranslate::StatusCallbackStruct( userdata, status_cb, progress_cb), - translateInstallMode(installMode), + installMode, pkgmgrInterface))); } UNHANDLED_EXCEPTION_HANDLER_END } -EXPORT_API void wrt_uninstall_widget( +void wrt_uninstall_widget( const char * const tzAppid, void* userdata, WrtInstallerStatusCallback status_cb, @@ -254,7 +233,7 @@ EXPORT_API void wrt_uninstall_widget( UNHANDLED_EXCEPTION_HANDLER_END } -EXPORT_API void wrt_install_plugin( +void wrt_install_plugin( const char *pluginDir, void *user_param, WrtPluginInstallerStatusCallback status_cb, @@ -282,7 +261,3 @@ EXPORT_API void wrt_install_plugin( } UNHANDLED_EXCEPTION_HANDLER_END } - -#ifdef __cplusplus -} -#endif diff --git a/src/wrt-installer/wrt_installer_api.h b/src/wrt-installer/wrt_installer_api.h index 512168b..694c9d1 100644 --- a/src/wrt-installer/wrt_installer_api.h +++ b/src/wrt-installer/wrt_installer_api.h @@ -27,13 +27,10 @@ #include #include #include +#include #include #include -#ifdef __cplusplus -extern "C" { -#endif - typedef void (*WrtInstallerInitCallback)(WrtErrStatus status, void *data); typedef void (*WrtPluginInstallerStatusCallback)(WrtErrStatus status, @@ -45,15 +42,6 @@ typedef void (*WrtProgressCallback)(float percent, const char *description, void *data); -enum WrtInstallMode -{ - WRT_INSTALL_MODE_UNKNOWN = 0, - WRT_INSTALL_MODE_INSTALL_WGT, - WRT_INSTALL_MODE_INSTALL_DIRECTORY, - WRT_INSTALL_MODE_INSTALL_PRELOAD, - WRT_INSTALL_MODE_REINSTALL -}; - void wrt_installer_init( void *userdata, WrtInstallerInitCallback callback); @@ -63,7 +51,7 @@ void wrt_install_widget( void *user_parameter, WrtInstallerStatusCallback status_callback, WrtProgressCallback progress_callback, - WrtInstallMode install_mode, + InstallMode install_mode, std::shared_ptr pkgmgrInterface ); @@ -79,8 +67,4 @@ void wrt_install_plugin(const char *pluginDirectory, WrtPluginInstallerStatusCallback statusCallback, WrtProgressCallback progressCallback); -#ifdef __cplusplus -} -#endif - #endif /* WRT_INSTALLER_API_H_ */ -- 2.7.4