Tizen 2.0 Release
[framework/web/wrt-commons.git] / modules / widget_dao / include / dpl / wrt-dao-rw / widget_dao.h
index 1b8b507..3f7b819 100644 (file)
@@ -29,6 +29,9 @@
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <list>
 #include <string>
+#include <sys/time.h>
+#include <ctime>
+#include <cstdlib>
 #include <dpl/exception.h>
 #include <dpl/db/orm.h>
 #include <dpl/wrt-dao-ro/config_parser_data.h>
@@ -41,14 +44,9 @@ class WidgetDAO : public WidgetDAOReadOnly
   public:
     typedef std::list<DPL::String> LanguageTagsList;
 
-    /**
-     * This is a constructor.
-     *
-     * @param[in] widgetHandle application id of widget.
-     * @param[in] widgetGUID application guid of widget.
-     */
-    WidgetDAO(DbWidgetHandle widgetHandle);
+    WidgetDAO(DbWidgetHandle handle);
     WidgetDAO(DPL::OptionalString widgetGUID);
+    WidgetDAO(DPL::String pkgName);
 
     /**
      * Destructor
@@ -56,31 +54,76 @@ class WidgetDAO : public WidgetDAOReadOnly
     virtual ~WidgetDAO();
 
     /**
-     * This method registers the widget information to the DB when it is installed.
+     * This method registers the widget information in the DB when it is installed.
      *
      * @see WidgetRegisterInfo
      * @see UnRegisterWidget()
+     * @param[in] widgetPkgname Widget Pkgname that will be registered.
      * @param[in] pWidgetRegisterInfo    Specified the widget's information needed to be registered.
-     * @return widget's app id issued by app manager; 0 represents a failure during register.
+     * @param[in] wacSecurity   Widget's security certificates.
      */
+    static void registerWidget(
+            const WidgetPkgName & widgetPkgname,
+            const WidgetRegisterInfo &widgetRegInfo,
+            const IWacSecurity &wacSecurity);
+
     static DbWidgetHandle registerWidget(
-            const WidgetRegisterInfo &pWidgetRegisterInfo,
-            const IWacSecurity &wacSecurity,
-            const LanguageTagsList& languageTags);
+                const WidgetRegisterInfo &pWidgetRegisterInfo,
+                const IWacSecurity &wacSecurity) __attribute__((deprecated));
+
+    /**
+     * @brief registerWidgetGenerateTizenId Registers widget with auto-generated tizen id
+     *
+     * This function is disadviced and should be used only in tests.
+     * Function is not thread-safe.
+     *
+     * @param pWidgetRegisterInfo registeration information
+     * @param wacSecurity Widget's security certificates.
+     * @return pkgname generated
+     */
+    static WidgetPkgName registerWidgetGenerateTizenId(
+                const WidgetRegisterInfo &pWidgetRegisterInfo,
+                const IWacSecurity &wacSecurity);
+
+    /**
+     * This method re-registers the widget information to the DB when it is installed.
+     *
+     * It performs unregistration and new registration of widget in db in one transaction.
+     *
+     * @see WidgetRegisterInfo
+     * @param[in] widgetName  Widget pkgname that will be registered.
+     * @param[in] pWidgetRegisterInfo    Specified the widget's information needed to be registered.
+     * @param[in] wacSecurity   Widget's security certificates.
+     */
+    static void registerOrUpdateWidget(
+            const WidgetPkgName & widgetName,
+            const WidgetRegisterInfo &widgetRegInfo,
+            const IWacSecurity &wacSecurity);
+
+    static void registerWidget(
+            WrtDB::DbWidgetHandle handle,
+            const WidgetRegisterInfo &widgetRegInfo,
+            const IWacSecurity &wacSecurity) __attribute__((deprecated));
 
     /**
      * This method removes a widget's information from EmDB.
      *
      * @see RegisterWidget()
-     * @param[in] widgetHandle    widget's app id
-     * @return true if succeed, false if fail.
+     * @param[in] pkgName widgets name to be unregistered
      */
-    static void unregisterWidget(DbWidgetHandle widgetHandle);
+    static void unregisterWidget(const WidgetPkgName & pkgName);
+
+    static void unregisterWidget(WrtDB::DbWidgetHandle handle) __attribute__((deprecated));
 
     /* This method removes widget property
      */
     void removeProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key);
 
