ConfigParserData& m_data;
};
-class LinkParser : public ElementParser
-{
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return &DenyAllParser::Create;
- }
-
- virtual void Accept(const XmlAttribute& attribute)
- {
- if (m_properNamespace) {
- LogDebug("attribute");
- if (attribute.name == L"rel") {
- if (attribute.value != L"describedby") {
- ThrowMsg(Exception::ParseError,
- "rel attribute must have describedby value");
- }
- } else if (attribute.name == L"type") {} else if (attribute.name ==
- L"href")
- {
- LogDebug("here is href");
- m_href = attribute.value;
- } else {
- ThrowMsg(Exception::ParseError,
- "unknown attribute '" +
- DPL::ToUTF8String(attribute.name) +
- "' in link element");
- }
- }
- }
-
- virtual void Accept(const Element& element)
- {
- if (element.ns ==
- ConfigurationNamespace::WacWidgetNamespaceNameForLinkElement)
- {
- m_properNamespace = true;
- }
- LogDebug("element");
- }
-
- virtual void Accept(const Text&)
- {
- if (m_properNamespace) {
- LogDebug("text");
- ThrowMsg(Exception::ParseError, "link element must be empty");
- }
- }
-
- virtual void Verify()
- {
- if (!m_href) {
- ThrowMsg(Exception::ParseError,
- "link element must have href attribute");
- }
-
- LibIri::Wrapper iri(DPL::ToUTF8String(*m_href).c_str());
- if (!iri.Validate()) { // TODO: Better uri validator ?
- ThrowMsg(Exception::ParseError,
- "href attribute must be a valid iri/uri/url");
- }
- }
-
- LinkParser(ConfigParserData& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data),
- m_href(DPL::OptionalString::Null)
- {}
-
- private:
- bool m_properNamespace;
- ConfigParserData& m_data;
- DPL::OptionalString m_href;
-};
-
class SettingParser : public ElementParser
{
public:
DPL::MakeDelegate(this, &WidgetParser::OnContentElement);
m_map[L"preference"] =
DPL::MakeDelegate(this, &WidgetParser::OnPreferenceElement);
- m_map[L"link"] = DPL::MakeDelegate(this, &WidgetParser::OnLinkElement);
m_map[L"setting"] =
DPL::MakeDelegate(this, &WidgetParser::OnSettingElement);
m_map[L"application"] = DPL::MakeDelegate(
return ElementParserPtr(new PreferenceParser(m_data));
}
-ElementParserPtr WidgetParser::OnLinkElement()
-{
- return ElementParserPtr(new LinkParser(m_data));
-}
-
ElementParserPtr WidgetParser::OnSettingElement()
{
return ElementParserPtr(new SettingParser(m_data));
namespace ConfigurationNamespace {
static const DPL::String W3CWidgetNamespaceName =
L"http://www.w3.org/ns/widgets";
-static const DPL::String WacWidgetNamespaceNameForLinkElement =
- L"http://wacapps.net/ns/widgets#";
-static const DPL::String WacWidgetNamespaceName =
- L"http://wacapps.net/ns/widgets";
static const DPL::String TizenWebAppNamespaceName =
L"http://tizen.org/ns/widgets";
}
namespace PluginsPrefix {
const char * const W3CPluginsPrefix = "http://www.w3.org/";
-const char * const WACPluginsPrefix = "http://wacapps.net/api/";
const char * const TIZENPluginsPrefix = "http://tizen.org/api/";
}
ElementParserPtr OnContentElement();
ElementParserPtr OnPreferenceElement();
ElementParserPtr OnAccessElement();
- ElementParserPtr OnLinkElement();
ElementParserPtr OnSettingElement();
ElementParserPtr OnApplicationElement();
ElementParserPtr OnSplashElement();
{
LogDebug("Updating Ace database");
struct widget_info wi;
- DPL::OptionalString os;
switch (widgetConfig.webAppType.appType) {
- case WrtDB::APP_TYPE_WAC20:
- wi.type = WAC20;
- break;
case WrtDB::APP_TYPE_TIZENWEBAPP:
wi.type = Tizen;
break;
WidgetDAOReadOnly dao(widgetHandle);
WidgetType type = dao.getWidgetType();
- if (type == WrtDB::APP_TYPE_WAC20) {
- wi.type = WAC20;
- } else if (type == WrtDB::APP_TYPE_TIZENWEBAPP) {
+ if (type == WrtDB::APP_TYPE_TIZENWEBAPP) {
wi.type = Tizen;
} else {
LogError("Unknown application type");
"Config.xml has more than one valid namespace");
}
widgetAppType = APP_TYPE_TIZENWEBAPP;
- } else if (
- *iterator ==
- ConfigurationNamespace::WacWidgetNamespaceNameForLinkElement ||
- *iterator ==
- ConfigurationNamespace::WacWidgetNamespaceName)
- {
- if (widgetAppType != APP_TYPE_UNKNOWN &&
- widgetAppType != APP_TYPE_WAC20)
- {
- LogError("To many namespaces declared in configuration fileB.");
- ThrowMsg(Exceptions::WidgetConfigFileInvalid,
- "Config.xml has more than one valid namespace");
- }
- widgetAppType = APP_TYPE_WAC20;
} else {
LogDebug("Namespace ignored.");
}
SignatureFileInfoSet::reverse_iterator iter = signatureFiles.rbegin();
LogInfo("Number of signatures: " << signatureFiles.size());
- bool complianceMode = GlobalDAOReadOnly::getComplianceMode();
-
for (; iter != signatureFiles.rend(); ++iter) {
LogInfo("Checking signature with id=" << iter->getFileNumber());
SignatureData data(widgetPath + iter->getFileName(),
xml.initialize(data, GlobalConfig::GetSignatureXmlSchema());
xml.read(data);
- WrtSignatureValidator::AppType appType =
- WrtSignatureValidator::WAC20;
-
- if (m_contextData.widgetConfig.webAppType ==
- APP_TYPE_TIZENWEBAPP)
- {
- appType = WrtSignatureValidator::TIZEN;
- }
-
WrtSignatureValidator::Result result;
WrtSignatureValidator validator(
- appType,
+ WrtSignatureValidator::TIZEN,
!GlobalSettings::
OCSPTestModeEnabled(),
!GlobalSettings::
CrlTestModeEnabled(),
- complianceMode);
+ false);
result = validator.check(data, widgetPath);
if (strstr(feature, PluginsPrefix::TIZENPluginsPrefix) == feature) {
// Tizen WebApp feature
featureType = APP_TYPE_TIZENWEBAPP;
- } else if (strstr(feature, PluginsPrefix::WACPluginsPrefix) == feature) {
- // WAC 2.0 feature
- featureType = APP_TYPE_WAC20;
} else if (strstr(feature, PluginsPrefix::W3CPluginsPrefix) == feature) {
// W3C standard feature
// Both WAC and TIZEN WebApp are possible to use W3C plugins
std::string version;
if (appType == WrtDB::AppType::APP_TYPE_TIZENWEBAPP) {
version = WrtDB::GlobalConfig::GetTizenVersion();
- } else if (appType == WrtDB::AppType::APP_TYPE_WAC20) {
- version = WrtDB::GlobalConfig::GetWACVersion();
} else {
LogWarning("Invaild AppType");
return false;