a3fcdf4a41f5eb60fe9bafbf02b0e7c760ccaf19
[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 typedef std::list<WarpIRI> WarpIRIList;
43
44 /**
45  * @brief Execution phase according to BONDI
46  *
47  * WidgetExecutionPhase_Unknown:
48  *  Execution state is not defined
49  *
50  * WidgetExecutionPhase_WidgetInstall:
51  *  Applies to access control queries made by a Widget User Agent during the
52  *  processing of a Widget Resource as part of an installation or update
53  *  operation
54  *
55  * WidgetExecutionPhase_WidgetInstantiate:
56  *  Applies to access control queries made by a Widget User Agent during the
57  *  instantiation of a Widget
58  *
59  * WidgetExecutionPhase_WebkitBind:
60  *  Applies to access control queries made in response to a call to
61  *  requestFeature() in the course of execution of a Website
62  *
63  * WidgetExecutionPhase_Invoke:
64  *  Applies to access control queries made in response to invocation of a
65  *  JavaScript API in the course of execution of a Web Application
66  */
67 //enum WidgetExecutionPhase
68 //{
69 //    WidgetExecutionPhase_Unknown           = 0,
70 //    WidgetExecutionPhase_WidgetInstall     = 1 << 0,
71 //    WidgetExecutionPhase_WidgetInstantiate = 1 << 1,
72 //    WidgetExecutionPhase_WebkitBind        = 1 << 2,
73 //    WidgetExecutionPhase_Invoke            = 1 << 3
74 //};
75
76 class WidgetModel;
77
78 class WidgetAccessList
79 {
80   public:
81     WidgetAccessList();
82
83     WidgetAccessList(const WrtDB::WidgetAccessInfoList &widgetAccessInfoList);
84
85     bool getIsAccessAll() const;
86
87     const WarpIRIList* getWarpIRIList() const;
88
89     bool isRequiredIRI(const DPL::String &iri) const;
90
91     bool operator ==(const WidgetAccessList& other) const;
92
93   private:
94     WarpIRIList m_warpIriList;
95     bool m_isAccessAll;
96 };
97
98 static const DPL::String SETTING_NAME_SCREEN_ORIENTATION =
99     L"screen-orientation";
100 static const DPL::String SETTING_NAME_INDICATOR_PRESENCE =
101     L"indicator-presence";
102 static const DPL::String SETTING_NAME_BACKBUTTON_PRESENCE =
103     L"backbutton-presence";
104 #ifndef DEPRECATED_SETTING_STRING
105 static const DPL::String SETTING_NAME_CONTEXTMENU =
106     L"contextmenu";
107 #endif
108 static const DPL::String SETTING_NAME_CONTEXT_MENU =
109     L"context-menu";
110 static const DPL::String SETTING_NAME_BACKGROUND_SUPPORT =
111     L"background-support";
112 static const DPL::String SETTING_NAME_USER_AGENT =
113     L"user-agent";
114 static const DPL::String SETTING_VALUE_ENABLE =
115     L"enable";
116 static const DPL::String SETTING_VALUE_DISABLE =
117     L"disable";
118 static const DPL::String SETTING_NAME_ENCRYPTION=
119     L"encryption";
120 static const DPL::String SETTING_VALUE_SCREEN_ORIENTATION_PORTRAIT =
121     L"portrait";
122 static const DPL::String SETTING_VALUE_SCREEN_ORIENTATION_LANDSCAPE =
123     L"landscape";
124 static const DPL::String SETTING_VALUE_INDICATOR_PRESENCE_ENALBE =
125     L"enable";
126 static const DPL::String SETTING_VALUE_INDICATOR_PRESENCE_DISABLE =
127     L"disable";
128 static const DPL::String SETTING_VALUE_BACKBUTTON_PRESENCE_ENALBE =
129     L"enable";
130 static const DPL::String SETTING_VALUE_BACKBUTTON_PRESENCE_DISABLE =
131     L"disable";
132 static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE =
133     L"enable";
134 static const DPL::String SETTING_VALUE_ENCRYPTION_DISABLE =
135     L"disable";
136
137 enum WidgetSettingScreenLock
138 {
139     Screen_Portrait, /* Default */
140     Screen_Landscape
141 };
142
143 enum WidgetSettingIndicatorPresence
144 {
145     Indicator_Enable,     /* Default */
146     Indicator_Disable
147 };
148
149 enum WidgetSettingBackButtonPresence
150 {
151     BackButton_Enable,
152     BackButton_Disable     /* Default */
153 };
154
155 enum WidgetSettingContextMenu
156 {
157     ContextMenu_Enable,  /* Default */
158     ContextMenu_Disable
159 };
160
161 enum WidgetSettingEncryption
162 {
163     Encryption_Enable,
164     Encryption_Disable     /* Default */
165 };
166
167 enum WidgetSettingBackgroundSupport
168 {
169     BackgroundSupport_Enable,
170     BackgroundSupport_Disable    /* Default */
171 };
172
173 class WidgetSettingList
174 {
175   public:
176     WidgetSettingList();
177
178     WidgetSettingList(WidgetSettings &widgetSettings);
179
180     WidgetSettingScreenLock getRotationValue() const;
181
182     WidgetSettingIndicatorPresence getIndicatorPresence() const;
183
184     WidgetSettingBackButtonPresence getBackButtonPresence() const;
185
186     WidgetSettingContextMenu getContextMenu() const;
187
188     WidgetSettingEncryption getEncryption() const;
189
190     WidgetSettingBackgroundSupport getBackgroundSupport() const;
191
192     bool isEncrypted() const;
193
194     std::string getUserAgent() const;
195
196     bool operator ==(const WidgetSettingList& other) const;
197
198   private:
199     WidgetSettingScreenLock m_RotationLock;
200     WidgetSettingIndicatorPresence m_IndicatorPresence;
201     WidgetSettingBackButtonPresence m_BackButtonPresence;
202     WidgetSettingContextMenu m_ContextMenu;
203     WidgetSettingEncryption m_Encryption;
204     WidgetSettingBackgroundSupport m_BackgroundSupport;
205     std::string m_UserAgent;
206 };
207
208 #endif /* WRT_SRC_DOMAIN_WIDGET_DATA_TYPES_H_ */