Merge "Fixed widget install fail when using partner privilege"
[framework/web/wrt-installer.git] / src / configuration_parser / widget_parser.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * This file  have been implemented in compliance with  W3C WARP SPEC.
18  * but there are some patent issue between  W3C WARP SPEC and APPLE.
19  * so if you want to use this file, refer to the README file in root directory
20  */
21 /**
22  * @file        widget_parser.h
23  * @author      Lukasz Wrzosek (l.wrzosek@samsung.com)
24  * @version     0.1
25  * @brief
26  */
27 #ifndef WIDGET_PARSER_H_
28 #define WIDGET_PARSER_H_
29
30 #include "element_parser.h"
31 #include <list>
32 #include <map>
33 #include <dpl/foreach.h>
34 #include <dpl/wrt-dao-ro/config_parser_data.h>
35
36 namespace ConfigurationNamespace {
37 static const DPL::String W3CWidgetNamespaceName =
38     L"http://www.w3.org/ns/widgets";
39 static const DPL::String WacWidgetNamespaceNameForLinkElement =
40     L"http://wacapps.net/ns/widgets#";
41 static const DPL::String WacWidgetNamespaceName =
42     L"http://wacapps.net/ns/widgets";
43 static const DPL::String TizenWebAppNamespaceName =
44     L"http://tizen.org/ns/widgets";
45 }
46
47 namespace PluginsPrefix {
48 const char * const W3CPluginsPrefix = "http://www.w3.org/";
49 const char * const WACPluginsPrefix = "http://wacapps.net/api/";
50 const char * const TIZENPluginsPrefix = "http://tizen.org/api/";
51 }
52
53 namespace Unicode {
54 enum Direction
55 {
56     LRE,
57     RLE,
58     LRO,
59     RLO,
60     EMPTY
61 };
62 }
63
64 class WidgetParser : public ElementParser
65 {
66   public:
67     ElementParserPtr OnNameElement();
68     ElementParserPtr OnDescriptionElement();
69     ElementParserPtr OnAuthorElement();
70     ElementParserPtr OnLicenseElement();
71     ElementParserPtr OnIconElement();
72     ElementParserPtr OnContentElement();
73     ElementParserPtr OnFeatureElement();
74     ElementParserPtr OnPreferenceElement();
75     ElementParserPtr OnAccessElement();
76     ElementParserPtr OnLinkElement();
77     ElementParserPtr OnSettingElement();
78     ElementParserPtr OnApplicationElement();
79     ElementParserPtr OnSplashElement();
80     ElementParserPtr OnBackgroundElement();
81     ElementParserPtr OnPrivilegeElement();
82     ElementParserPtr OnAppServiceElement();
83     ElementParserPtr OnAppControlElement();
84     ElementParserPtr OnCategoryElement();
85     ElementParserPtr OnAppWidgetElement();
86     ElementParserPtr OnCspElement();
87     ElementParserPtr OnCspReportOnlyElement();
88
89     virtual ActionFunc GetElementParser(const DPL::String& ns,
90                                         const DPL::String& name);
91
92     virtual void Accept(const Element&);
93     virtual void Accept(const Text&);
94     virtual void Accept(const XmlAttribute&);
95     virtual void Verify();
96
97     //Typedef used by RootParser
98     typedef WrtDB::ConfigParserData& Data;
99
100     WidgetParser(Data&);
101
102   private:
103     Data& m_data;
104     Unicode::Direction m_textDirection;
105     FuncMap m_map;
106     DPL::Optional<DPL::String> m_version;
107     DPL::Optional<DPL::String> m_minVersion;
108     std::list<DPL::String> m_windowModes;
109     DPL::Optional<DPL::String> m_defaultlocale;
110     std::map<DPL::String, DPL::String> m_nameSpaces;
111 };
112
113 struct IconParser;
114 struct ContentParser;
115
116 #endif // WIDGET_PARSER_H_