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 task_widget_config.h
18 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20 * @brief Implementation file for installer task widget config
22 #ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H
23 #define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H
29 #include <dpl/task_list.h>
30 #include <dpl/string.h>
31 #include <dpl/optional.h>
32 #include <dpl/wrt-dao-ro/config_parser_data.h>
33 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
34 #include <dpl/wrt-dao-ro/global_config.h>
36 #include <wrt_common_types.h>
38 class InstallerContext;
41 namespace WidgetInstall {
43 class TaskWidgetConfig :
44 public DPL::TaskDecl<TaskWidgetConfig>
50 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
51 DECLARE_EXCEPTION_TYPE(Base, ConfigParseFailed)
54 typedef std::list<std::pair<DPL::String, DPL::String> > StringPairList;
56 InstallerContext& m_installContext;
57 WrtDB::LocaleSet m_localeFolders;
58 std::set<DPL::String> m_processedIconSet;
60 void StepProcessConfigurationFile();
61 void ReadLocaleFolders();
62 void ProcessLocalizedStartFiles();
63 void ProcessStartFile(
64 const DPL::OptionalString& path,
65 const DPL::OptionalString& type,
66 const DPL::OptionalString& encoding =
67 DPL::OptionalString::Null,
68 bool typeForcedInConfig = false);
69 void ProcessBackgroundPageFile();
70 void ProcessLocalizedIcons();
71 void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon);
72 void ProcessWidgetInstalledPath();
73 void ProcessAppControlInfo();
74 void ProcessSecurityModel();
75 void StepVerifyFeatures();
76 void StepVerifyLivebox();
77 void StepCheckMinVersionInfo();
79 template <typename Ex, const char* Msg>
80 void StepCancelInstallation();
85 DPL::String createAuthorWidgetInfo() const;
86 bool isFeatureAllowed(
87 WrtDB::AppType appType, DPL::String featureName);
88 bool isMinVersionCompatible(
89 WrtDB::AppType appType,
90 const DPL::OptionalString &widgetVersion) const;
92 * @brief Parses version string in format "major.minor.micro anything"
93 * Returns false if format is invalid
95 bool isTizenWebApp() const;
96 bool parseVersionString(const std::string &version, long &majorVersion,
97 long &minorVersion, long µVersion) const;
99 * This method is used to process the config.xml of widget, get
100 * the corresponding configuration to pWidgetConfigInfo
102 * @param[in] path Specified the widget archive file path (absolute path).
103 * @return Configuration information of widget
105 void processFile(const std::string& path,
106 WrtDB::WidgetRegisterInfo &wConfig);
108 bool locateAndParseConfigurationFile(
109 const std::string& currentPath,
110 WrtDB::WidgetRegisterInfo&
112 const std::string& baseFolder);
113 bool parseConfigurationFileBrowser(WrtDB::ConfigParserData& configInfo,
114 const std::string& _currentPath);
115 bool parseConfigurationFileWidget(WrtDB::ConfigParserData& configInfo,
116 const std::string& _currentPath);
117 bool fillWidgetConfig(WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
118 WrtDB::ConfigParserData& configInfo);
121 TaskWidgetConfig(InstallerContext& installTaskContext);
123 } //namespace WidgetInstall
126 #endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H