tizen 2.4 release
[framework/web/wrt-commons.git] / modules / widget_dao / include / dpl / wrt-dao-ro / widget_dao_read_only.h
 #include <dpl/availability.h>
 #include <dpl/string.h>
 #include <dpl/exception.h>
-#include <dpl/db/orm.h>
 #include <dpl/optional_typedefs.h>
-#include <dpl/wrt-dao-ro/config_parser_data.h>
+#include <dpl/platform.h>
 #include <dpl/wrt-dao-ro/property_dao_read_only.h>
 #include <dpl/wrt-dao-ro/common_dao_types.h>
+#include <dpl/wrt-dao-ro/widget_register_types.h>
 
 namespace WrtDB {
-enum CertificateSource {
-    SIGNATURE_AUTHOR = 0,
-    SIGNATURE_DISTRIBUTOR = 1,
-    SIGNATURE_DISTRIBUTOR2 = 2,
-    SIGNATURE_UNKNOWN = 3
-};
-
-struct WidgetLocalizedInfo
-{
-    DPL::OptionalString name;
-    DPL::OptionalString shortName;
-    DPL::OptionalString description;
-    DPL::OptionalString license;
-    DPL::OptionalString licenseHref;
-};
-
-/**
- * CertificateData
- * A structure to hold certificate fingerprints.
- */
-struct WidgetCertificateData
-{
-    enum Owner { AUTHOR, DISTRIBUTOR, DISTRIBUTOR2, UNKNOWN };
-    enum Type { ROOT, ENDENTITY };
-
-    // type of signature: author/distributor
-    Owner owner;
-    // indicates whether this is ca certificate
-    Type type;
-
-    // chain id number: relative BASE, where BASE is signatureBASE.xml
-    int chainId;
-    // certificate fingerprint digested by md5
-    std::string strMD5Fingerprint;
-    // certificate fingerprint digestef by sha1
-    std::string strSHA1Fingerprint;
-    // Common name field in certificate
-    DPL::String strCommonName;
-
-    bool operator== (const WidgetCertificateData& certData) const
-    {
-        return certData.chainId == chainId &&
-               certData.owner == owner &&
-               certData.strCommonName == strCommonName &&
-               certData.strMD5Fingerprint == strMD5Fingerprint &&
-               certData.strSHA1Fingerprint == strSHA1Fingerprint;
-    }
-};
-
-typedef std::list<WidgetCertificateData> WidgetCertificateDataList;
-
-typedef DPL::String Locale;
-typedef std::set<Locale> LocaleSet;
-typedef std::list<std::string> ExternalLocationList;
-
-/**
- * WidgetRegisterInfo
- * A structure to hold widget's information needed to be registered.
- * @see WidgetConfigurationInfo
- */
-struct WidgetRegisterInfo
-{
-    struct LocalizedIcon : public ConfigParserData::Icon
-    {
-        LocalizedIcon(const ConfigParserData::Icon& icon,
-                      const LocaleSet& _availableLocales) :
-            ConfigParserData::Icon(icon),
-            availableLocales(_availableLocales)
-        {}
-
-        LocaleSet availableLocales;
-    };
-
-    struct StartFileProperties
-    {
-        DPL::String encoding;
-        DPL::String type;
-    };
-
-    typedef std::map<Locale,
-                     StartFileProperties> StartFilePropertiesForLocalesMap;
-    struct LocalizedStartFile
-    {
-        DPL::String path;
-        StartFilePropertiesForLocalesMap propertiesForLocales;
-    };
-
-    typedef std::list<LocalizedIcon> LocalizedIconList;
-    typedef std::list<LocalizedStartFile> LocalizedStartFileList;
-    struct LocalizationData
-    {
-        LocalizedIconList icons;
-        LocalizedStartFileList startFiles;
-    };
-
-    //Constructor
-    WidgetRegisterInfo() :
-        webAppType(APP_TYPE_UNKNOWN),
-        configInfo(),
-        packagingType(PKG_TYPE_UNKNOWN)
-    {}
-
-    WidgetType webAppType;
-    DPL::OptionalString guid;
-    DPL::OptionalString version;
-    DPL::OptionalString minVersion;
-    std::string baseFolder;
-    ConfigParserData configInfo;
-    LocalizationData localizationData;
-
-    TizenPkgId tzPkgid;
-    TizenAppId tzAppid;
-    TizenAppId tzBackupAppid;
-
-    time_t installedTime;
-    PackagingType packagingType;
-    EncryptedFileList encryptedFiles;
-    ExternalLocationList externalLocations;
-    DPL::OptionalString widgetInstalledPath;
-};
-
-typedef std::list<std::string> CertificateChainList;
-class IWidgetSecurity
-{
-  public:
-    virtual ~IWidgetSecurity();
-
-    virtual const WidgetCertificateDataList& getCertificateList() const = 0;
-
-    virtual bool isRecognized() const = 0;
-
-    virtual bool isDistributorSigned() const = 0;
-
-    virtual void getCertificateChainList(CertificateChainList& list,
-                                         CertificateSource source) const = 0;
-};
-
-/**
- * WidgetAuthorInfo.
- * Structure to hold the information of widget's author.
- */
-struct WidgetAuthorInfo
-{
-    DPL::OptionalString name;
-    DPL::OptionalString email;
-    DPL::OptionalString href;
-};
-
-typedef std::list <std::string> WidgetCertificateCNList;
-typedef std::list<DPL::String> LanguageTagList;
-typedef std::list<std::string> HostList;
-typedef std::list<std::string> FingerPrintList;
 
 class WidgetDAOReadOnly
 {
@@ -251,6 +99,14 @@ class WidgetDAOReadOnly
     };
     typedef std::list<WidgetLocalizedStartFileRow> LocalizedStartFileList;
 
+#if USE(WEB_PROVIDER)
+    /*
+     * This List is to retrive liveBox(es)ID from wrt.db. List is required as
+     * there might be multiple app-widget tag in config.xml for one widget.
+     */
+    typedef std::list<DPL::OptionalString> LiveBoxIdList;
+#endif
+
     /**
      * This is a constructor.
      *
@@ -300,26 +156,17 @@ class WidgetDAOReadOnly
     static std::list<TizenAppId> getTzAppIdList(const TizenPkgId tzPkgid);
 
     /**
-     * Returns TizenPkgId for the specified widget
-     *
-     * @return TizenPkgId;
-     * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
-     * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in
-     * DB table.
+     * Returns tizen package id for the specified web application
+     * @return TizenPkgId
      */
-
-    TizenPkgId getTzPkgId() const DPL_DEPRECATED_WITH_MESSAGE("Use getTizenPkgId");
-    static TizenPkgId getTzPkgId(const DbWidgetHandle handle) DPL_DEPRECATED_WITH_MESSAGE("Use getTizenPkgId");
-    static TizenPkgId getTzPkgId(const TizenAppId tzAppid) DPL_DEPRECATED_WITH_MESSAGE("Use getTizenPkgId");
     TizenPkgId getTizenPkgId() const;
     static TizenPkgId getTizenPkgId(const DbWidgetHandle handle);
     static TizenPkgId getTizenPkgId(const TizenAppId tzAppid);
 
     /**
-     * This method returns list of tizen package list of installed packages
-     * @return list of TizenPkgIdList of installed packages
+     * This method returns list of tizen package list of installed web applications
+     * @return TizenPkgIdList
      */
-    static TizenPkgIdList getTizenPkgidList() DPL_DEPRECATED_WITH_MESSAGE("Use getTizenPkgIdList");
     static TizenPkgIdList getTizenPkgIdList();
 
     /**
@@ -501,16 +348,6 @@ class WidgetDAOReadOnly
     bool hasFeature(const std::string& featureName) const;
 
     /**
-     * This method gets if widget needs webkit plugins enabled
-     *
-     * @return true: widget needs webkit plugins enabled
-     * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
-     * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in
-     *  DB table.
-     */
-    bool getWebkitPluginsRequired() const;
-
-    /**
      * This method returns a list of all the installed widgets.
      *
      * @return list of installed widgets.
@@ -584,16 +421,6 @@ class WidgetDAOReadOnly
      */
     time_t getInstallTime() const;
 
-    /**
-     * This method gets widget base folder.
-     *
-     * @return widget base folder.
-     * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
-     * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in
-     *  DB table.
-     */
-    std::string getBaseFolder() const;
-
     /* This method checks read only flag for given property
      */
     DPL::OptionalInt checkPropertyReadFlag(
@@ -691,6 +518,13 @@ class WidgetDAOReadOnly
     PrivilegeList getWidgetPrivilege() const;
     WidgetSecurityModelVersion getSecurityModelVersion() const;
 
+#if USE(WEB_PROVIDER)
+    /**
+     * @brief Gets list of liveBox(es) ID(s) for a particular widget.
+     * @param[out] out param to retrive livebox(es) ID(s) as a list of String
+     */
+    void getLiveBoxInfoList(LiveBoxIdList& outLiveBoxIdList) const;
+#endif
 };
 } // namespace WrtDB