From 089ad8d52f87a44658d1d549356c5cecc2e5a983 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Tue, 11 Dec 2012 09:42:00 +0900 Subject: [PATCH] Support [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] Implement tizen:privilege for plugin features [SCMRequest] N/A Change-Id: I85f5634bbca8a07a479a6d050a9a59b30281a4eb --- src/configuration_parser/widget_parser.cpp | 70 ++++++++++++++++++++++++++++++ src/configuration_parser/widget_parser.h | 1 + 2 files changed, 71 insertions(+) mode change 100755 => 100644 src/configuration_parser/widget_parser.cpp diff --git a/src/configuration_parser/widget_parser.cpp b/src/configuration_parser/widget_parser.cpp old mode 100755 new mode 100644 index 1fe1150..8144fbb --- a/src/configuration_parser/widget_parser.cpp +++ b/src/configuration_parser/widget_parser.cpp @@ -1335,6 +1335,70 @@ class BackgroundParser : public ElementParser ConfigParserData& m_data; }; +class PrivilegeParser : public ElementParser +{ + public: + virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, + const DPL::String& name) + { + return &IgnoringParser::Create; + } + + virtual void Accept(const Text& /*text*/) + { + } + + virtual void Accept(const Element& element) + { + if (element.ns == + ConfigurationNamespace::TizenWebAppNamespaceName) + { + m_properNamespace = true; + } + LogDebug("element"); + } + + virtual void Accept(const XmlAttribute& attribute) + { + if (m_properNamespace) { + if (attribute.name == L"name") { + m_feature.name = attribute.value; + } + } + 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)); + } + } + } + } + + PrivilegeParser(ConfigParserData& data) : + ElementParser(), + m_data(data), + m_feature(L""), + m_properNamespace(false) + { + } + + private: + ConfigParserData& m_data; + ConfigParserData::Feature m_feature; + bool m_properNamespace; +}; + ElementParser::ActionFunc WidgetParser::GetElementParser(const DPL::String& /*ns*/, const DPL::String& name) { @@ -1371,6 +1435,7 @@ WidgetParser::WidgetParser(ConfigParserData& data) : m_map[L"application"] = DPL::MakeDelegate(this, &WidgetParser::OnApplicationElement); m_map[L"splash"] = DPL::MakeDelegate(this, &WidgetParser::OnSplashElement); m_map[L"background"] = DPL::MakeDelegate(this, &WidgetParser::OnBackgroundElement); + m_map[L"privilege"] = DPL::MakeDelegate(this, &WidgetParser::OnPrivilegeElement); } ElementParserPtr WidgetParser::OnNameElement() @@ -1448,6 +1513,11 @@ ElementParserPtr WidgetParser::OnBackgroundElement() return ElementParserPtr(new BackgroundParser(m_data)); } +ElementParserPtr WidgetParser::OnPrivilegeElement() +{ + return ElementParserPtr(new PrivilegeParser(m_data)); +} + void WidgetParser::Accept(const Element& element) { if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName && diff --git a/src/configuration_parser/widget_parser.h b/src/configuration_parser/widget_parser.h index 159e583..64d09be 100644 --- a/src/configuration_parser/widget_parser.h +++ b/src/configuration_parser/widget_parser.h @@ -79,6 +79,7 @@ class WidgetParser : public ElementParser ElementParserPtr OnApplicationElement(); ElementParserPtr OnSplashElement(); ElementParserPtr OnBackgroundElement(); + ElementParserPtr OnPrivilegeElement(); virtual ActionFunc GetElementParser(const DPL::String& ns, const DPL::String& name); -- 2.7.4