tizen 2.4 release
[framework/web/wrt-installer.git] / src / jobs / job.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 INSTALLER_MODEL_H
17 #define INSTALLER_MODEL_H
18
19 #include <dpl/mutable_task_list.h>
20
21 #include <job_types.h>
22
23 namespace Jobs {
24 class JobExceptionBase;
25
26 typedef int JobHandle;
27
28 class Job :
29     public DPL::MutableTaskList
30 {
31   public:
32     Job(InstallationType installType);
33
34     InstallationType GetInstallationType() const;
35
36     // Undo
37     void SetAbortStarted(bool flag);
38     bool GetAbortStarted() const;
39
40     // Pause/resume support
41     bool IsPaused() const;
42     void SetPaused(bool paused);
43     void Pause();
44     void Resume();
45     void SetJobHandle(JobHandle handle);
46     JobHandle GetJobHandle() const;
47     virtual void SendProgress();
48     virtual void SendFinishedSuccess();
49     virtual void SendFinishedFailure();
50     virtual void SendProgressIconPath(const std::string &path);
51
52     virtual void SaveExceptionData(const Jobs::JobExceptionBase&);
53
54   private:
55     JobHandle m_handle;
56     InstallationType m_installationType;
57     bool m_abortStarted;
58     bool m_paused;
59 };
60 } //namespace Jobs
61
62 #endif // INSTALLER_MODEL_H