2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file common_dao_types.h
19 * @author Michal Ciepielski (m.ciepielski@samsung.com)
21 * @brief This file contains the declaration of common data types for wrtdb
24 #ifndef WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_
25 #define WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_
33 #include <dpl/optional_typedefs.h>
36 class PluginMetafileData
42 std::set<std::string> m_deviceCapabilities;
44 bool operator< (const Feature& obj) const
46 return m_name < obj.m_name;
49 typedef std::set<Feature> FeatureContainer;
56 std::string m_libraryName;
57 FeatureContainer m_featureContainer;
60 class PluginObjectsDAO
63 typedef std::set<std::string> Objects;
64 typedef std::shared_ptr<Objects> ObjectsPtr;
67 explicit PluginObjectsDAO() {}
70 ObjectsPtr m_implemented;
71 ObjectsPtr m_dependent;
75 * @brief Widget id describes web-runtime global widget identifier.
77 * Notice that only up to one widget can exist at the same time.
78 * DbWidgetHandle can be translated into corresponding WidgetModel by invoking
79 * FindWidgetModel routine.
81 typedef int DbWidgetHandle;
82 typedef DPL::String TizenPkgId;
83 typedef DPL::String TizenAppId;
86 * Value of invalid widget handle
89 INVALID_WIDGET_HANDLE = -1
93 * @brief Structure to hold the information of widget's size
97 DPL::OptionalInt width;
98 DPL::OptionalInt height;
100 DbWidgetSize(DPL::OptionalInt w = DPL::OptionalInt::Null,
101 DPL::OptionalInt h = DPL::OptionalInt::Null) :
107 inline bool operator ==(const DbWidgetSize &objA, const DbWidgetSize &objB)
109 if (!objA.height || !objA.width || !objB.width || !objB.height) {
112 return *objA.height == *objB.height && *objA.width == *objB.width;
117 * Widget [G]lobal [U]nique [ID]entifier
118 * Orginated from appstore ID
120 typedef DPL::OptionalString WidgetGUID;
122 struct WidgetAccessInfo
124 DPL::String strIRI; /* origin iri */
125 bool bSubDomains; /* do we want access to subdomains ? */
127 bool operator ==(const WidgetAccessInfo& info) const
129 return info.strIRI == strIRI &&
130 info.bSubDomains == bSubDomains;
133 typedef std::list<WidgetAccessInfo> WidgetAccessInfoList;
135 struct WidgetAllowNavigationInfo
140 typedef std::list<WidgetAllowNavigationInfo> WidgetAllowNavigationInfoList;
142 struct EncryptedFileInfo
144 DPL::String fileName;
147 bool operator==(const EncryptedFileInfo& info) const
149 return fileName == info.fileName;
152 bool operator==(const DPL::String& file) const
154 return fileName == file;
157 bool operator< (const EncryptedFileInfo& info) const
159 return fileName < info.fileName;
163 typedef std::list<DPL::String> WindowModeList;
165 typedef std::list<DPL::String> PrivilegeList;
167 typedef std::set<EncryptedFileInfo> EncryptedFileList;
170 * @brief Widget feature host information about possible javascript extensions
171 * that widget may use
173 * Widget features are declared in configuration file in widget installation
174 * package. Each declared special feature is contained in some wrt-plugin that
175 * declares to implement it. After widget launch wrt searches for proper plugin
176 * libraries and load needed features.
178 * Widget features can be required or optional. It is possible to start widget
179 * without missing feature. When required feature cannot be loaded widget will
184 INVALID_PLUGIN_HANDLE = -1
186 typedef int DbPluginHandle;
188 struct DbWidgetFeature
190 DPL::String name; /// Feature name
191 bool rejected; /// Api feature was rejected by ace
192 DbPluginHandle pluginId; /// Plugin id that implement this feature
195 pluginId(INVALID_PLUGIN_HANDLE)
199 inline bool operator < (const DbWidgetFeature &objA,
200 const DbWidgetFeature &objB)
202 return objA.name.compare(objB.name) < 0;
205 inline bool operator==(const DbWidgetFeature &featureA,
206 const DbWidgetFeature &featureB)
208 return featureA.name == featureB.name &&
209 featureA.pluginId == featureB.pluginId;
213 * @brief Default container for features list
215 typedef std::multiset<DbWidgetFeature> DbWidgetFeatureSet;
218 * @brief Default container with DbWidgetHandle's
220 typedef std::list<DbWidgetHandle> DbWidgetHandleList;
221 typedef std::list<TizenAppId> TizenAppIdList;
222 typedef std::list<TizenPkgId> TizenPkgIdList;
224 class WidgetDAOReadOnly; //forward declaration
225 typedef std::shared_ptr<WidgetDAOReadOnly> WidgetDAOReadOnlyPtr;
227 * @brief Default container with WidgetDAOReadOnly
229 typedef std::list<WidgetDAOReadOnlyPtr> DbWidgetDAOReadOnlyList;
232 * @brief Widget specific type
234 * Widget type describes belowed in WAC, TIZEN WebApp
238 APP_TYPE_UNKNOWN = 0, // unknown
239 APP_TYPE_TIZENWEBAPP, // Tizen webapp
240 APP_TYPE_TIZENWEBSERVICE // Tizen web service
241 #ifdef CARD_VIEWER_SUPPORT
242 ,APP_TYPE_TIZENCARDAPP // Tizen card webapp
250 appType(APP_TYPE_UNKNOWN)
252 WidgetType(const AppType type) :
255 bool operator== (const AppType& other) const
257 return appType == other;
259 bool operator!= (const AppType& other) const
261 return appType != other;
263 std::string getApptypeToString()
266 #define X(x) case x: return #x;
268 X(APP_TYPE_TIZENWEBAPP)
269 X(APP_TYPE_TIZENWEBSERVICE)
270 #ifdef CARD_VIEWER_SUPPORT
271 X(APP_TYPE_TIZENCARDAPP)
284 * @brief Package specific type
286 * Package type describes belowed in Tizen webapp, C++ service App
290 PKG_TYPE_UNKNOWN = 0, // unknown
291 PKG_TYPE_NOMAL_WEB_APP,
292 PKG_TYPE_DIRECTORY_WEB_APP,
293 PKG_TYPE_HOSTED_WEB_APP, // request from browser
294 PKG_TYPE_HYBRID_WEB_APP // Tizen webapp with C++ service app
301 pkgType(PKG_TYPE_UNKNOWN)
303 PackagingType(const PkgType type) :
306 bool operator== (const PkgType& other) const
308 return pkgType == other;
310 bool operator!= (const PkgType& other) const
312 return pkgType != other;
314 std::string getPkgtypeToString()
317 #define X(x) case x: return #x;
319 X(PKG_TYPE_NOMAL_WEB_APP)
320 X(PKG_TYPE_DIRECTORY_WEB_APP)
321 X(PKG_TYPE_HOSTED_WEB_APP)
322 X(PKG_TYPE_HYBRID_WEB_APP)
334 DPL::String settingName;
335 DPL::String settingValue;
337 bool operator ==(const WidgetSetting& info) const
339 return (info.settingName == settingName &&
340 info.settingValue == settingValue);
342 bool operator !=(const WidgetSetting& info) const
344 return (info.settingName != settingName ||
345 info.settingValue != settingValue);
349 typedef std::list<WidgetSetting> WidgetSettings;
352 * @brief Widget AppControl
354 * Application control describes details of behaviour
355 * when widget receives aul bundle data.
357 namespace AppControlPrefix {
358 const char* const PROCESS_PREFIX = "-__CONTROL_PROCESS__";
360 struct WidgetAppControl
362 enum class Disposition {
368 DPL::String src; /* start uri */
369 DPL::String operation; /* service name */
370 DPL::String uri; /* scheme type*/
371 DPL::String mime; /* mime type */
372 Disposition disposition;
375 bool operator== (const WidgetAppControl& other) const
377 return src == other.src &&
378 operation == other.operation &&
380 mime == other.mime &&
381 disposition == other.disposition;
385 typedef std::list<WidgetAppControl> WidgetAppControlList;
387 enum class WidgetSecurityModelVersion
389 WIDGET_SECURITY_MODEL_V1 = 0, // WARP
390 WIDGET_SECURITY_MODEL_V2 // CSP, allow-navigation
393 #endif /* WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_ */