Add send signal if there is not enough memory during web app installation
[framework/web/wrt-installer.git] / src / logic / installer_logic.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 #ifndef WRT_SRC_INSTALLER_CORE_INSTALLER_LOGIC_H_
17 #define WRT_SRC_INSTALLER_CORE_INSTALLER_LOGIC_H_
18
19 #include <dpl/wrt-dao-rw/widget_dao.h>
20 #include <dpl/wrt-dao-ro/feature_model.h>
21 #include <widget_install/widget_installer_struct.h>
22 #include <widget_uninstall/widget_uninstaller_struct.h>
23 #include <plugin_install/plugin_installer_struct.h>
24 #include <job.h>
25 #include <installer_log.h>
26
27 namespace Logic {
28 class InstallerLogic
29 {
30     Jobs::Job* m_job;
31
32     void ResetProgressPlugins();
33     void InstallWaitingPlugins();
34     bool resolvePluginDependencies(PluginHandle handle);
35
36     Jobs::JobHandle m_NextHandle;
37     Jobs::JobHandle GetNewJobHandle()
38     {
39         return m_NextHandle++;
40     }
41     Jobs::JobHandle AddAndStartJob();
42
43   public:
44     virtual ~InstallerLogic();
45
46     void Initialize();
47
48     void Terminate();
49
50     Jobs::JobHandle InstallWidget(
51         const std::string & widgetPath,
52         const std::string & pkgId,
53         const Jobs::WidgetInstall::WidgetInstallationStruct &
54         installerStruct);
55
56     Jobs::JobHandle UninstallWidget(
57         const std::string & widgetPkgName,
58         const WidgetUninstallationStruct &
59         uninstallerStruct);
60
61     Jobs::JobHandle InstallPlugin(std::string const & pluginPath,
62                                   const PluginInstallerStruct &installerStruct);
63
64     bool NextStep(Jobs::Job* installModel);
65
66     //TODO implement me
67     bool AbortJob(const Jobs::JobHandle & /*handle*/)
68     {
69         _W("Not implemented");
70         return true;
71     }
72
73   private:
74     InstallerLogic();
75
76     friend class InstallerController;
77 };
78 }
79
80 #endif // INSTALLER_LOGIC_H