Upstream version 11.39.260.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / application_manifest_constants.cc
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "xwalk/application/common/application_manifest_constants.h"
6
7 namespace xwalk {
8
9 namespace application_manifest_keys {
10
11 // Official fields (ordered as spec):
12
13 const char kNameKey[] = "name";
14 const char kDisplay[] = "display";
15 const char kStartURLKey[] = "start_url";
16 const char kCSPKey[] = "csp";
17
18 // Deprecated entries:
19
20 const char kAppKey[] = "app";
21 const char kLaunchLocalPathKey[] = "app.launch.local_path";
22 const char kLaunchWebURLKey[] = "app.launch.web_url";
23 const char kDeprecatedURLKey[] = "url";
24 const char kDeprecatedVersionKey[] = "version";
25 const char kDeprecatedDescriptionKey[] = "description";
26 const char kDeprecatedCSPKey[] = "content_security_policy";
27 const char kLaunchScreen[] = "launch_screen";
28 const char kLaunchScreenDefault[] = "launch_screen.default";
29 const char kLaunchScreenImageBorderDefault[] =
30     "launch_screen.default.image_border";
31 const char kLaunchScreenImageBorderLandscape[] =
32     "launch_screen.landscape.image_border";
33 const char kLaunchScreenImageBorderPortrait[] =
34     "launch_screen.portrait.image_border";
35 const char kLaunchScreenLandscape[] =
36     "launch_screen.landscape";
37 const char kLaunchScreenPortrait[] =
38     "launch_screen.portrait";
39 const char kLaunchScreenReadyWhen[] =
40     "launch_screen.ready_when";
41
42 // XWalk W3C Manifest (XPK) extensions:
43
44 const char kPermissionsKey[] = "permissions";
45 const char kXWalkVersionKey[] = "xwalk_version";
46 const char kXWalkDescriptionKey[] = "xwalk_description";
47 const char kXWalkHostsKey[] = "xwalk_hosts";
48 const char kXWalkLaunchScreen[] = "xwalk_launch_screen";
49 const char kXWalkLaunchScreenDefault[] = "xwalk_launch_screen.default";
50 const char kXWalkLaunchScreenImageBorderDefault[] =
51     "xwalk_launch_screen.default.image_border";
52 const char kXWalkLaunchScreenImageBorderLandscape[] =
53     "xwalk_launch_screen.landscape.image_border";
54 const char kXWalkLaunchScreenImageBorderPortrait[] =
55     "xwalk_launch_screen.portrait.image_border";
56 const char kXWalkLaunchScreenLandscape[] =
57     "xwalk_launch_screen.landscape";
58 const char kXWalkLaunchScreenPortrait[] =
59     "xwalk_launch_screen.portrait";
60 const char kXWalkLaunchScreenReadyWhen[] =
61     "xwalk_launch_screen.ready_when";
62
63 #if defined(OS_TIZEN)
64 const char kTizenAppIdKey[] = "tizen_app_id";
65 const char kIcon128Key[] = "icons.128";
66 const char kXWalkMediaAppClass[] = "xwalk_media_app_class";
67 #endif
68
69 }  // namespace application_manifest_keys
70
71 // manifest keys for widget applications.
72 namespace application_widget_keys {
73
74 const char kNamespaceKey[] = "@namespace";
75 const char kXmlLangKey[] = "@lang";
76 const char kDefaultLocaleKey[] = "widget.@defaultlocale";
77 const char kNameKey[] = "widget.name.#text";
78 const char kVersionKey[] = "widget.@version";
79 const char kViewModesKey[] = "widget.@viewmodes";
80 const char kWidgetKey[] = "widget";
81 const char kLaunchLocalPathKey[] = "widget.content.@src";
82 const char kWebURLsKey[] = "widget.@id";
83 const char kAuthorKey[] = "widget.author.#text";
84 const char kDescriptionKey[] = "widget.description.#text";
85 const char kShortNameKey[] = "widget.name.@short";
86 const char kIDKey[] = "widget.@id";
87 const char kAuthorEmailKey[] = "widget.author.@email";
88 const char kAuthorHrefKey[] = "widget.author.@href";
89 const char kHeightKey[] = "widget.@height";
90 const char kWidthKey[] = "widget.@width";
91 const char kPreferencesKey[] = "widget.preference";
92 const char kCSPKey[] = "widget.content-security-policy.#text";
93 const char kAccessKey[] = "widget.access";
94
95 // Child keys inside 'kPreferencesKey'.
96 const char kPreferencesNameKey[] = "@name";
97 const char kPreferencesValueKey[] = "@value";
98 const char kPreferencesReadonlyKey[] = "@readonly";
99
100 const char kWidgetNamespaceKey[] = "widget.@namespace";
101 const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
102
103 // Child keys inside 'kAccessKey'.
104 const char kAccessOriginKey[] = "@origin";
105 const char kAccessSubdomainsKey[] = "@subdomains";
106
107 #if defined(OS_TIZEN)
108 const char kTizenWidgetKey[] = "widget";
109 const char kIcon128Key[] = "widget.icon.@src";
110 const char kTizenApplicationKey[] = "widget.application";
111 // Child keys inside 'kTizenApplicationKey'
112 const char kTizenApplicationIdKey[] = "@id";
113 const char kTizenApplicationPackageKey[] = "@package";
114 const char kTizenApplicationRequiredVersionKey[] = "@required_version";
115
116 const char kTizenAppIdKey[] = "widget.application.@package";
117 const char kAllowNavigationKey[] = "widget.allow-navigation.#text";
118 const char kCSPReportOnlyKey[] =
119     "widget.content-security-policy-report-only.#text";
120 const char kTizenSettingKey[] = "widget.setting";
121 const char kTizenBackgroundSupportKey[] = "widget.setting.@background-support";
122 const char kTizenContextMenuKey[] = "widget.setting.@context-menu";
123 const char kTizenHardwareKey[] = "widget.setting.@hwkey-event";
124 const char kTizenEncryptionKey[] = "widget.setting.@encryption";
125 const char kTizenMetaDataKey[] = "widget.metadata";
126 // Child keys inside 'kTizenMetaDataKey'
127 const char kTizenMetaDataNameKey[] = "@key";
128 const char kTizenMetaDataValueKey[] = "@value";
129 const char kTizenSplashScreenKey[] = "widget.splash-screen";
130 const char kTizenSplashScreenSrcKey[] = "@src";
131 const char kContentNamespace[] = "widget.content.@namespace";
132 const char kTizenScreenOrientationKey[] = "widget.setting.@screen-orientation";
133 const char kTizenAppWidgetFullKey[] = "widget.app-widget";
134 const char kTizenAppWidgetKey[] = "app-widget";
135 const char kTizenAppWidgetIdKey[] = "@id";
136 const char kTizenAppWidgetPrimaryKey[] = "@primary";
137 const char kTizenAppWidgetUpdatePeriodKey[] = "@update-period";
138 const char kTizenAppWidgetAutoLaunchKey[] = "@auto-launch";
139 const char kTizenAppWidgetBoxLabelKey[] = "box-label";
140 const char kTizenAppWidgetBoxLabelLangKey[] = "@lang";
141 const char kTizenAppWidgetBoxLabelTextKey[] = "#text";
142 const char kTizenAppWidgetBoxIconKey[] = "box-icon";
143 const char kTizenAppWidgetBoxIconSrcKey[] = "@src";
144 const char kTizenAppWidgetBoxContentKey[] = "box-content";
145 const char kTizenAppWidgetBoxContentSrcKey[] = "@src";
146 const char kTizenAppWidgetBoxContentMouseEventKey[] = "@mouse-event";
147 const char kTizenAppWidgetBoxContentTouchEffectKey[] = "@touch-effect";
148 const char kTizenAppWidgetBoxContentSizeKey[] = "box-size";
149 const char kTizenAppWidgetBoxContentSizeTextKey[] = "#text";
150 const char kTizenAppWidgetBoxContentSizePreviewKey[] = "@preview";
151 const char kTizenAppWidgetBoxContentSizeUseDecorationKey[] = "@use-decoration";
152 const char kTizenAppWidgetBoxContentDropViewKey[] = "pd";
153 const char kTizenAppWidgetBoxContentDropViewSrcKey[] = "@src";
154 const char kTizenAppWidgetBoxContentDropViewWidthKey[] = "@width";
155 const char kTizenAppWidgetBoxContentDropViewHeightKey[] = "@height";
156 // App control
157 const char kTizenApplicationAppControlsKey[] = "widget.app-control";
158 const char kTizenApplicationAppControlSrcKey[] = "src";
159 const char kTizenApplicationAppControlOperationKey[] = "operation";
160 const char kTizenApplicationAppControlUriKey[] = "uri";
161 const char kTizenApplicationAppControlMimeKey[] = "mime";
162 const char kTizenApplicationAppControlChildNameAttrKey[] = "@name";
163 const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
164 #endif
165
166 }  // namespace application_widget_keys
167
168 namespace application_manifest_errors {
169 const char kInvalidDescription[] =
170     "Invalid value for 'description'.";
171 const char kInvalidKey[] =
172     "Value 'key' is missing or invalid.";
173 const char kInvalidName[] =
174     "Required value 'name' is missing or invalid.";
175 const char kInvalidVersion[] =
176     "Required value 'version' is missing or invalid. It must be between 1-4 "
177     "dot-separated integers each between 0 and 65536.";
178 const char kManifestParseError[] =
179     "Manifest is not valid JSON.";
180 const char kManifestUnreadable[] =
181     "Manifest file is missing or unreadable.";
182 }  // namespace application_manifest_errors
183
184 namespace application {
185
186 const char* GetNameKey(Manifest::Type manifest_type) {
187   if (manifest_type == Manifest::TYPE_WIDGET)
188     return application_widget_keys::kNameKey;
189
190   return application_manifest_keys::kNameKey;
191 }
192
193 const char* GetVersionKey(Manifest::Type manifest_type) {
194   if (manifest_type == Manifest::TYPE_WIDGET)
195     return application_widget_keys::kVersionKey;
196
197   return application_manifest_keys::kXWalkVersionKey;
198 }
199
200 const char* GetCSPKey(Manifest::Type manifest_type) {
201   if (manifest_type == Manifest::TYPE_WIDGET)
202     return application_widget_keys::kCSPKey;
203
204   return application_manifest_keys::kCSPKey;
205 }
206
207 #if defined(OS_TIZEN)
208 const char* GetTizenAppIdKey(Manifest::Type manifest_type) {
209   if (manifest_type == Manifest::TYPE_WIDGET)
210     return application_widget_keys::kTizenAppIdKey;
211
212   return application_manifest_keys::kTizenAppIdKey;
213 }
214
215 const char* GetIcon128Key(Manifest::Type manifest_type) {
216   if (manifest_type == Manifest::TYPE_WIDGET)
217     return application_widget_keys::kIcon128Key;
218
219   return application_manifest_keys::kIcon128Key;
220 }
221 #endif
222 }  // namespace application
223 }  // namespace xwalk