Set the API to check the supported boxsize.
authorleerang song <leerang.song@samsung.com>
Mon, 29 Apr 2013 10:54:05 +0000 (19:54 +0900)
committerleerang song <leerang.song@samsung.com>
Mon, 20 May 2013 12:21:41 +0000 (21:21 +0900)
[Issue#] N/A
[Problem] Config.xml use the not supported boxsize
[Cause] N/A
[Solution] Set the API to check the supported boxsize.
[SCMRequest] N/A

Change-Id: I7d39b257c1822f5296922342385c2629efe3e625

src/jobs/widget_install/task_widget_config.cpp [changed mode: 0644->0755]
src/jobs/widget_install/task_widget_config.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index c5bbc5b..2620edd
@@ -45,6 +45,9 @@
 #include <widget_install/widget_install_context.h>
 #include <widget_install/widget_install_errors.h>
 #include <widget_parser.h>
+#include <web_provider_plugin_info.h>
+#include <web_provider_livebox_info.h>
+#include <manifest.h>
 
 namespace { // anonymous
 const DPL::String BR = DPL::FromUTF8String("<br>");
@@ -80,6 +83,7 @@ TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) :
     AddStep(&TaskWidgetConfig::ProcessAppControlInfo);
     AddStep(&TaskWidgetConfig::ProcessSecurityModel);
     AddStep(&TaskWidgetConfig::StepVerifyFeatures);
+    AddStep(&TaskWidgetConfig::StepVerifyLivebox);
     AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo);
 }
 
@@ -511,6 +515,50 @@ void TaskWidgetConfig::StepVerifyFeatures()
         "Widget Config step2 Finished");
 }
 
+void TaskWidgetConfig::StepVerifyLivebox()
+{
+    using namespace WrtDB;
+    ConfigParserData &data = m_installContext.widgetConfig.configInfo;
+    ConfigParserData::LiveboxList liveBoxList = data.m_livebox;
+
+    if (liveBoxList.size() <= 0) {
+        return;
+    }
+
+    FOREACH (it, liveBoxList) {
+        std::string boxType;
+
+        if ((**it).m_type.empty()) {
+            boxType = web_provider_livebox_get_default_type();
+        } else {
+            boxType = DPL::ToUTF8String((**it).m_type);
+        }
+
+        LogInfo("livebox type: " << boxType);
+
+        boxSizeType boxSizeList = (**it).m_boxInfo.m_boxSize;
+        char** boxSize = static_cast<char**>(
+            malloc(sizeof(char*)* boxSizeList.size()));
+
+        int boxSizeCnt = 0;
+        FOREACH (m, boxSizeList) {
+            boxSize[boxSizeCnt++] = strdup(DPL::ToUTF8String((*m).first).c_str());
+        }
+
+        bool chkSize = web_provider_plugin_check_supported_size(
+            boxType.c_str(), boxSize, boxSizeCnt);
+
+        for(int i = 0; i < boxSizeCnt; i++) {
+            delete[] boxSize[i];
+        }
+
+        if(!chkSize) {
+            LogError("Invalid boxSize");
+            ThrowMsg(Exceptions::WidgetConfigFileInvalid, "Invalid boxSize");
+        }
+    }
+}
+
 bool TaskWidgetConfig::isFeatureAllowed(WrtDB::AppType appType,
                                         DPL::String featureName)
 {
old mode 100644 (file)
new mode 100755 (executable)
index 6b500d3..785d7fc
@@ -81,6 +81,7 @@ class TaskWidgetConfig :
     void ProcessAppControlInfo();
     void ProcessSecurityModel();
     void StepVerifyFeatures();
+    void StepVerifyLivebox();
     void StepCheckMinVersionInfo();
 
     template <typename Ex, const char* Msg>