Popup removal 2
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_certify.cpp
index 88b8fc4..128f022 100644 (file)
@@ -50,10 +50,6 @@ using namespace ValidationCore;
 using namespace WrtDB;
 
 namespace {
-const std::string LABEL_NEW_LINE = "<br>";
-const std::string LABEL_NEW_LINE_2 = "<br><br>";
-const std::string UNTRUSTED_WIDGET = "It is an Untrusted Widget";
-const char *QUESTION = "Do you wanto to install?";
 
 WidgetCertificateData toWidgetCertificateData(const SignatureData &data,
                                               bool root)
@@ -126,25 +122,13 @@ namespace Jobs {
 namespace WidgetInstall {
 TaskCertify::TaskCertify(InstallerContext &inCont) :
     DPL::TaskDecl<TaskCertify>(this),
-    WidgetInstallPopup(inCont),
     m_contextData(inCont)
 {
     AddStep(&TaskCertify::stepSignature);
     // certi comparison determines whether the update.
-    if (true == m_contextData.existingWidgetInfo.isExist) {
+    if (true == m_contextData.isUpdateMode) {
         AddStep(&TaskCertify::stepVerifyUpdate);
     }
-
-    // Block until fixed popup issues
-    if (!GlobalSettings::PopupsTestModeEnabled()
-        && !m_installContext.m_quiet && !isTizenWebApp())
-    {
-        AddStep(&TaskCertify::stepWarningPopup);
-        AddStep(&TaskCertify::stepWarningPopupAnswer);
-        AddStep(&TaskCertify::stepAuthorInfoPopup);
-        AddStep(&TaskCertify::stepAuthorInfoPopupAnswer);
-        AddStep(&TaskCertify::StepDeletePopupWin);
-    }
     AddStep(&TaskCertify::stepFinalize);
 }
 
@@ -251,7 +235,7 @@ void TaskCertify::stepSignature()
             WrtSignatureValidator::AppType appType =
                 WrtSignatureValidator::WAC20;
 
-            if (m_installContext.widgetConfig.webAppType ==
+            if (m_contextData.widgetConfig.webAppType ==
                 APP_TYPE_TIZENWEBAPP)
             {
                 appType = WrtSignatureValidator::TIZEN;
@@ -270,7 +254,9 @@ void TaskCertify::stepSignature()
             result = validator.check(data, widgetPath);
 
             if (m_contextData.widgetConfig.packagingType
-                == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
+                == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP ||
+               m_contextData.job->getInstallerStruct().m_installMode
+               == InstallMode::INSTALL_MODE_PRELOAD)
             {
                 // In directory installation mode, the validation is skipped.
 
@@ -301,9 +287,6 @@ void TaskCertify::stepSignature()
                     continue;
                 }
             } else {
-                if (result == WrtSignatureValidator::SIGNATURE_DISREGARD) {
-                    continue;
-                }
                 // now signature _must_ be verified
                 processDistributorSignature(data);
             }
@@ -325,99 +308,6 @@ void TaskCertify::stepSignature()
         "Widget Signature checked");
 }
 
-void TaskCertify::createInstallPopup(PopupType type, const std::string &label)
-{
-    m_contextData.job->Pause();
-    if (m_popup) {
-        destroyPopup();
-    }
-    bool ret = createPopup();
-    if (ret) {
-        loadPopup(type, label);
-        showPopup();
-    }
-}
-void TaskCertify::StepDeletePopupWin()
-{
-    destroyPopup();
-}
-
-void TaskCertify::stepWarningPopup()
-{
-    LogInfo("Step:: <<Warning Popup>>");
-    // SP-2151: If widget is not recognized (OCSP status of any of certificates
-    //          it is signed with is not recognized) WRT must notify user that
-    //          widget cannot be installed as a trusted application, and let the
-    //          user decide whether it should be installed as an untrusted
-    //          application.
-    if (!m_contextData.wacSecurity.isDistributorSigned()) {
-        std::string label = UNTRUSTED_WIDGET +
-            LABEL_NEW_LINE_2 +
-            QUESTION;
-        createInstallPopup(PopupType::WIDGET_UNRECOGNIZED, label);
-    }
-}
-
-std::string TaskCertify::createAuthorWidgetInfo() const
-{
-    std::string authorInfo;
-    if (m_contextData.wacSecurity.isRecognized()) {
-        //authorInfo += _("IDS_IM_WIDGET_RECOGNISED");
-        authorInfo += _("WIDGET RECOGNISED");
-    } else {
-        //authorInfo += _("IDS_IM_WIDGET_UNRECOGNISED");
-        authorInfo += _("WIDGET UNRECOGNISED");
-    }
-
-    authorInfo += LABEL_NEW_LINE_2;
-    ValidationCore::CertificatePtr authorCert =
-        m_contextData.wacSecurity.getAuthorCertificatePtr();
-    if (!!authorCert) {
-        DPL::Optional < DPL::String > organizationName =
-            authorCert->getOrganizationName();
-
-        //authorInfo += _("IDS_IM_WIDGET_AUTHOR_ORGANIZATION_NAME");
-        authorInfo += _("AUTHOR ORGANIZATION NAME");
-        authorInfo += LABEL_NEW_LINE;
-
-        if (!organizationName.IsNull()) {
-            authorInfo += DPL::ToUTF8String(*organizationName);
-        } else {
-            //authorInfo += _("IDS_IM_WIDGET_ORGANIZATION_UNKNOWN");
-            authorInfo += _("WIDGET ORGANIZATION UNKNOWN");
-        }
-
-        authorInfo += LABEL_NEW_LINE_2;
-
-        DPL::Optional < DPL::String > countryName =
-            authorCert->getCountryName();
-
-        //authorInfo += _("IDS_IM_WIDGET_COUNTRY_NAME");
-        authorInfo += _("WIDGET COUNTRY NAME");
-        authorInfo += LABEL_NEW_LINE;
-
-        if (!countryName.IsNull()) {
-            authorInfo += DPL::ToUTF8String(*countryName);
-        } else {
-            //authorInfo += _("IDS_IM_WIDGET_COUNTRY_UNKNOWN");
-            authorInfo += _("WIDGET COUNTRY UNKNOWN");
-        }
-    } else {
-        authorInfo +=
-            //_("IDS_IM_WIDGET_DOES_NOT_CONTAIN_RECOGNIZED_AUTHOR_SIGNATURE");
-            _("Widget does not contain recognized author signature");
-    }
-    return authorInfo;
-}
-
-void TaskCertify::stepAuthorInfoPopup()
-{
-    LogInfo("Step:: <<Author Popup Information>>");
-    std::string label
-        = createAuthorWidgetInfo() + LABEL_NEW_LINE_2 + QUESTION;
-    createInstallPopup(PopupType::WIDGET_AUTHOR_INFO, label);
-}
-
 void TaskCertify::stepFinalize()
 {
     LogInfo("Step: <<CERTYFYING DONE>>");
@@ -427,34 +317,10 @@ void TaskCertify::stepFinalize()
         "Widget Certification Check Finished");
 }
 
-void TaskCertify::stepWarningPopupAnswer()
-{
-    LogInfo("Step: <<Warning Popup Answer>>");
-    if (false == m_contextData.wacSecurity.isDistributorSigned() &&
-        WRT_POPUP_BUTTON_CANCEL == m_installCancel)
-    {
-        LogWarning("User does not agreed to install unsigned widgets!");
-        m_installCancel = WRT_POPUP_BUTTON;
-        destroyPopup();
-        ThrowMsg(Exceptions::NotAllowed, "Widget not allowed");
-    }
-}
-
-void TaskCertify::stepAuthorInfoPopupAnswer()
-{
-    LogInfo("Step: <<Author Info Popup Answer>>");
-    if (WRT_POPUP_BUTTON_CANCEL == m_installCancel) {
-        LogWarning("User does not agreed to install widget!");
-        m_installCancel = WRT_POPUP_BUTTON;
-        destroyPopup();
-        ThrowMsg(Exceptions::NotAllowed, "Widget not allowed");
-    }
-}
-
 bool TaskCertify::isTizenWebApp() const
 {
     bool ret = FALSE;
-    if (m_installContext.widgetConfig.webAppType.appType
+    if (m_contextData.widgetConfig.webAppType.appType
         == WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
     {
         ret = TRUE;
@@ -469,7 +335,7 @@ void TaskCertify::stepVerifyUpdate()
     CertificatePtr newCertificate =
         m_contextData.wacSecurity.getAuthorCertificatePtr();
     CertificatePtr oldCertificate =
-        getOldAuthorSignerCertificate(m_installContext.widgetConfig.tzAppid);
+        getOldAuthorSignerCertificate(m_contextData.widgetConfig.tzAppid);
 
     if (!!newCertificate && !!oldCertificate) {
         if (0 != newCertificate->getBase64().compare(oldCertificate->getBase64())) {