2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file job_widget_install.h
18 * @author Radoslaw Wicik r.wicik@samsung.com
19 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
21 * @brief Implementation file for main installer task
23 #ifndef WRT_SRC_INSTALLER_CORE_JOB_JOB_WIDGET_INSTALL_H_
24 #define WRT_SRC_INSTALLER_CORE_JOB_JOB_WIDGET_INSTALL_H_
26 #include <dpl/optional.h>
27 #include <dpl/string.h>
30 #include <dpl/utils/widget_version.h>
31 #include <widget_install/widget_install_context.h>
32 #include <widget_install/widget_update_info.h>
33 #include <dpl/wrt-dao-ro/config_parser_data.h>
34 #include "widget_installer_struct.h"
37 namespace WidgetInstall {
38 class JobWidgetInstall :
40 public JobProgressBase<InstallerContext::InstallStep,
41 InstallerContext::INSTALL_END>,
42 public JobContextBase<WidgetInstallationStruct> //TODO typedef
45 typedef DPL::Optional<WidgetHandle> OptionalWidgetHandle;
47 InstallerContext m_installerContext;
49 //TODO move it to base class of all jobs -> make it base template class??
50 Exceptions::Type m_exceptionCaught;
51 std::string m_exceptionMessage;
52 WidgetUpdateInfo m_widgetUpdateInfo;
54 enum class ConfigureResult
56 Ok, Failed, Deferred, Updated
59 ConfigureResult ConfigureInstallation(const std::string &widgetSource,
60 const WrtDB::ConfigParserData
62 const WidgetUpdateInfo &update,
64 static WrtDB::ConfigParserData getWidgetDataFromXML(
65 const std::string &widgetSource,
66 bool fromBrowser, WrtDB::PkgType isOspsvc);
67 static WidgetUpdateInfo detectWidgetUpdate(
68 const WrtDB::ConfigParserData &configInfo);
69 WidgetUpdateMode::Type CalcWidgetUpdatePolicy(
70 const OptionalWidgetVersion &existingVersion,
71 const OptionalWidgetVersion &incomingVersion) const;
72 bool setTizenId(const WrtDB::ConfigParserData &configInfo,
73 ConfigureResult result);
74 void displayWidgetInfo();
75 void configureWidgetLocation(const std::string & widgetPath, bool browserRequest);
77 WrtDB::PackagingType checkPackageType(
78 const std::string &widgetSorce);
79 bool detectResourceEncryption(const WrtDB::ConfigParserData &configData);
80 std::string generateTizenId();
84 * @brief Automaticaly sets installation process
86 JobWidgetInstall(std::string const & widgetPath,
87 const WidgetInstallationStruct &installerStruct);
89 DPL::OptionalString getNewTizenId() const;
93 void SendFinishedSuccess();
94 void SendFinishedFailure();
95 void SaveExceptionData(const Jobs::JobExceptionBase&);
97 } //namespace WidgetInstall
100 #endif // WRT_SRC_INSTALLER_CORE_JOB_JOB_WIDGET_INSTALL_H_