update wrt_0.8.107
[platform/framework/web/wrt.git] / src / domain / widget_data_types.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  * This file  have been implemented in compliance with  W3C WARP SPEC.
18  * but there are some patent issue between  W3C WARP SPEC and APPLE.
19  * so if you want to use this file, refer to the README file in root directory
20  */
21 /**
22  * @file       widget_data_types.h
23  * @author     Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
24  * @version    0.1
25  * @brief
26  */
27
28 #ifndef WRT_SRC_DOMAIN_WIDGET_DATA_TYPES_H_
29 #define WRT_SRC_DOMAIN_WIDGET_DATA_TYPES_H_
30
31 #include <list>
32
33 #include <dpl/utils/warp_iri.h>
34 #include <dpl/utils/widget_version.h>
35 #include <dpl/optional_typedefs.h>
36 #include <dpl/wrt-dao-ro/common_dao_types.h>
37
38 // WidgetIcon, LanguageTagsList, OptionalWidgetStartFileInfo,
39 // WidgetStartFileInfo
40 #include <dpl/localization/localization_utils.h>
41
42 enum WidgetStandard
43 {
44     WidgetStandard_Unknown,
45     WidgetStandard_Wac20
46 };
47
48 typedef std::list<WarpIRI> WarpIRIList;
49
50 /**
51  * @brief Execution phase according to BONDI
52  *
53  * WidgetExecutionPhase_Unknown:
54  *  Execution state is not defined
55  *
56  * WidgetExecutionPhase_WidgetInstall:
57  *  Applies to access control queries made by a Widget User Agent during the
58  *  processing of a Widget Resource as part of an installation or update
59  *  operation
60  *
61  * WidgetExecutionPhase_WidgetInstantiate:
62  *  Applies to access control queries made by a Widget User Agent during the
63  *  instantiation of a Widget
64  *
65  * WidgetExecutionPhase_WebkitBind:
66  *  Applies to access control queries made in response to a call to
67  *  requestFeature() in the course of execution of a Website
68  *
69  * WidgetExecutionPhase_Invoke:
70  *  Applies to access control queries made in response to invocation of a
71  *  JavaScript API in the course of execution of a Web Application
72  */
73 //enum WidgetExecutionPhase
74 //{
75 //    WidgetExecutionPhase_Unknown           = 0,
76 //    WidgetExecutionPhase_WidgetInstall     = 1 << 0,
77 //    WidgetExecutionPhase_WidgetInstantiate = 1 << 1,
78 //    WidgetExecutionPhase_WebkitBind        = 1 << 2,
79 //    WidgetExecutionPhase_Invoke            = 1 << 3
80 //};
81
82 /**
83  * Widget version is optional
84  */
85 typedef DPL::Optional<WidgetVersion> OptionalWidgetVersion;
86
87 class WidgetModel;
88
89 class WidgetAccessList
90 {
91   public:
92     WidgetAccessList();
93
94     WidgetAccessList(const WrtDB::WidgetAccessInfoList &widgetAccessInfoList);
95
96     bool getIsAccessAll() const;
97
98     const WarpIRIList* getWarpIRIList() const;
99
100     bool isRequiredIRI(const DPL::String &iri) const;
101
102     bool operator ==(const WidgetAccessList& other) const;
103
104   private:
105     WarpIRIList m_warpIriList;
106     bool m_isAccessAll;
107 };
108
109 struct WidgetStorageSize
110 {
111     WidgetStorageSize() :
112         applicationStorage(0),
113         dataStorage(0)
114     {
115     }
116     WidgetStorageSize(size_t pApplicationStorage,
117                       size_t pDataStorage) :
118         applicationStorage(pApplicationStorage),
119         dataStorage(pDataStorage)
120     {
121     }
122     size_t applicationStorage;
123     size_t dataStorage;
124 };
125
126 static const DPL::String SETTING_NAME_SCREEN_ORIENTATION =
127     L"screen-orientation";
128 static const DPL::String SETTING_NAME_INDICATOR_PRESENCE =
129     L"indicator-presence";
130 static const DPL::String SETTING_NAME_BACKBUTTON_PRESENCE =
131     L"backbutton-presence";
132 #ifndef DEPRECATED_SETTING_STRING
133 static const DPL::String SETTING_NAME_CONTEXTMENU =
134     L"contextmenu";
135 #endif
136 static const DPL::String SETTING_NAME_CONTEXT_MENU =
137     L"context-menu";
138 static const DPL::String SETTING_NAME_BACKGROUND_SUPPORT =
139     L"background-support";
140 static const DPL::String SETTING_VALUE_ENABLE =
141     L"enable";
142 static const DPL::String SETTING_VALUE_DISABLE =
143     L"disable";
144 static const DPL::String SETTING_NAME_ENCRYPTION=
145     L"encryption";
146 static const DPL::String SETTING_VALUE_SCREEN_ORIENTATION_PORTRAIT =
147     L"portrait";
148 static const DPL::String SETTING_VALUE_SCREEN_ORIENTATION_LANDSCAPE =
149     L"landscape";
150 static const DPL::String SETTING_VALUE_INDICATOR_PRESENCE_ENALBE =
151     L"enable";
152 static const DPL::String SETTING_VALUE_INDICATOR_PRESENCE_DISABLE =
153     L"disable";
154 static const DPL::String SETTING_VALUE_BACKBUTTON_PRESENCE_ENALBE =
155     L"enable";
156 static const DPL::String SETTING_VALUE_BACKBUTTON_PRESENCE_DISABLE =
157     L"disable";
158 static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE =
159     L"enable";
160 static const DPL::String SETTING_VALUE_ENCRYPTION_DISABLE =
161     L"disable";
162
163 enum WidgetSettingScreenLock
164 {
165     Screen_Portrait, /* Default */
166     Screen_Landscape
167 };
168
169 enum WidgetSettingIndicatorPresence
170 {
171     Indicator_Enable,     /* Default */
172     Indicator_Disable
173 };
174
175 enum WidgetSettingBackButtonPresence
176 {
177     BackButton_Enable,
178     BackButton_Disable     /* Default */
179 };
180
181 enum WidgetSettingContextMenu
182 {
183     ContextMenu_Enable,  /* Default */
184     ContextMenu_Disable
185 };
186
187 enum WidgetSettingEncryption
188 {
189     Encryption_Enable,
190     Encryption_Disable     /* Default */
191 };
192
193 enum WidgetSettingBackgroundSupport
194 {
195     BackgroundSupport_Enable,
196     BackgroundSupport_Disable    /* Default */
197 };
198
199 class WidgetSettingList
200 {
201   public:
202     WidgetSettingList();
203
204     WidgetSettingList(WidgetSettings &widgetSettings);
205
206     WidgetSettingScreenLock getRotationValue() const;
207
208     WidgetSettingIndicatorPresence getIndicatorPresence() const;
209
210     WidgetSettingBackButtonPresence getBackButtonPresence() const;
211
212     WidgetSettingContextMenu getContextMenu() const;
213
214     WidgetSettingEncryption getEncryption() const;
215
216     WidgetSettingBackgroundSupport getBackgroundSupport() const;
217
218     bool isEncrypted() const;
219
220     bool operator ==(const WidgetSettingList& other) const;
221
222   private:
223     WidgetSettingScreenLock m_RotationLock;
224     WidgetSettingIndicatorPresence m_IndicatorPresence;
225     WidgetSettingBackButtonPresence m_BackButtonPresence;
226     WidgetSettingContextMenu m_ContextMenu;
227     WidgetSettingEncryption m_Encryption;
228     WidgetSettingBackgroundSupport m_BackgroundSupport;
229 };
230
231 #endif /* WRT_SRC_DOMAIN_WIDGET_DATA_TYPES_H_ */