[Release] wrt_0.8.213
[platform/framework/web/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 <dpl/event/model.h>
26 #include <dpl/event/property.h>
27 #include <dpl/optional.h>
28 #include <dpl/optional_typedefs.h>
29 #include <string>
30
31 #include "widget_data_types.h"
32
33 #include <dpl/wrt-dao-ro/wrt_db_types.h> // definition of WidgetHandle
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 Current widget actual size
91      */
92     DPL::Event::Property<WidgetSize> ActualSize;
93
94     /**
95      * @brief Current widget preferred size
96      */
97     DPL::Event::Property<WidgetSize,
98                          DPL::Event::PropertyReadOnly,
99                          DPL::Event::PropertyStorageDynamicCached>
100     PreferredSize;
101
102     /**
103      * @brief Start URL for widget
104      */
105     DPL::Event::Property<DPL::OptionalString> StartURL;
106
107     /**
108      * @brief Start URL information for widget
109      */
110     DPL::Event::Property<OptionalWidgetStartFileInfo> StartFileInfo;
111
112     /**
113      * @brief Prefix URL for widget
114      *
115      * This is a prefix address of html file that widget is displaying.
116      * The whole address is PrefixURL + StartURL.
117      */
118     DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PrefixURL;
119
120     /**
121      * @brief Install path for widget
122      *
123      * Gets path in which files of widget are being kept
124      */
125     DPL::Event::Property<DPL::String,
126                          DPL::Event::PropertyReadOnly,
127                          DPL::Event::PropertyStorageDynamicCached> InstallPath;
128
129     /**
130      * @brief Path to widget's persistent storage.
131      *
132      * Gets path in which widget may store its persistent private data.
133      */
134     DPL::Event::Property<DPL::String> PersistentStoragePath;
135
136     /**
137      * @brief Path to widget's temporary storage.
138      *
139      * Gets path in which widget may store its temporary private data.
140      */
141     DPL::Event::Property<DPL::String> TemporaryStoragePath;
142
143     /**
144      * @brief Widget defaultlocale
145      */
146     DPL::Event::Property<DPL::OptionalString,
147                          DPL::Event::PropertyReadOnly,
148                          DPL::Event::PropertyStorageDynamicCached>
149     defaultlocale;
150
151     /**
152      * @brief Widget name
153      */
154     DPL::Event::Property<DPL::OptionalString> Name;
155
156     /**
157      * @brief Widget short name
158      */
159     DPL::Event::Property<DPL::OptionalString> ShortName;
160
161     /**
162      * @brief Widget description
163      */
164     DPL::Event::Property<DPL::OptionalString> Description;
165
166     /**
167      * @brief Widget license
168      */
169     DPL::Event::Property<DPL::OptionalString> License;
170
171     /**
172      * @brief Widget license href
173      */
174     DPL::Event::Property<DPL::OptionalString> LicenseHref;
175
176     /**
177      * @brief Widget icon
178      */
179     DPL::Event::Property<OptionalWidgetIcon> Icon;
180
181     /**
182      * @brief Widget splash image src
183      */
184     DPL::Event::Property<DPL::OptionalString,
185                          DPL::Event::PropertyReadOnly,
186                          DPL::Event::PropertyStorageDynamicCached> SplashImg;
187
188     /**
189      * @brief window mode
190      */
191     DPL::Event::Property<WrtDB::WindowModeList,
192                          DPL::Event::PropertyReadOnly,
193                          DPL::Event::PropertyStorageDynamic> WindowModes;
194
195     //    /**
196     //     * @brief Value of network element.
197     //     */
198     //    DPL::Event::Property<bool,
199     //                  DPL::Event::PropertyReadOnly> AccessNetwork;
200
201     //    /**
202     //     * @brief Does widget contain WARP definitions.
203     //     */
204     //    DPL::Event::Property<bool> WarpDefinitionEmpty;
205
206     /**
207      * @brief Is back supported
208      */
209     DPL::Event::Property<bool,
210                          DPL::Event::PropertyReadOnly,
211                          DPL::Event::PropertyStorageDynamicCached>
212     BackSupported;
213
214     /**
215      * @brief Widget access list
216      */
217     DPL::Event::Property<WidgetAccessList> AccessList;
218
219     DPL::Event::Property<WidgetSettingList> SettingList;
220
221     /**
222      * @brief Widget app-control list
223      */
224     DPL::Event::Property<WrtDB::WidgetAppControlList> AppControlList;
225     DPL::Event::Property<DPL::OptionalUInt> AppControlIndex;
226
227     DPL::Event::Property<WrtDB::WidgetSecurityModelVersion,
228                          DPL::Event::PropertyReadOnly,
229                          DPL::Event::PropertyStorageDynamicCached> SecurityModelVersion;
230
231     DPL::Event::Property<WrtDB::SettingsType,
232                          DPL::Event::PropertyReadOnly,
233                          DPL::Event::PropertyStorageDynamicCached> SecurePopupUsage;
234     DPL::Event::Property<WrtDB::SettingsType,
235                          DPL::Event::PropertyReadOnly,
236                          DPL::Event::PropertyStorageDynamicCached> GeolocationUsage;
237     DPL::Event::Property<WrtDB::SettingsType,
238                          DPL::Event::PropertyReadOnly,
239                          DPL::Event::PropertyStorageDynamicCached> WebNotificationUsage;
240     DPL::Event::Property<WrtDB::SettingsType,
241                          DPL::Event::PropertyReadOnly,
242                          DPL::Event::PropertyStorageDynamicCached> WebStorageUsage;
243
244     WidgetModel(const std::string &tizenId);
245
246   private:
247     DPL::String getTizenId() const;
248 };
249
250 #endif // SRC_DOMAIN_WIDGET_MODEL_H