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>
42 class WidgetDAO : public WidgetDAOReadOnly
45 typedef std::list<DPL::String> LanguageTagsList;
47 WidgetDAO(DbWidgetHandle handle);
48 WidgetDAO(DPL::OptionalString widgetGUID);
49 WidgetDAO(DPL::String tzAppId);
57 * This method registers the widget information in the DB when it is installed.
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 needed to be registered.
63 * @param[in] wacSecurity Widget's security certificates.
65 static void registerWidget(
66 const TizenAppId& tzAppId,
67 const WidgetRegisterInfo &widgetRegInfo,
68 const IWacSecurity &wacSecurity);
70 static DbWidgetHandle registerWidget(
71 const WidgetRegisterInfo &pWidgetRegisterInfo,
72 const IWacSecurity &wacSecurity) __attribute__((deprecated));
75 * @brief registerWidgetGenerateTizenId Registers widget with auto-generated tizen id
77 * This function is disadviced and should be used only in tests.
78 * Function is not thread-safe.
80 * @param pWidgetRegisterInfo registeration information
81 * @param wacSecurity Widget's security certificates.
82 * @return tzAppId generated
84 static TizenAppId registerWidgetGeneratePkgId(
85 const WidgetRegisterInfo &pWidgetRegisterInfo,
86 const IWacSecurity &wacSecurity);
89 * This method re-registers the widget information to the DB when it is installed.
91 * It performs unregistration and new registration of widget in db in one transaction.
93 * @see WidgetRegisterInfo
94 * @param[in] tzAppId Widget tizen app id that will be registered.
95 * @param[in] pWidgetRegisterInfo Specified the widget's information needed to be registered.
96 * @param[in] wacSecurity Widget's security certificates.
98 static void registerOrUpdateWidget(
99 const TizenAppId & tzAppId,
100 const WidgetRegisterInfo &widgetRegInfo,
101 const IWacSecurity &wacSecurity);
104 * This method removes a widget's information from EmDB.
106 * @see RegisterWidget()
107 * @param[in] tzAppId widgets name to be unregistered
109 static void unregisterWidget(const TizenAppId & tzAppId);
111 static void unregisterWidget(WrtDB::DbWidgetHandle handle) __attribute__((deprecated));
113 /* This method removes widget property
115 void removeProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key);
118 * @brief registerExternalLocations Removes rows from WidgetExternalLocations
120 void unregisterAllExternalLocations();
122 /* This method sets widget property
124 void setProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key,
125 const PropertyDAOReadOnly::WidgetPropertyValue &value,
126 bool readOnly = false);
130 void setTizenAppId(const DPL::OptionalString& tzAppId);
132 /* This function will update of api-feature status.
133 * If status is true (feature rejected) plugin connected with this
134 * api feature mustn't be loaded durign widget launch.
136 void updateFeatureRejectStatus(const DbWidgetFeature &widgetFeature);
139 * This method change security settings value
141 void setSecurityPopupUsage(const SettingsType value);
142 void setGeolocationUsage(const SettingsType value);
143 void setWebNotificationUsage(const SettingsType value);
144 void setWebDatabaseUsage(const SettingsType value);
145 void setFileSystemUsage(const SettingsType value);
148 //Methods used during widget registering
149 static DbWidgetHandle registerWidgetInfo(
150 const TizenAppId & widgetName,
151 const WidgetRegisterInfo ®Info,
152 const IWacSecurity &wacSecurity,
153 const DPL::Optional<DbWidgetHandle> handle = DPL::Optional<DbWidgetHandle>());
154 static void registerWidgetExtendedInfo(
155 DbWidgetHandle widgetHandle,
156 const WidgetRegisterInfo ®Info);
157 static void registerWidgetLocalizedInfo(
158 DbWidgetHandle widgetHandle,
159 const WidgetRegisterInfo ®Info);
160 static void registerWidgetIcons(
161 DbWidgetHandle widgetHandle,
162 const WidgetRegisterInfo ®Info);
163 static void registerWidgetStartFile(
164 DbWidgetHandle widgetHandle,
165 const WidgetRegisterInfo ®Info);
166 static void registerWidgetPreferences(
167 DbWidgetHandle widgetHandle,
168 const WidgetRegisterInfo ®Info);
169 static void registerWidgetFeatures(
170 DbWidgetHandle widgetHandle,
171 const WidgetRegisterInfo ®Info);
172 static void registerWidgetPrivilege(
173 DbWidgetHandle widgetHandle,
174 const WidgetRegisterInfo ®Info);
175 static void registerWidgetWindowModes(
176 DbWidgetHandle widgetHandle,
177 const WidgetRegisterInfo ®Info);
178 static void registerWidgetWarpInfo(
179 DbWidgetHandle widgetHandle,
180 const WidgetRegisterInfo ®Info);
181 static void registerWidgetCertificates(
182 DbWidgetHandle widgetHandle,
183 const IWacSecurity &wacSecurity);
184 static void registerCertificatesChains(
185 DbWidgetHandle widgetHandle,
186 CertificateSource certificateSource,
187 const CertificateChainList &list);
188 static void registerWidgetSettings(
189 DbWidgetHandle widgetHandle,
190 const WidgetRegisterInfo ®Info);
191 static void registerAppService(
192 DbWidgetHandle widgetHandle,
193 const WidgetRegisterInfo ®Info);
194 static void registerEncryptedResouceInfo(
195 DbWidgetHandle widgetHandle,
196 const WidgetRegisterInfo ®Info);
198 * @brief registerExternalLocations Inserts new rows to WidgetExternalLocations
199 * @param externals list of files
201 static void registerExternalLocations(DbWidgetHandle widgetHandle,
202 const ExternalLocationList & externals);
203 static void registerWidgetSecuritySettings(DbWidgetHandle widgetHandle);
206 static void registerWidgetInternal(
207 const TizenAppId & tzAppId,
208 const WidgetRegisterInfo &widgetRegInfo,
209 const IWacSecurity &wacSecurity,
210 const DPL::Optional<DbWidgetHandle> handle = DPL::Optional<DbWidgetHandle>());
211 static void unregisterWidgetInternal(
212 const TizenAppId & tzAppId);
217 #endif // WIDGET_DAO_H