77ef647ac74bab475c0cec8b211d5fbbe3cf7dba
[framework/web/wrt-installer.git] / src / jobs / widget_install / widget_install_context.h
1 /*
2  * Copyright (c) 2011 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    installer_structs.h
18  * @author  Pawel Sikorski (p.sikorski@samgsung.com)
19  * @version
20  * @brief   Definition file of installer tasks data structures
21  */
22 #ifndef INSTALLER_CONTEXT_H
23 #define INSTALLER_CONTEXT_H
24
25 #include <map>
26 #include <string>
27 #include <memory>
28
29 #include <dpl/string.h>
30 #include <dpl/wrt-dao-rw/widget_dao.h>
31 #include <dpl/file_lock.h>
32
33 #include <widget_install/widget_security.h>
34 #include <feature_logic.h>
35 #include <widget_install/widget_update_info.h>
36 #include <widget_location.h>
37 #include <wrt_install_mode.h>
38
39
40 namespace Jobs {
41 namespace WidgetInstall {
42 class JobWidgetInstall;
43 } //namespace Jobs
44 } //namespace WidgetInstall
45
46 class WidgetModel;
47
48 typedef std::map<DPL::String, bool> RequestedDevCapsMap;
49
50 struct InstallerContext
51 {
52     typedef enum InstallStepEnum
53     {
54         INSTALL_START = 0,
55         INSTALL_CHECK_FILE,
56
57         INSTALL_RDS_DELTA_CHECK,
58         INSTALL_RDS_PREPARE,
59
60         INSTALL_WIDGET_CONFIG1,
61         INSTALL_WIDGET_CONFIG2,
62         INSTALL_DIGSIG_CHECK,
63         INSTALL_CERT_CHECK,
64         INSTALL_CERTIFY_LEVEL_CHECK,
65         INSTALL_ECRYPTION_FILES,
66         INSTALL_CREATE_BACKUP_DIR,                     /* For Update */
67         INSTALL_DIR_CREATE,
68         INSTALL_RENAME_PATH,
69         INSTALL_BACKUP_ICONFILE,                         /* For Update */
70         INSTALL_COPY_ICONFILE,
71         INSTALL_COPY_LIVEBOX_FILES,
72         INSTALL_CREATE_EXECFILE,
73         INSTALL_CREATE_MANIFEST,
74         INSTALL_INSTALL_OSPSVC,
75         INSTALL_NEW_DB_INSERT,
76         INSTALL_ACE_PREPARE,
77         INSTALL_ACE_CHECK,
78         INSTALL_SMACK_ENABLE,
79         INSTALL_PKGINFO_UPDATE,
80         INSTALL_SET_CERTINFO,
81
82         INSTALL_END
83     } InstallStep;
84
85     // Installation state variables
86     WrtDB::WidgetRegisterInfo widgetConfig;      ///< WidgetConfigInfo
87     DPL::Optional<WidgetLocation> locations;
88     Jobs::WidgetInstall::WidgetSecurity widgetSecurity; ///< Widget Domain
89                                                   // information.
90     InstallStep installStep;              ///< current step of installation
91     Jobs::WidgetInstall::JobWidgetInstall *job;
92      ///< Whether this is an update or normal installation
93     Jobs::WidgetInstall::FeatureLogicPtr featureLogic;
94     /** List of dev-caps that are requested in widget config file.
95      * Additional flag tells whether dev cap gets "static" permission
96      * (will always have PERMIT from ACE Policy). They will therefore receive
97      * static SMACK permission. (They may be forbidden because
98      * of ACE User Settings, but for now we do not protect this
99      * case with SMACK). */
100     RequestedDevCapsMap staticPermittedDevCaps;
101     std::string installInfo;            ///<For recovery>
102     InstallLocationType locationType;
103     bool isUpdateMode;
104     InstallMode mode;
105     DPL::String callerPkgId;
106
107     std::string requestedPath; ///input path of widget
108     bool needEncryption;  ///for configuring right task if encryption needed
109
110     std::unique_ptr<DPL::FileBasedMutex> installationLock;
111 };
112
113 #endif // INSTALLER_CONTEXT_H