ConfigParserData& m_data;
};
-class FeatureParser : public ElementParser
-{
- public:
- struct ParamParser : public ElementParser
- {
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return &IgnoringParser::Create;
- }
-
- virtual void Accept(const XmlAttribute& attribute)
- {
- if (attribute.name == L"name") {
- m_name = attribute.value;
- NormalizeString(m_name);
- } else if (attribute.name == L"value") {
- m_value = attribute.value;
- NormalizeString(m_value);
- }
- }
-
- virtual void Accept(const Element& /*element*/)
- {}
-
- virtual void Accept(const Text& /*text*/)
- {
- ThrowMsg(Exception::ParseError, "param element must be empty");
- }
-
- virtual void Verify()
- {
- if (m_name.IsNull() || *m_name == L"") {
- return;
- }
- if (m_value.IsNull() || *m_value == L"") {
- return;
- }
-
- ConfigParserData::Param param(*m_name);
- param.value = *m_value;
-
- if (m_data.paramsList.find(param) == m_data.paramsList.end()) {
- m_data.paramsList.insert(param);
- }
- }
-
- ParamParser(ConfigParserData::Feature& data) :
- ElementParser(),
- m_data(data)
- {}
-
- private:
- DPL::OptionalString m_name;
- DPL::OptionalString m_value;
- ConfigParserData::Feature& m_data;
- };
-
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
- {
- if (name == L"param") {
- return DPL::MakeDelegate(this, &FeatureParser::OnParamElement);
- } else {
- return &IgnoringParser::Create;
- }
- }
-
- virtual void Accept(const Text& /*text*/)
- {}
-
- virtual void Accept(const Element& /*element*/)
- {}
-
- virtual void Accept(const XmlAttribute& attribute)
- {
- if (attribute.name == L"name") {
- m_feature.name = attribute.value;
- } else if (attribute.name == L"required") {
- if (attribute.value == L"false") {
- m_feature.required = false;
- } else {
- m_feature.required = true;
- }
- }
- }
-
- virtual void Verify()
- {
- LibIri::Wrapper iri(DPL::ToUTF8String(m_feature.name).c_str());
-
- if (m_feature.name != L"") {
- if (iri.Validate()) {
- if (m_data.featuresList.find(m_feature) ==
- m_data.featuresList.end())
- {
- m_data.featuresList.insert(m_feature);
- } else {
- LogDebug("Ignoring feature with name" <<
- DPL::ToUTF8String(m_feature.name));
- }
- } else {
- if (m_feature.required) {
- //Throw only if required
- ThrowMsg(Exception::ParseError, "invalid feature IRI");
- }
- }
- }
- }
-
- ElementParserPtr OnParamElement()
- {
- return ElementParserPtr(new ParamParser(m_feature));
- }
-
- FeatureParser(ConfigParserData& data) :
- ElementParser(),
- m_data(data),
- m_feature(L"")
- {}
-
- private:
- ConfigParserData& m_data;
- ConfigParserData::Feature m_feature;
-};
-
class PreferenceParser : public ElementParser
{
public:
m_privilege.name = attribute.value;
}
}
- m_feature.required = false;
}
virtual void Verify()
m_data.featuresList.insert(m_feature);
} else {
LogDebug("Ignoring feature with name" <<
- DPL::ToUTF8String(m_feature.name));
+ DPL::ToUTF8String(m_feature.name));
}
}
}
ConfigParserData& m_data;
};
-class LiveboxParser : public ElementParser
+class AppWidgetParser : public ElementParser
{
public:
if (name == L"box-size") {
return DPL::MakeDelegate(
this,
- &LiveboxParser::BoxContentParser::
+ &AppWidgetParser::BoxContentParser::
OnBoxSizeElement);
} else if (name == L"pd") {
return DPL::MakeDelegate(
this,
- &LiveboxParser::BoxContentParser::
+ &AppWidgetParser::BoxContentParser::
OnPdElement);
} else {
ThrowMsg(Exception::ParseError,
if (attribute.name == L"mouse-event") {
m_box.m_boxMouseEvent = attribute.value;
}
+ if (attribute.name == L"touch-effect") {
+ m_box.m_boxTouchEffect = attribute.value;
+ }
}
}
const DPL::String& name)
{
if (name == L"box-label") {
- return DPL::MakeDelegate(this, &LiveboxParser::OnBoxLabelElement);
+ return DPL::MakeDelegate(this, &AppWidgetParser::OnBoxLabelElement);
} else if (name == L"box-icon") {
- return DPL::MakeDelegate(this, &LiveboxParser::OnBoxIconElement);
+ return DPL::MakeDelegate(this, &AppWidgetParser::OnBoxIconElement);
} else if (name == L"box-content") {
- return DPL::MakeDelegate(this, &LiveboxParser::OnBoxContentElement);
+ return DPL::MakeDelegate(this, &AppWidgetParser::OnBoxContentElement);
} else {
return &IgnoringParser::Create;
}
m_data.m_livebox.push_back(m_livebox);
}
- explicit LiveboxParser(ConfigParserData& data) :
+ explicit AppWidgetParser(ConfigParserData& data) :
ElementParser(),
m_data(data),
m_properNamespace(false)
DPL::OptionalString m_policy;
};
+class AccountParser : public ElementParser
+{
+ public:
+ struct AccountProviderParser : public ElementParser
+ {
+ public:
+
+ struct IconParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const Text& text)
+ {
+ if (text.value == L"") {
+ return;
+ }
+ m_value = text.value;
+ }
+
+ virtual void Accept(const Element& /*element*/)
+ {}
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (attribute.name == L"section") {
+ if (attribute.value == L"account") {
+ m_type = ConfigParserData::IconSectionType::DefaultIcon;
+ } else if (attribute.value == L"account-small") {
+ m_type = ConfigParserData::IconSectionType::SmallIcon;
+ }
+ }
+ }
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ std::pair<ConfigParserData::IconSectionType, DPL::String> icon;
+ icon.first = m_type;
+ icon.second = *m_value;
+
+ m_data.m_iconSet.insert(icon);
+ }
+
+ IconParser(ConfigParserData::AccountProvider& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_type(ConfigParserData::DefaultIcon),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ ConfigParserData::IconSectionType m_type;
+ ConfigParserData::AccountProvider& m_data;
+ DPL::OptionalString m_value;
+ };
+
+ struct DisplayNameParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const Text& text)
+ {
+ if (text.value == L"") {
+ return;
+ }
+ m_value = text.value;
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ m_lang = element.lang;
+ m_value= L"";
+ }
+
+ virtual void Accept(const XmlAttribute& /*attribute*/)
+ {}
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ std::pair<DPL::String, DPL::String> name;
+ name.first = *m_lang;
+ name.second = *m_value;
+
+ m_data.m_displayNameSet.insert(name);
+ }
+
+ DisplayNameParser(ConfigParserData::AccountProvider& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_lang;
+ DPL::OptionalString m_value;
+ ConfigParserData::AccountProvider& m_data;
+ };
+
+ struct CapabilityParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const Text& text)
+ {
+ if (text.value == L"") {
+ return;
+ }
+ m_value = text.value;
+ }
+
+ virtual void Accept(const Element& /*element*/)
+ {}
+
+ virtual void Accept(const XmlAttribute& /*attribute*/)
+ {}
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+ m_data.m_capabilityList.push_back(*m_value);
+ }
+
+ CapabilityParser(ConfigParserData::AccountProvider& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_value;
+ ConfigParserData::AccountProvider& m_data;
+ };
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& name)
+ {
+ if (name == L"icon") {
+ return DPL::MakeDelegate(this, &AccountProviderParser::OnIconElement);
+ } else if (name == L"display-name") {
+ return DPL::MakeDelegate(this,
+ &AccountProviderParser::OnDisplayNameElement);
+ } else if (name == L"capability") {
+ return DPL::MakeDelegate(this, &AccountProviderParser::OnCapabilityElement);
+ } else {
+ return &IgnoringParser::Create;
+ }
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {}
+
+ virtual void Accept(const Element& /*element*/)
+ {}
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (attribute.name == L"multiple-accounts-support") {
+ if (attribute.value == L"") {
+ return;
+ }
+
+ if (attribute.value == L"ture") {
+ m_multiSupport = true;
+ }
+ }
+ }
+
+ virtual void Verify()
+ {
+ m_data.m_multiAccountSupport = m_multiSupport;
+ }
+
+ ElementParserPtr OnIconElement()
+ {
+ return ElementParserPtr(new IconParser(m_data));
+ }
+
+ ElementParserPtr OnDisplayNameElement()
+ {
+ return ElementParserPtr(new DisplayNameParser(m_data));
+ }
+
+ ElementParserPtr OnCapabilityElement()
+ {
+ return ElementParserPtr(new CapabilityParser(m_data));
+ }
+
+ AccountProviderParser(ConfigParserData::AccountProvider& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_multiSupport(false),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ bool m_multiSupport;
+ ConfigParserData::AccountProvider& m_data;
+ };
+
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& name)
+ {
+ if (name == L"account-provider") {
+ return DPL::MakeDelegate(this, &AccountParser::OnProviderElement);
+ } else {
+ return &IgnoringParser::Create;
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName) {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const XmlAttribute& /*attribute*/)
+ {}
+
+ virtual void Accept(const Text& /*text*/)
+ {}
+
+ virtual void Verify()
+ {}
+
+ ElementParserPtr OnProviderElement()
+ {
+ return ElementParserPtr(new AccountProviderParser(m_account));
+ }
+
+ AccountParser(ConfigParserData& data) :
+ ElementParser(),
+ m_data(data),
+ m_account(data.accountProvider),
+ m_properNamespace(false),
+ m_multiSupport(false)
+ {}
+
+ private:
+ ConfigParserData& m_data;
+ ConfigParserData::AccountProvider& m_account;
+ bool m_properNamespace;
+ bool m_multiSupport;
+};
+
ElementParser::ActionFunc WidgetParser::GetElementParser(
const DPL::String& /*ns*/,
const DPL::String&
m_map[L"icon"] = DPL::MakeDelegate(this, &WidgetParser::OnIconElement);
m_map[L"content"] =
DPL::MakeDelegate(this, &WidgetParser::OnContentElement);
- m_map[L"feature"] =
- DPL::MakeDelegate(this, &WidgetParser::OnFeatureElement);
m_map[L"preference"] =
DPL::MakeDelegate(this, &WidgetParser::OnPreferenceElement);
m_map[L"link"] = DPL::MakeDelegate(this, &WidgetParser::OnLinkElement);
OnAppControlElement);
m_map[L"category"] = DPL::MakeDelegate(this,
&WidgetParser::OnCategoryElement);
- m_map[L"livebox"] = DPL::MakeDelegate(this, &WidgetParser::OnLiveboxElement);
+ m_map[L"app-widget"] = DPL::MakeDelegate(this, &WidgetParser::OnAppWidgetElement);
#ifdef CSP_ENABLED
- m_map[L"Content-Security-Policy"] = DPL::MakeDelegate(
+ m_map[L"content-security-policy"] = DPL::MakeDelegate(
this,
&WidgetParser::
OnCspElement);
- m_map[L"Content-Security-Policy-Report-Only"] = DPL::MakeDelegate(
+ m_map[L"content-security-policy-report-only"] = DPL::MakeDelegate(
this,
&WidgetParser::
OnCspReportOnlyElement);
#endif
+ m_map[L"account"] = DPL::MakeDelegate(this, &WidgetParser::OnAccountElement);
}
ElementParserPtr WidgetParser::OnNameElement()
return ElementParserPtr(new ContentParser(m_data));
}
-ElementParserPtr WidgetParser::OnFeatureElement()
-{
- return ElementParserPtr(new FeatureParser(m_data));
-}
-
ElementParserPtr WidgetParser::OnPreferenceElement()
{
return ElementParserPtr(new PreferenceParser(m_data));
return ElementParserPtr(new CategoryParser(m_data));
}
-ElementParserPtr WidgetParser::OnLiveboxElement()
+ElementParserPtr WidgetParser::OnAppWidgetElement()
{
- return ElementParserPtr(new LiveboxParser(m_data));
+ return ElementParserPtr(new AppWidgetParser(m_data));
}
ElementParserPtr WidgetParser::OnCspElement()
return ElementParserPtr(new CspReportOnlyParser(m_data));
}
+ElementParserPtr WidgetParser::OnAccountElement()
+{
+ return ElementParserPtr(new AccountParser(m_data));
+}
+
void WidgetParser::Accept(const Element& element)
{
if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName &&