[Release] wrt_0.8.213
[platform/framework/web/wrt.git] / src / domain / widget_model.h
index 24c740c..6c2d6c4 100644 (file)
@@ -25,8 +25,8 @@
 #include <dpl/event/model.h>
 #include <dpl/event/property.h>
 #include <dpl/optional.h>
-#include <dpl/event/nested_loop.h>
-#include <vcore/CertificateCollection.h>
+#include <dpl/optional_typedefs.h>
+#include <string>
 
 #include "widget_data_types.h"
 
 /**
  * @brief Widget model
  *
- * Widget model is the core object that hold information about state and
+ * Widget model is the core object that hold information about
  * properties of widget. After wrt launch each widget contained in database is
  * mapped to WidgetModel.
  *
  * Widget model is a type of MVC model, so it is possible to listen for it's
- * changes. If widget model is in running state @see WidgetState it has some
- * corresponding view. A widget model view is displaying contents of widget
- * model with webkit.
+ * changes.
  *
  */
 class WidgetModel : public DPL::Event::Model
 {
   public:
-    /**
-     * @brief Current widget model state
-     */
-    DPL::Event::Property<WidgetState> State;
 
     /**
-     * @brief Widget handle
+     * @brief Tizen id
+     *
+     *  ex> "TizenIDabc.appname"
+     *
+     *  - TizenId / AppId : "TizenIDabc.appname"
+     *  - TzPkgId         : "TizenIDabc"
+     *  - App name        : "appname"
      *
-     * Note: This is a readonly property
      */
-    DPL::Event::Property<WidgetHandle, DPL::Event::PropertyReadOnly> Handle;
+    DPL::String TizenId;
+    DPL::Event::Property<WrtDB::TizenPkgId,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> TzPkgId;
 
     /**
      * @brief Widget type
@@ -66,8 +68,23 @@ class WidgetModel : public DPL::Event::Model
      * Note: This is a readonly property
      */
     DPL::Event::Property<WrtDB::WidgetType,
-    DPL::Event::PropertyReadOnly,
-    DPL::Event::PropertyStorageDynamicCached> Type;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> Type;
+
+    /**
+     * @brief Config file based csp policy
+     */
+    DPL::Event::Property<DPL::OptionalString,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> CspPolicy;
+
+    /**
+     * @brief Config file based csp policy - report only
+     */
+    DPL::Event::Property<DPL::OptionalString,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached>
+    CspReportOnlyPolicy;
 
     /**
      * @brief Current widget actual size
@@ -78,8 +95,9 @@ class WidgetModel : public DPL::Event::Model
      * @brief Current widget preferred size
      */
     DPL::Event::Property<WidgetSize,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> PreferredSize;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached>
+    PreferredSize;
 
     /**
      * @brief Start URL for widget
@@ -105,43 +123,30 @@ class WidgetModel : public DPL::Event::Model
      * Gets path in which files of widget are being kept
      */
     DPL::Event::Property<DPL::String,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> InstallPath;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> InstallPath;
 
     /**
      * @brief Path to widget's persistent storage.
      *
      * Gets path in which widget may store its persistent private data.
      */
-    DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PersistentStoragePath;
+    DPL::Event::Property<DPL::String> PersistentStoragePath;
 
     /**
      * @brief Path to widget's temporary storage.
      *
      * Gets path in which widget may store its temporary private data.
      */
-    DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> TemporaryStoragePath;
-
-    /**
-     * @brief Widget GUID
-     */
-    DPL::Event::Property<WrtDB::WidgetGUID,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> GUID;
+    DPL::Event::Property<DPL::String> TemporaryStoragePath;
 
     /**
      * @brief Widget defaultlocale
      */
     DPL::Event::Property<DPL::OptionalString,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> defaultlocale;
-
-    /**
-     * @brief Widget version
-     */
-    DPL::Event::Property<OptionalWidgetVersion,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> Version;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached>
+    defaultlocale;
 
     /**
      * @brief Widget name
@@ -174,77 +179,19 @@ class WidgetModel : public DPL::Event::Model
     DPL::Event::Property<OptionalWidgetIcon> Icon;
 
     /**
-     * @brief Widget name if running
-     */
-    DPL::Event::Property<DPL::OptionalString> RunningName;
-
-    /**
-     * @brief Widget icon if running
-     */
-    DPL::Event::Property<OptionalWidgetIcon> RunningIcon;
-
-    /**
-     * @brief Start URL for widget if running
+     * @brief Widget splash image src
      */
-    DPL::Event::Property<DPL::OptionalString> RunningStartURL;
-
-    /**
-     * @brief Widget short name  for widget if running
-     */
-    DPL::Event::Property<DPL::OptionalString> RunningShortName;
-
-    /**
-     * @brief Widget description for widget if running
-     */
-    DPL::Event::Property<DPL::OptionalString> RunningDescription;
-
-    /**
-     * @brief Widget license
-     */
-    DPL::Event::Property<DPL::OptionalString> RunningLicense;
-
-    /**
-     * @brief Widget license href
-     */
-    DPL::Event::Property<DPL::OptionalString> RunningLicenseHref;
-
-    /**
-     * @brief Start URL information for widget
-     */
-    DPL::Event::Property<OptionalWidgetStartFileInfo> RunningStartFileInfo;
+    DPL::Event::Property<DPL::OptionalString,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> SplashImg;
 
     /**
      * @brief window mode
      */
     DPL::Event::Property<WrtDB::WindowModeList,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamic> WindowModes;
-
-    /**
-     * @brief Package name
-     */
-    DPL::Event::Property<DPL::String,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> PkgName;
-
-    /**
-     * @brief Current widget language tags
-     */
-    DPL::Event::Property<LanguageTagsList> LanguageTags;
-
-    /**
-     * @brief Minimum of the WAC Engine Standard required to run widget.
-     */
-    DPL::Event::Property<WidgetStandard,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> Standard;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamic> WindowModes;
 
-    /**
-     * @brief How much space application and its storage takes.
-     */
-    DPL::Event::Property<WidgetStorageSize,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> ApplicationStorage;
     //    /**
     //     * @brief Value of network element.
     //     */
@@ -260,42 +207,44 @@ class WidgetModel : public DPL::Event::Model
      * @brief Is back supported
      */
     DPL::Event::Property<bool,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> BackSupported;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached>
+    BackSupported;
 
     /**
      * @brief Widget access list
      */
     DPL::Event::Property<WidgetAccessList> AccessList;
 
-    /**
-     * @brief Is this DeveloperWidget
-     */
-    DPL::Event::Property<bool,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
-
-    DPL::Event::Property<bool,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> IsDeletable;
-
     DPL::Event::Property<WidgetSettingList> SettingList;
 
     /**
-     * @brief Widget Application Service list
+     * @brief Widget app-control list
      */
-    DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
+    DPL::Event::Property<WrtDB::WidgetAppControlList> AppControlList;
+    DPL::Event::Property<DPL::OptionalUInt> AppControlIndex;
 
-    WidgetModel(const WidgetHandle &handle);
+    DPL::Event::Property<WrtDB::WidgetSecurityModelVersion,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> SecurityModelVersion;
 
-  private:
-    // Custom read write delegates
-    static DPL::String           readPkgName(DPL::Event::Model *model);
-    static WidgetStandard        readStandard(DPL::Event::Model *model);
-    static OptionalWidgetVersion readVersion(DPL::Event::Model *model);
-    static WidgetStorageSize     getApplicationStorage(DPL::Event::Model *model);
+    DPL::Event::Property<WrtDB::SettingsType,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> SecurePopupUsage;
+    DPL::Event::Property<WrtDB::SettingsType,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> GeolocationUsage;
+    DPL::Event::Property<WrtDB::SettingsType,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> WebNotificationUsage;
+    DPL::Event::Property<WrtDB::SettingsType,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> WebStorageUsage;
 
-    WidgetHandle getHandle() const;
+    WidgetModel(const std::string &tizenId);
+
+  private:
+    DPL::String getTizenId() const;
 };
 
 #endif // SRC_DOMAIN_WIDGET_MODEL_H