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.
5 #include "xwalk/application/common/application_manifest_constants.h"
9 namespace application_manifest_keys {
11 // Official fields (ordered as spec):
13 const char kNameKey[] = "name";
14 const char kDisplay[] = "display";
15 const char kStartURLKey[] = "start_url";
16 const char kCSPKey[] = "csp";
18 // Deprecated entries:
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";
42 // XWalk W3C Manifest (XPK) extensions:
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";
64 const char kTizenAppIdKey[] = "tizen_app_id";
65 const char kIcon128Key[] = "icons.128";
66 const char kXWalkMediaAppClass[] = "xwalk_media_app_class";
69 } // namespace application_manifest_keys
71 // manifest keys for widget applications.
72 namespace application_widget_keys {
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";
95 // Child keys inside 'kPreferencesKey'.
96 const char kPreferencesNameKey[] = "@name";
97 const char kPreferencesValueKey[] = "@value";
98 const char kPreferencesReadonlyKey[] = "@readonly";
100 // Child keys inside 'kAccessKey'.
101 const char kAccessOriginKey[] = "@origin";
102 const char kAccessSubdomainsKey[] = "@subdomains";
104 #if defined(OS_TIZEN)
105 const char kTizenWidgetKey[] = "widget";
106 const char kIcon128Key[] = "widget.icon.@src";
107 const char kTizenApplicationKey[] = "widget.application";
108 // Child keys inside 'kTizenApplicationKey'
109 const char kTizenApplicationIdKey[] = "@id";
110 const char kTizenApplicationPackageKey[] = "@package";
111 const char kTizenApplicationRequiredVersionKey[] = "@required_version";
113 const char kTizenAppIdKey[] = "widget.application.@package";
114 const char kAllowNavigationKey[] = "widget.allow-navigation.#text";
115 const char kCSPReportOnlyKey[] =
116 "widget.content-security-policy-report-only.#text";
117 const char kTizenSettingKey[] = "widget.setting";
118 const char kTizenBackgroundSupportKey[] = "widget.setting.@background-support";
119 const char kTizenContextMenuKey[] = "widget.setting.@context-menu";
120 const char kTizenHardwareKey[] = "widget.setting.@hwkey-event";
121 const char kTizenEncryptionKey[] = "widget.setting.@encryption";
122 const char kTizenMetaDataKey[] = "widget.metadata";
123 // Child keys inside 'kTizenMetaDataKey'
124 const char kTizenMetaDataNameKey[] = "@key";
125 const char kTizenMetaDataValueKey[] = "@value";
126 const char kTizenSplashScreenKey[] = "widget.splash-screen";
127 const char kTizenSplashScreenSrcKey[] = "@src";
128 const char kContentNamespace[] = "widget.content.@namespace";
129 const char kTizenScreenOrientationKey[] = "widget.setting.@screen-orientation";
130 const char kTizenAppWidgetFullKey[] = "widget.app-widget";
131 const char kTizenAppWidgetKey[] = "app-widget";
132 const char kTizenAppWidgetIdKey[] = "@id";
133 const char kTizenAppWidgetPrimaryKey[] = "@primary";
134 const char kTizenAppWidgetUpdatePeriodKey[] = "@update-period";
135 const char kTizenAppWidgetAutoLaunchKey[] = "@auto-launch";
136 const char kTizenAppWidgetBoxLabelKey[] = "box-label";
137 const char kTizenAppWidgetBoxLabelLangKey[] = "@lang";
138 const char kTizenAppWidgetBoxLabelTextKey[] = "#text";
139 const char kTizenAppWidgetBoxIconKey[] = "box-icon";
140 const char kTizenAppWidgetBoxIconSrcKey[] = "@src";
141 const char kTizenAppWidgetBoxContentKey[] = "box-content";
142 const char kTizenAppWidgetBoxContentSrcKey[] = "@src";
143 const char kTizenAppWidgetBoxContentMouseEventKey[] = "@mouse-event";
144 const char kTizenAppWidgetBoxContentTouchEffectKey[] = "@touch-effect";
145 const char kTizenAppWidgetBoxContentSizeKey[] = "box-size";
146 const char kTizenAppWidgetBoxContentSizeTextKey[] = "#text";
147 const char kTizenAppWidgetBoxContentSizePreviewKey[] = "@preview";
148 const char kTizenAppWidgetBoxContentSizeUseDecorationKey[] = "@use-decoration";
149 const char kTizenAppWidgetBoxContentDropViewKey[] = "pd";
150 const char kTizenAppWidgetBoxContentDropViewSrcKey[] = "@src";
151 const char kTizenAppWidgetBoxContentDropViewWidthKey[] = "@width";
152 const char kTizenAppWidgetBoxContentDropViewHeightKey[] = "@height";
154 const char kTizenApplicationAppControlsKey[] = "widget.app-control";
155 const char kTizenApplicationAppControlSrcKey[] = "src";
156 const char kTizenApplicationAppControlOperationKey[] = "operation";
157 const char kTizenApplicationAppControlUriKey[] = "uri";
158 const char kTizenApplicationAppControlMimeKey[] = "mime";
159 const char kTizenApplicationAppControlChildNameAttrKey[] = "@name";
162 } // namespace application_widget_keys
164 const char kW3CNamespacePrefix[] = "http://www.w3.org/ns/widgets";
165 #if defined(OS_TIZEN)
166 const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
169 namespace application_manifest_errors {
170 const char kInvalidDescription[] =
171 "Invalid value for 'description'.";
172 const char kInvalidKey[] =
173 "Value 'key' is missing or invalid.";
174 const char kInvalidName[] =
175 "Required value 'name' is missing or invalid.";
176 const char kInvalidVersion[] =
177 "Required value 'version' is missing or invalid. It must be between 1-4 "
178 "dot-separated integers each between 0 and 65536.";
179 const char kManifestParseError[] =
180 "Manifest is not valid JSON.";
181 const char kManifestUnreadable[] =
182 "Manifest file is missing or unreadable.";
183 } // namespace application_manifest_errors
185 namespace application {
187 const char* GetNameKey(Manifest::Type manifest_type) {
188 if (manifest_type == Manifest::TYPE_WIDGET)
189 return application_widget_keys::kNameKey;
191 return application_manifest_keys::kNameKey;
194 const char* GetVersionKey(Manifest::Type manifest_type) {
195 if (manifest_type == Manifest::TYPE_WIDGET)
196 return application_widget_keys::kVersionKey;
198 return application_manifest_keys::kXWalkVersionKey;
201 const char* GetCSPKey(Manifest::Type manifest_type) {
202 if (manifest_type == Manifest::TYPE_WIDGET)
203 return application_widget_keys::kCSPKey;
205 return application_manifest_keys::kCSPKey;
208 #if defined(OS_TIZEN)
209 const char* GetTizenAppIdKey(Manifest::Type manifest_type) {
210 if (manifest_type == Manifest::TYPE_WIDGET)
211 return application_widget_keys::kTizenAppIdKey;
213 return application_manifest_keys::kTizenAppIdKey;
216 const char* GetIcon128Key(Manifest::Type manifest_type) {
217 if (manifest_type == Manifest::TYPE_WIDGET)
218 return application_widget_keys::kIcon128Key;
220 return application_manifest_keys::kIcon128Key;
223 } // namespace application