Inline mode support
[framework/web/wrt-installer.git] / src / configuration_parser / widget_parser.cpp
index a7e68d5..2f12265 100644 (file)
@@ -1252,6 +1252,53 @@ class AppControlParser : public ElementParser
         ConfigParserData::AppControlInfo& m_data;
     };
 
+    struct DispositionParser : 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*/)
+        {}
+
+        virtual void Accept(const XmlAttribute& attribute)
+        {
+            if (attribute.name == L"disposition") {
+                if (attribute.value.size() > 0) {
+                    m_value = attribute.value;
+                    NormalizeString(m_value);
+                }
+            }
+        }
+
+        virtual void Verify()
+        {
+            if (m_value.IsNull() || *m_value != L"inline") {
+                m_data.m_disposition = ConfigParserData::AppControlInfo::Disposition::WINDOW;
+            }
+            else {
+                m_data.m_disposition = ConfigParserData::AppControlInfo::Disposition::INLINE;
+            }
+        }
+
+        DispositionParser(ConfigParserData::AppControlInfo& data) :
+            ElementParser(),
+            m_properNamespace(false),
+            m_data(data)
+        {}
+
+      private:
+        bool m_properNamespace;
+        DPL::OptionalString m_value;
+        ConfigParserData::AppControlInfo& m_data;
+    };
+
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
                                         const DPL::String& name)
     {
@@ -1264,6 +1311,9 @@ class AppControlParser : public ElementParser
             return DPL::MakeDelegate(this, &AppControlParser::OnUriElement);
         } else if (name == L"mime") {
             return DPL::MakeDelegate(this, &AppControlParser::OnMimeElement);
+        } else if (name == L"disposition") {
+            return DPL::MakeDelegate(this,
+                                     &AppControlParser::OnDispositionElement);
         } else {
             return &IgnoringParser::Create;
         }
@@ -1321,6 +1371,11 @@ class AppControlParser : public ElementParser
         return ElementParserPtr(new MimeParser(m_appControl));
     }
 
+    ElementParserPtr OnDispositionElement()
+    {
+        return ElementParserPtr(new DispositionParser(m_appControl));
+    }
+
     AppControlParser(ConfigParserData& data) :
         ElementParser(),
         m_data(data),