tizen 2.3.1 release
[framework/web/mobile/wrt.git] / src / domain / widget_model.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    widget_model.h
18  * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
19  * @version 1.0
20  * @brief   Header file for widget model
21  */
22 #ifndef SRC_DOMAIN_WIDGET_MODEL_H
23 #define SRC_DOMAIN_WIDGET_MODEL_H
24
25 #include <memory>
26 #include <string>
27
28 #include <dpl/event/model.h>
29 #include <dpl/event/property.h>
30 #include <dpl/optional_typedefs.h>
31 #include <dpl/wrt-dao-ro/wrt_db_types.h> // definition of WidgetHandle
32
33 #include "widget_data_types.h"
34
35 /**
36  * @brief Widget model
37  *
38  * Widget model is the core object that hold information about
39  * properties of widget. After wrt launch each widget contained in database is
40  * mapped to WidgetModel.
41  *
42  * Widget model is a type of MVC model, so it is possible to listen for it's
43  * changes.
44  *
45  */
46 class WidgetModel : public DPL::Event::Model
47 {
48   public:
49
50     /**
51      * @brief Tizen id
52      *
53      *  ex> "TizenIDabc.appname"
54      *
55      *  - TizenId / AppId : "TizenIDabc.appname"
56      *  - TzPkgId         : "TizenIDabc"
57      *  - App name        : "appname"
58      *
59      */
60     DPL::String TizenId;
61     DPL::Event::Property<WrtDB::TizenPkgId,
62                          DPL::Event::PropertyReadOnly,
63                          DPL::Event::PropertyStorageDynamicCached> TzPkgId;
64
65     /**
66      * @brief Widget type
67      *
68      * Note: This is a readonly property
69      */
70     DPL::Event::Property<WrtDB::WidgetType,
71                          DPL::Event::PropertyReadOnly,
72                          DPL::Event::PropertyStorageDynamicCached> Type;
73
74     /**
75      * @brief Config file based csp policy
76      */
77     DPL::Event::Property<DPL::OptionalString,
78                          DPL::Event::PropertyReadOnly,
79                          DPL::Event::PropertyStorageDynamicCached> CspPolicy;
80
81     /**
82      * @brief Config file based csp policy - report only
83      */
84     DPL::Event::Property<DPL::OptionalString,
85                          DPL::Event::PropertyReadOnly,
86                          DPL::Event::PropertyStorageDynamicCached>
87     CspReportOnlyPolicy;
88
89     /**
90      * @brief Start URL for widget
91      */
92     DPL::Event::Property<DPL::OptionalString> StartURL;
93
94     /**
95      * @brief Start URL information for widget
96      */
97     DPL::Event::Property<OptionalWidgetStartFileInfo> StartFileInfo;
98
99     /**
100      * @brief Prefix URL for widget
101      *
102      * This is a prefix address of html file that widget is displaying.
103      * The whole address is PrefixURL + StartURL.
104      */
105     DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PrefixURL;
106
107     /**
108      * @brief Install path for widget
109      *
110      * Gets path in which files of widget are being kept
111      */
112     DPL::Event::Property<DPL::String,
113                          DPL::Event::PropertyReadOnly,
114                          DPL::Event::PropertyStorageDynamicCached> InstallPath;
115
116     /**
117      * @brief Path to widget's persistent storage.
118      *
119      * Gets path in which widget may store its persistent private data.
120      */
121     DPL::Event::Property<DPL::String> PersistentStoragePath;
122
123     /**
124      * @brief Path to widget's temporary storage.
125      *
126      * Gets path in which widget may store its temporary private data.
127      */
128     DPL::Event::Property<DPL::String> TemporaryStoragePath;
129
130     /**
131      * @brief Widget defaultlocale
132      */
133     DPL::Event::Property<DPL::OptionalString,
134                          DPL::Event::PropertyReadOnly,
135                          DPL::Event::PropertyStorageDynamicCached>
136     defaultlocale;
137
138     /**
139      * @brief Widget name
140      */
141     DPL::Event::Property<DPL::OptionalString> Name;
142
143     /**
144      * @brief Widget short name
145      */
146     DPL::Event::Property<DPL::OptionalString> ShortName;
147
148     /**
149      * @brief Widget description
150      */
151     DPL::Event::Property<DPL::OptionalString> Description;
152
153     /**
154      * @brief Widget license
155      */
156     DPL::Event::Property<DPL::OptionalString> License;
157
158     /**
159      * @brief Widget license href
160      */
161     DPL::Event::Property<DPL::OptionalString> LicenseHref;
162
163     /**
164      * @brief Widget icon
165      */
166     DPL::Event::Property<OptionalWidgetIcon> Icon;
167
168     /**
169      * @brief Widget splash image src
170      */
171     DPL::Event::Property<DPL::OptionalString,
172                          DPL::Event::PropertyReadOnly,
173                          DPL::Event::PropertyStorageDynamicCached> SplashImg;
174
175     /**
176      * @brief Widget TizenRequired(minimum) Version
177      */
178     DPL::Event::Property<DPL::OptionalString,
179                          DPL::Event::PropertyReadOnly,
180                          DPL::Event::PropertyStorageDynamicCached> RequiredVersion;
181
182     /**
183      * @brief window mode
184      */
185     DPL::Event::Property<WrtDB::WindowModeList,
186                          DPL::Event::PropertyReadOnly,
187                          DPL::Event::PropertyStorageDynamic> WindowModes;
188
189     //    /**
190     //     * @brief Value of network element.
191     //     */
192     //    DPL::Event::Property<bool,
193     //                  DPL::Event::PropertyReadOnly> AccessNetwork;
194
195     //    /**
196     //     * @brief Does widget contain WARP definitions.
197     //     */
198     //    DPL::Event::Property<bool> WarpDefinitionEmpty;
199
200     /**
201      * @brief Is back supported
202      */
203     DPL::Event::Property<bool,
204                          DPL::Event::PropertyReadOnly,
205                          DPL::Event::PropertyStorageDynamicCached>
206     BackSupported;
207
208     /**
209      * @brief Widget access list
210      */
211     DPL::Event::Property<WidgetAccessList> AccessList;
212
213     DPL::Event::Property<WidgetSettingList> SettingList;
214
215     /**
216      * @brief Widget app-control list
217      */
218     DPL::Event::Property<WrtDB::WidgetAppControlList> AppControlList;
219
220     /**
221      * @brief Widget Privilege list
222      */
223     DPL::Event::Property<WrtDB::PrivilegeList,
224                          DPL::Event::PropertyReadOnly,
225                          DPL::Event::PropertyStorageDynamic> WidgetPrivilegeList;
226
227     DPL::Event::Property<WrtDB::WidgetSecurityModelVersion,
228                          DPL::Event::PropertyReadOnly,
229                          DPL::Event::PropertyStorageDynamicCached> SecurityModelVersion;
230
231     WidgetModel(const std::string &tizenId);
232
233   private:
234     DPL::String getTizenId() const;
235 };
236 typedef std::shared_ptr<WidgetModel> WidgetModelPtr;
237
238 #endif // SRC_DOMAIN_WIDGET_MODEL_H