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.
17 * This file contains the declaration of widget dao class.
20 * @author Yang Jie (jie2.yang@samsung.com)
21 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
22 * @author Pawel Sikorski (p.sikorski@samsung.com)
24 * @brief This file contains the declaration of widget dao
29 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
35 #include <dpl/exception.h>
36 #include <dpl/db/orm.h>
37 #include <dpl/wrt-dao-ro/config_parser_data.h>
38 #include <dpl/wrt-dao-rw/property_dao.h>
41 class WidgetDAO : public WidgetDAOReadOnly
44 typedef std::list<DPL::String> LanguageTagsList;
46 WidgetDAO(DbWidgetHandle handle);
47 WidgetDAO(DPL::OptionalString widgetGUID);
48 WidgetDAO(DPL::String tzAppId);
56 * This method registers the widget information in the DB when it is
59 * @see WidgetRegisterInfo
60 * @see UnRegisterWidget()
61 * @param[in] TizenAppId Widget app id that will be registered.
62 * @param[in] pWidgetRegisterInfo Specified the widget's information
63 * needed to be registered.
64 * @param[in] widgetSecurity Widget's security certificates.
66 static void registerWidget(
67 const TizenAppId& tzAppId,
68 const WidgetRegisterInfo &widgetRegInfo,
69 const IWidgetSecurity &widgetSecurity);
71 static DbWidgetHandle registerWidget(
72 const WidgetRegisterInfo &pWidgetRegisterInfo,
73 const IWidgetSecurity &widgetSecurity) __attribute__((deprecated));
76 * @brief registerWidgetGenerateTizenId Registers widget with auto-generated
79 * This function is disadviced and should be used only in tests.
80 * Function is not thread-safe.
82 * @param pWidgetRegisterInfo registeration information
83 * @param widgetSecurity Widget's security certificates.
84 * @return tzAppId generated
86 static TizenAppId registerWidgetGeneratePkgId(
87 const WidgetRegisterInfo &pWidgetRegisterInfo,
88 const IWidgetSecurity &widgetSecurity);
91 * This method re-registers the widget information to the DB when it is
94 * It performs unregistration and new registration of widget in db in one
97 * @see WidgetRegisterInfo
98 * @param[in] tzAppId Widget tizen app id that will be registered.
99 * @param[in] pWidgetRegisterInfo Specified the widget's information
100 * needed to be registered.
101 * @param[in] widgetSecurity Widget's security certificates.
103 static void registerOrUpdateWidget(
104 const TizenAppId & tzAppId,
105 const WidgetRegisterInfo &widgetRegInfo,
106 const IWidgetSecurity &widgetSecurity);
108 /* This method backup widget information and update new widget information
109 * for restore widget information
111 static void backupAndUpdateWidget(
112 const TizenAppId & oldAppId,
113 const TizenAppId & newAppId,
114 const WidgetRegisterInfo &widgetRegInfo,
115 const IWidgetSecurity &widgetSecurity);
117 static void restoreUpdateWidget(
118 const TizenAppId & oldAppId,
119 const TizenAppId & newAppId);
122 * This method removes a widget's information from EmDB.
124 * @see RegisterWidget()
125 * @param[in] tzAppId widgets name to be unregistered
127 static void unregisterWidget(const TizenAppId & tzAppId);
129 static void unregisterWidget(WrtDB::DbWidgetHandle handle) __attribute__((
132 /* This method removes widget property
134 void removeProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key);
137 * @brief registerExternalLocations Removes rows from
138 * WidgetExternalLocations
140 void unregisterAllExternalLocations();
142 /* This method sets widget property
144 void setProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key,
145 const PropertyDAOReadOnly::WidgetPropertyValue &value,
146 bool readOnly = false);
150 void setTizenAppId(const DPL::OptionalString& tzAppId);
152 /* This function will update of api-feature status.
153 * If status is true (feature rejected) plugin connected with this
154 * api feature mustn't be loaded durign widget launch.
156 void updateFeatureRejectStatus(const DbWidgetFeature &widgetFeature);
159 * This method change security settings value
161 void setSecurityPopupUsage(const SettingsType value);
162 void setGeolocationUsage(const SettingsType value);
163 void setWebNotificationUsage(const SettingsType value);
164 void setWebDatabaseUsage(const SettingsType value);
167 //Methods used during widget registering
168 static DbWidgetHandle registerWidgetInfo(
169 const TizenAppId & widgetName,
170 const WidgetRegisterInfo ®Info,
171 const IWidgetSecurity &widgetSecurity,
172 const DPL::Optional<DbWidgetHandle> handle =
173 DPL::Optional<DbWidgetHandle>());
174 static void registerWidgetExtendedInfo(
175 DbWidgetHandle widgetHandle,
176 const WidgetRegisterInfo ®Info);
177 static void registerWidgetLocalizedInfo(
178 DbWidgetHandle widgetHandle,
179 const WidgetRegisterInfo ®Info);
180 static void registerWidgetIcons(
181 DbWidgetHandle widgetHandle,
182 const WidgetRegisterInfo ®Info);
183 static void registerWidgetStartFile(
184 DbWidgetHandle widgetHandle,
185 const WidgetRegisterInfo ®Info);
186 static void registerWidgetPreferences(
187 DbWidgetHandle widgetHandle,
188 const WidgetRegisterInfo ®Info);
189 static void registerWidgetFeatures(
190 DbWidgetHandle widgetHandle,
191 const WidgetRegisterInfo ®Info);
192 static void registerWidgetPrivilege(
193 DbWidgetHandle widgetHandle,
194 const WidgetRegisterInfo ®Info);
195 static void registerWidgetWindowModes(
196 DbWidgetHandle widgetHandle,
197 const WidgetRegisterInfo ®Info);
198 static void registerWidgetWarpInfo(
199 DbWidgetHandle widgetHandle,
200 const WidgetRegisterInfo ®Info);
201 static void registerWidgetAllowNavigationInfo(
202 DbWidgetHandle widgetHandle,
203 const WidgetRegisterInfo ®Info);
204 static void registerWidgetCertificates(
205 DbWidgetHandle widgetHandle,
206 const IWidgetSecurity &widgetSecurity);
207 static void registerCertificatesChains(
208 DbWidgetHandle widgetHandle,
209 CertificateSource certificateSource,
210 const CertificateChainList &list);
211 static void registerWidgetSettings(
212 DbWidgetHandle widgetHandle,
213 const WidgetRegisterInfo ®Info);
214 static void registerAppControl(
215 DbWidgetHandle widgetHandle,
216 const WidgetRegisterInfo ®Info);
217 static void registerEncryptedResouceInfo(
218 DbWidgetHandle widgetHandle,
219 const WidgetRegisterInfo ®Info);
221 * @brief registerExternalLocations Inserts new rows to
222 * WidgetExternalLocations
223 * @param externals list of files
225 static void registerExternalLocations(
226 DbWidgetHandle widgetHandle,
227 const ExternalLocationList &
229 static void registerWidgetSecuritySettings(DbWidgetHandle widgetHandle);
231 static void registerWidgetInternal(
232 const TizenAppId & tzAppId,
233 const WidgetRegisterInfo &widgetRegInfo,
234 const IWidgetSecurity &widgetSecurity,
235 const DPL::Optional<DbWidgetHandle> handle =
236 DPL::Optional<DbWidgetHandle>());
237 static void unregisterWidgetInternal(
238 const TizenAppId & tzAppId);
240 static void updateWidgetAppIdInternal(
241 const TizenAppId & fromAppId,
242 const TizenAppId & toAppId);
244 static void insertAppControlInfo(DbWidgetHandle handle,
246 DPL::String operation,
250 unsigned disposition);
254 #endif // WIDGET_DAO_H