37164889c73830b4809320c1750adc8f38700da7
[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 <dpl/string.h>
28 #include <dpl/wrt-dao-rw/widget_dao.h>
29 #include <widget_install/wac_security.h>
30 #include <feature_logic.h>
31 #include <widget_install/widget_update_info.h>
32
33 namespace Jobs {
34 namespace WidgetInstall {
35 class JobWidgetInstall;
36 } //namespace Jobs
37 } //namespace WidgetInstall
38
39 class WidgetModel;
40
41 typedef std::map<DPL::String, bool> RequestedDevCapsMap;
42
43 struct InstallerContext
44 {
45     typedef enum InstallStepEnum
46     {
47         INSTALL_START = 0,
48         INSTALL_CHECK_FILE,
49         INSTALL_CREATE_TEMPDIR,
50         INSTALL_UNZIP_FILES,
51         INSTALL_WIDGET_CONFIG1,
52         INSTALL_WIDGET_CONFIG2,
53         INSTALL_WIDGET_CONFIG3,
54         INSTALL_WIDGET_CONFIG4,
55         INSTALL_WIDGET_CONFIG5,
56         INSTALL_DIGSIG_CHECK,
57         INSTALL_CERT_CHECK,
58         INSTALL_DB_UPDATE,
59         INSTALL_DIR_CREATE,
60         INSTALL_RENAME_PATH,
61
62         INSTALL_CREATE_BACKUP_DIR = INSTALL_DB_UPDATE, /* For Update */
63         INSTALL_BACKUP_RES_FILES,                      /* For Update */
64         INSTALL_BACKUP_EXEC,                           /* For Update */
65         INSTALL_NEW_DB_INSERT,                         /* For Update */
66
67         INSTALL_CREATE_PRIVATE_STORAGE,
68         INSTALL_LINK_DEPENDS_DIRECTORY,
69         INSTALL_ACE_PREPARE,
70         INSTALL_ACE_CHECK,
71         INSTALL_SMACK_ENABLE,
72         INSTALL_BACKUP_ICONFILE,                         /* For Update */
73         INSTALL_COPY_ICONFILE,
74         INSTALL_CREATE_EXECFILE,
75         INSTALL_CREATE_MANIFEST,
76         INSTALL_CREATE_DESKTOP,
77         INSTALL_CREATE_SHORTCUT,
78         INSTALL_INSTALL_OSPSVC,
79
80         INSTALL_UPDATE_DESKTOP = INSTALL_CREATE_DESKTOP, /* For Update */
81         INSTALL_DELETE_OLD_DB,                           /* For Update */
82         INSTALL_REMOVE_BACKUP_FILE,
83
84         INSTALL_END
85     } InstallStep;
86
87     // Installation state variables
88     std::string widgetSource;           ///< Source widget zip file/widget url
89     std::string tempWidgetPath;           ///< Unpacked widget temporary path
90     bool browserRequest;                ///< Browser Request
91     std::string installedIconPath;                ///< Installed icon path
92     WrtDB::WidgetRegisterInfo widgetConfig;      ///< WidgetConfigInfo
93     DPL::Optional<WrtDB::DbWidgetHandle> widgetHandle;
94     Jobs::WidgetInstall::WacSecurity wacSecurity;///< Widget Domain information.
95     InstallStep installStep;              ///< current step of installation
96     Jobs::WidgetInstall::JobWidgetInstall *job;
97         ///< pointer of instance of JobWidgetInstall
98     WidgetUpdateInfo::ExistingWidgetInfo existingWidgetInfo;
99         ///< Whether this is an update or normal installation
100     Jobs::WidgetInstall::FeatureLogicPtr featureLogic;
101     /** List of dev-caps that are requested in widget config file.
102     * Additional flag tells whether dev cap gets "static" permission
103     * (will always have PERMIT from ACE Policy). They will therefore receive
104     * static SMACK permission. (They may be forbidden because
105     * of ACE User Settings, but for now we do not protect this
106     * case with SMACK). */
107     RequestedDevCapsMap staticPermittedDevCaps;
108     std::string installInfo;            ///<For recovery>
109     bool m_quiet;
110
111     std::string tempWidgetRoot;         ///< temporary widget root path
112     std::string installPath;            ///< widget install path
113 };
114
115 #endif // INSTALLER_CONTEXT_H