Add preload web app for installer
[framework/web/wrt-installer.git] / src / jobs / widget_uninstall / job_widget_uninstall.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 job_widet_uninstall.h
18  * @brief Uninstaller header file.
19  * @author Radoslaw Wicik r.wicik@samsung.com
20  */
21
22 #ifndef WRT_SRC_INSTALLER_CORE_JOB_WIDGET_UNINSTALL_JOB_WIDGET_UNINSTALL_H_
23 #define WRT_SRC_INSTALLER_CORE_JOB_WIDGET_UNINSTALL_JOB_WIDGET_UNINSTALL_H_
24
25 #include <string>
26 #include <job.h>
27 #include <job_base.h>
28 #include <widget_uninstall/widget_uninstaller_struct.h>
29 #include <widget_uninstall/uninstaller_context.h>
30
31 namespace Jobs {
32 namespace WidgetUninstall {
33
34 enum class WidgetStatus
35 {
36     Ok, NOT_INSTALLED, PREALOAD, ABNORMAL, UNRECOGNIZED
37 };
38
39 class JobWidgetUninstall :
40     public Job,
41     public JobProgressBase<UninstallerContext::UninstallStep,
42                            UninstallerContext::UNINSTALL_END>,
43     public JobContextBase<WidgetUninstallationStruct>   //TODO typedef
44 {
45   private:
46     UninstallerContext m_context;
47
48     //TODO move it to base class of all jobs
49     Jobs::Exceptions::Type m_exceptionCaught;
50     std::string m_exceptionMessage;
51
52   public:
53     /**
54      * @brief Uninstaller must to know which widget to uninstall.
55      *
56      * @param[in] WrtDB::TizenAppId tzAppId - widget to uninstall
57      */
58     JobWidgetUninstall(const std::string &tizenAppId,
59                        const WidgetUninstallationStruct& uninstallerStruct);
60
61     std::string getRemovedTizenId() const;
62     bool getRemoveStartedFlag() const;
63     bool getRemoveFinishedFlag() const;
64
65     WidgetStatus getWidgetStatus(const std::string &appId);
66
67     void SendProgress();
68     void SendFinishedSuccess();
69     void SendFinishedFailure();
70     void SaveExceptionData(const Jobs::JobExceptionBase &e);
71 };
72 } //namespace WidgetUninstall
73 } //namespace Jobs
74
75 #endif // WRT_SRC_INSTALLER_CORE_JOB_WIDGET_UNINSTALL_JOB_WIDGET_UNINSTALL_H_