+    /**
+     * @brief registerExternalLocations Removes rows from WidgetExternalLocations
+     */
+    void unregisterAllExternalLocations();
+
     /* This method sets widget property
      */
     void setProperty(const PropertyDAOReadOnly::WidgetPropertyKey &key,
@@ -90,22 +133,36 @@ class WidgetDAO : public WidgetDAOReadOnly
     /* set PkgName
      */
     void setPkgName(const DPL::OptionalString& pkgName);
+    void setPkgName_TEMPORARY_API(const WidgetPkgName& pkgName);
+
+    /* This function will update of api-feature status.
+     * If status is true (feature rejected) plugin connected with this
+     * api feature mustn't be loaded durign widget launch.
+     */
+    void updateFeatureRejectStatus(const DbWidgetFeature &widgetFeature);
+
+     /*
+      * This method change security settings value
+      */
+    void setSecurityPopupUsage(const SettingsType value);
+    void setGeolocationUsage(const SettingsType value);
+    void setWebNotificationUsage(const SettingsType value);
+    void setWebDatabaseUsage(const SettingsType value);
+    void setFileSystemUsage(const SettingsType value);
 
   private:
     //Methods used during widget registering
     static DbWidgetHandle registerWidgetInfo(
+            const WidgetPkgName & widgetName,
             const WidgetRegisterInfo &regInfo,
-            const IWacSecurity &wacSecurity);
+            const IWacSecurity &wacSecurity,
+            const DPL::Optional<DbWidgetHandle> handle = DPL::Optional<DbWidgetHandle>());
     static void registerWidgetExtendedInfo(
             DbWidgetHandle widgetHandle,
             const WidgetRegisterInfo &regInfo);
     static void registerWidgetLocalizedInfo(
             DbWidgetHandle widgetHandle,
             const WidgetRegisterInfo &regInfo);
-    static void registerWidgetUserAgentLocales(
-            DbWidgetHandle widgetHandle,
-            const WidgetRegisterInfo &rInf,
-            const LanguageTagsList& languageTags);
     static void registerWidgetIcons(
             DbWidgetHandle widgetHandle,
             const WidgetRegisterInfo &regInfo);
@@ -118,6 +175,9 @@ class WidgetDAO : public WidgetDAOReadOnly
     static void registerWidgetFeatures(
             DbWidgetHandle widgetHandle,
             const WidgetRegisterInfo &regInfo);
+    static void registerWidgetPrivilege(
+            DbWidgetHandle widgetHandle,
+            const WidgetRegisterInfo &regInfo);
     static void registerWidgetWindowModes(
             DbWidgetHandle widgetHandle,
             const WidgetRegisterInfo &regInfo);
@@ -127,11 +187,9 @@ class WidgetDAO : public WidgetDAOReadOnly
     static void registerWidgetCertificates(
             DbWidgetHandle widgetHandle,
             const IWacSecurity &wacSecurity);
-    static void registerWidgetPowderData(
-            DbWidgetHandle widgetHandle,
-            const WidgetRegisterInfo &regInfo);
-    static void registerLaunchCertificates(
+    static void registerCertificatesChains(
             DbWidgetHandle widgetHandle,
+            CertificateSource certificateSource,
             const CertificateChainList &list);
     static void registerWidgetSettings(
             DbWidgetHandle widgetHandle,
@@ -139,6 +197,25 @@ class WidgetDAO : public WidgetDAOReadOnly
     static void registerAppService(
             DbWidgetHandle widgetHandle,
             const WidgetRegisterInfo &regInfo);
+    static void registerEncryptedResouceInfo(
+            DbWidgetHandle widgetHandle,
+            const WidgetRegisterInfo &regInfo);
+    /**
+     * @brief registerExternalLocations Inserts new rows to WidgetExternalLocations
+     * @param externals list of files
+     */
+    static void registerExternalLocations(DbWidgetHandle widgetHandle,
+                                const ExternalLocationList & externals);
+    static void registerWidgetSecuritySettings(DbWidgetHandle widgetHandle);
+
+
+    static void registerWidgetInternal(
+            const WidgetPkgName & widgetName,
+            const WidgetRegisterInfo &widgetRegInfo,
+            const IWacSecurity &wacSecurity,
+            const DPL::Optional<DbWidgetHandle> handle = DPL::Optional<DbWidgetHandle>());
+    static void unregisterWidgetInternal(
+            const WidgetPkgName & pkgName);
 };
 
 } // namespace WrtDB