39e47016c582d7d788379fcdaae8767d25b84882
[framework/web/wrt-installer.git] / src_mobile / jobs / widget_install / task_configuration.h
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 /**
17  * @file    task_configuration.h
18  * @version 1.0
19  * @author  Tomasz Iwanek
20  * @brief   header file for configuration task
21  */
22 #ifndef TASK_CONFIGURATION_H
23 #define TASK_CONFIGURATION_H
24
25 #include <string>
26
27 #include <dpl/task_list.h>
28 #include <dpl/wrt-dao-ro/config_parser_data.h>
29
30 #include <widget_install/widget_update_info.h>
31 #include <widget_install/widget_install_context.h>
32
33 #include <pkg-manager/pkgmgr_signal.h>
34
35 class InstallerContext;
36
37 namespace Jobs {
38 namespace WidgetInstall {
39
40 class TaskConfiguration : public DPL::TaskDecl<TaskConfiguration>
41 {
42     InstallerContext& m_context;
43     std::string m_tempDir;
44     WrtDB::ConfigParserData &m_widgetConfig;
45     std::string m_configuration;
46
47     WidgetUpdateInfo m_widgetUpdateInfo;
48
49     void parseWidgetXMLConfig(
50         const std::string &widgetSource,
51         const std::string &tempPath,
52         WrtDB::PackagingType pkgType,
53         bool isReinstall);
54
55     static WidgetUpdateInfo detectWidgetUpdate(
56         const WrtDB::ConfigParserData &configInfo,
57         const WrtDB::TizenAppId &tizenId);
58
59     bool validateTizenApplicationID(const WrtDB::TizenAppId &tizenAppId);
60     bool validateTizenPackageID(const WrtDB::TizenPkgId &tizenPkgId);
61     bool checkWidgetUpdate(const WidgetUpdateInfo &update);
62     void ApplicationTypeStep(const WrtDB::ConfigParserData &configInfo);
63     bool checkSupportRDSUpdateIfReinstall(const WrtDB::ConfigParserData &configInfo);
64     bool getDefaultExternalStorage();
65     bool getMMCStatus();
66
67     std::shared_ptr<PackageManager::IPkgmgrSignal> pkgMgrInterface();
68
69     //steps
70     void StartStep();
71
72     void SetupTempDirStep();
73     void UnzipConfigurationStep();
74     void ParseXMLConfigStep();
75
76     void TizenIdStep();
77     void CheckAppRunningStateStep();
78     void DetectUpdateInstallationStep();
79     void PkgmgrStartStep();
80
81     void ApplicationTypeStep();
82     void ResourceEncryptionStep();
83     void InstallationFSLocationStep();
84
85     void ConfigureWidgetLocationStep();
86     void CheckRDSSupportStep();
87
88     void AppendTasklistStep();
89     void EndStep();
90
91 public:
92     TaskConfiguration(InstallerContext& context);
93 };
94
95 }
96 }
97
98 #endif // TASK_CONFIGURATION_H