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