[Release] wrt_0.8.225
[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 #include <memory>
33
34 #include <dpl/utils/warp_iri.h>
35 #include <dpl/utils/widget_version.h>
36 #include <dpl/optional_typedefs.h>
37 #include <dpl/wrt-dao-ro/common_dao_types.h>
38
39 // WidgetIcon, LanguageTagsList, OptionalWidgetStartFileInfo,
40 // WidgetStartFileInfo
41 #include <dpl/localization/localization_utils.h>
42
43 typedef std::list<WarpIRI> WarpIRIList;
44
45 /**
46  * @brief Execution phase according to BONDI
47  *
48  * WidgetExecutionPhase_Unknown:
49  *  Execution state is not defined
50  *
51  * WidgetExecutionPhase_WidgetInstall:
52  *  Applies to access control queries made by a Widget User Agent during the
53  *  processing of a Widget Resource as part of an installation or update
54  *  operation
55  *
56  * WidgetExecutionPhase_WidgetInstantiate:
57  *  Applies to access control queries made by a Widget User Agent during the
58  *  instantiation of a Widget
59  *
60  * WidgetExecutionPhase_WebkitBind:
61  *  Applies to access control queries made in response to a call to
62  *  requestFeature() in the course of execution of a Website
63  *
64  * WidgetExecutionPhase_Invoke:
65  *  Applies to access control queries made in response to invocation of a
66  *  JavaScript API in the course of execution of a Web Application
67  */
68 //enum WidgetExecutionPhase
69 //{
70 //    WidgetExecutionPhase_Unknown           = 0,
71 //    WidgetExecutionPhase_WidgetInstall     = 1 << 0,
72 //    WidgetExecutionPhase_WidgetInstantiate = 1 << 1,
73 //    WidgetExecutionPhase_WebkitBind        = 1 << 2,
74 //    WidgetExecutionPhase_Invoke            = 1 << 3
75 //};
76
77 class WidgetModel;
78
79 class WidgetAccessList
80 {
81   public:
82     WidgetAccessList();
83
84     WidgetAccessList(const WrtDB::WidgetAccessInfoList &widgetAccessInfoList);
85
86     bool getIsAccessAll() const;
87
88     const WarpIRIList* getWarpIRIList() const;
89
90     bool isRequiredIRI(const DPL::String &iri) const;
91
92     bool operator ==(const WidgetAccessList& other) const;
93
94   private:
95     WarpIRIList m_warpIriList;
96     bool m_isAccessAll;
97 };
98
99 static const DPL::String SETTING_NAME_SCREEN_ORIENTATION =
100     L"screen-orientation";
101 static const DPL::String SETTING_NAME_INDICATOR_PRESENCE =
102     L"indicator-presence";
103 static const DPL::String SETTING_NAME_BACKBUTTON_PRESENCE =
104     L"backbutton-presence";
105  static const DPL::String SETTING_NAME_CONTEXT_MENU =
106     L"context-menu";
107 static const DPL::String SETTING_NAME_BACKGROUND_SUPPORT =
108     L"background-support";
109 static const DPL::String SETTING_NAME_USER_AGENT =
110     L"user-agent";
111 static const DPL::String SETTING_NAME_PROGRESSBAR_PRESENCE =
112     L"progressbar-presence";
113 static const DPL::String SETTING_NAME_HWKEY_EVENT =
114     L"hwkey-event";
115 static const DPL::String SETTING_VALUE_ENABLE =
116     L"enable";
117 static const DPL::String SETTING_VALUE_DISABLE =
118     L"disable";
119 static const DPL::String SETTING_NAME_ENCRYPTION =
120     L"encryption";
121 static const DPL::String SETTING_VALUE_SCREEN_ORIENTATION_PORTRAIT =
122     L"portrait";
123 static const DPL::String SETTING_VALUE_SCREEN_ORIENTATION_LANDSCAPE =
124     L"landscape";
125 static const DPL::String SETTING_VALUE_SCREEN_ORIENTATION_AUTO_ROTATION =
126     L"auto-rotation";
127 static const DPL::String SETTING_VALUE_INDICATOR_PRESENCE_ENALBE =
128     L"enable";
129 static const DPL::String SETTING_VALUE_INDICATOR_PRESENCE_DISABLE =
130     L"disable";
131 static const DPL::String SETTING_VALUE_BACKBUTTON_PRESENCE_ENALBE =
132     L"enable";
133 static const DPL::String SETTING_VALUE_BACKBUTTON_PRESENCE_DISABLE =
134     L"disable";
135 static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE =
136     L"enable";
137 static const DPL::String SETTING_VALUE_ENCRYPTION_DISABLE =
138     L"disable";
139 static const DPL::String SETTING_VALUE_PROGRESSBAR_PRESENCE_ENABLE =
140     L"enable";
141 static const DPL::String SETTING_VALUE_PROGRESSBAR_PRESENCE_DISABLE =
142     L"disable";
143 static const DPL::String SETTING_VALUE_HWKEY_EVENT_ENABLE =
144     L"enable";
145 static const DPL::String SETTING_VALUE_HWKEY_EVENT_DISABLE =
146     L"disable";
147
148 enum WidgetSettingScreenLock
149 {
150     Screen_Portrait, /* Default */
151     Screen_Landscape,
152     Screen_AutoRotation
153 };
154
155 enum WidgetSettingIndicatorPresence
156 {
157     Indicator_Enable,     /* Default */
158     Indicator_Disable
159 };
160
161 enum WidgetSettingBackButtonPresence
162 {
163     BackButton_Enable,
164     BackButton_Disable     /* Default */
165 };
166
167 enum WidgetSettingContextMenu
168 {
169     ContextMenu_Enable,  /* Default */
170     ContextMenu_Disable
171 };
172
173 enum WidgetSettingEncryption
174 {
175     Encryption_Enable,
176     Encryption_Disable     /* Default */
177 };
178
179 enum WidgetSettingBackgroundSupport
180 {
181     BackgroundSupport_Enable,
182     BackgroundSupport_Disable    /* Default */
183 };
184
185 enum WidgetSettingProgressBarPresence
186 {
187     ProgressBar_Enable,
188     ProgressBar_Disable    /* Default */
189 };
190
191 enum WidgetSettingHWkeyEventPresence
192 {
193     HWkeyEvent_Enable,    /* Default */
194     HWkeyEvent_Disable
195 };
196
197 class WidgetSettingList
198 {
199   public:
200     WidgetSettingList();
201
202     WidgetSettingList(WrtDB::WidgetSettings &widgetSettings);
203
204     WidgetSettingScreenLock getRotationValue() const;
205
206     WidgetSettingIndicatorPresence getIndicatorPresence() const;
207
208     WidgetSettingBackButtonPresence getBackButtonPresence() const;
209
210     WidgetSettingContextMenu getContextMenu() const;
211
212     WidgetSettingEncryption getEncryption() const;
213
214     WidgetSettingBackgroundSupport getBackgroundSupport() const;
215
216     bool isEncrypted() const;
217
218     std::string getUserAgent() const;
219
220     WidgetSettingProgressBarPresence getProgressBarPresence() const;
221
222     WidgetSettingHWkeyEventPresence getHWkeyEvent() const;
223
224     bool operator ==(const WidgetSettingList& other) const;
225
226   private:
227     WidgetSettingScreenLock m_RotationLock;
228     WidgetSettingIndicatorPresence m_IndicatorPresence;
229     WidgetSettingBackButtonPresence m_BackButtonPresence;
230     WidgetSettingContextMenu m_ContextMenu;
231     WidgetSettingEncryption m_Encryption;
232     WidgetSettingBackgroundSupport m_BackgroundSupport;
233     WidgetSettingProgressBarPresence m_ProgressbarPresence;
234     WidgetSettingHWkeyEventPresence m_HWkeyEvent;
235     std::string m_UserAgent;
236 };
237 typedef std::shared_ptr<WidgetSettingList> WidgetSettingListPtr;
238
239 namespace OrientationAngle {
240 namespace W3C {
241 namespace Portrait {
242 const int PRIMARY  = 0;
243 const int SECONDARY = 180;
244 } // namespace Portrait
245 namespace Landscape {
246 const int PRIMARY  = 90;
247 const int SECONDARY = -90;
248 } // namespace Landscape
249 } // namespace W3C
250 namespace Window {
251 namespace Portrait {
252 const int PRIMARY  = 0;
253 const int SECONDARY = 180;
254 } // namespace Portrait
255 namespace Landscape {
256 const int PRIMARY  = 270;
257 const int SECONDARY = 90;
258 } // namespace Landscape
259 const int UNLOCK = -1;
260 } // namespace Window
261 } // namespace OrientationAngle
262
263 #endif /* WRT_SRC_DOMAIN_WIDGET_DATA_TYPES_H_ */