40dc2764f24b060df4bcf25f6739a52e0d2892c6
[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 const char kAppKey[] = "app";
11 const char kAppMainKey[] = "app.main";
12 const char kAppMainScriptsKey[] = "app.main.scripts";
13 const char kAppMainSourceKey[] = "app.main.source";
14 const char kCSPKey[] = "content_security_policy";
15 const char kDescriptionKey[] = "description";
16 const char kDisplay[] = "display";
17 const char kLaunchLocalPathKey[] = "app.launch.local_path";
18 const char kLaunchScreen[] = "launch_screen";
19 const char kLaunchScreenDefault[] = "launch_screen.default";
20 const char kLaunchScreenImageBorderDefault[] =
21     "launch_screen.default.image_border";
22 const char kLaunchScreenImageBorderLandscape[] =
23     "launch_screen.landscape.image_border";
24 const char kLaunchScreenImageBorderPortrait[] =
25     "launch_screen.portrait.image_border";
26 const char kLaunchScreenLandscape[] = "launch_screen.landscape";
27 const char kLaunchScreenPortrait[] = "launch_screen.portrait";
28 const char kLaunchScreenReadyWhen[] = "launch_screen.ready_when";
29 const char kLaunchWebURLKey[] = "app.launch.web_url";
30 const char kManifestVersionKey[] = "manifest_version";
31 const char kNameKey[] = "name";
32 const char kPermissionsKey[] = "permissions";
33 const char kURLKey[] = "url";
34 const char kVersionKey[] = "version";
35 const char kWebURLsKey[] = "app.urls";
36 const char kXWalkHostsKey[] = "xwalk_hosts";
37
38 #if defined(OS_TIZEN)
39 const char kTizenAppIdKey[] = "tizen_app_id";
40 const char kIcon128Key[] = "icons.128";
41 #endif
42
43 }  // namespace application_manifest_keys
44
45 // manifest keys for widget applications.
46 namespace application_widget_keys {
47 const char kNamespaceKey[] = "@namespace";
48 const char kXmlLangKey[] = "@lang";
49 const char kDefaultLocaleKey[] = "widget.@defaultlocale";
50 const char kNameKey[] = "widget.name.#text";
51 const char kVersionKey[] = "widget.@version";
52 const char kWidgetKey[] = "widget";
53 const char kLaunchLocalPathKey[] = "widget.content.@src";
54 const char kWebURLsKey[] = "widget.@id";
55 const char kAuthorKey[] = "widget.author.#text";
56 const char kDescriptionKey[] = "widget.description.#text";
57 const char kShortNameKey[] = "widget.name.@short";
58 const char kIDKey[] = "widget.@id";
59 const char kAuthorEmailKey[] = "widget.author.@email";
60 const char kAuthorHrefKey[] = "widget.author.@href";
61 const char kHeightKey[] = "widget.@height";
62 const char kWidthKey[] = "widget.@width";
63 const char kPreferencesKey[] = "widget.preference";
64 const char kCSPKey[] = "widget.content-security-policy.#text";
65 const char kAccessKey[] = "widget.access";
66
67 // Child keys inside 'kPreferencesKey'.
68 const char kPreferencesNameKey[] = "@name";
69 const char kPreferencesValueKey[] = "@value";
70 const char kPreferencesReadonlyKey[] = "@readonly";
71
72 // Child keys inside 'kAccessKey'.
73 const char kAccessOriginKey[] = "@origin";
74 const char kAccessSubdomainsKey[] = "@subdomains";
75
76 #if defined(OS_TIZEN)
77 const char kIcon128Key[] = "widget.icon.@src";
78 const char kTizenApplicationKey[] = "widget.application";
79 // Child keys inside 'kTizenApplicationKey'
80 const char kTizenApplicationIdKey[] = "@id";
81 const char kTizenApplicationPackageKey[] = "@package";
82 const char kTizenApplicationRequiredVersionKey[] = "@required_version";
83
84 const char kTizenAppIdKey[] = "widget.application.@package";
85 const char kAllowNavigationKey[] = "widget.allow-navigation.#text";
86 const char kCSPReportOnlyKey[] =
87     "widget.content-security-policy-report-only.#text";
88 const char kTizenSettingKey[] = "widget.setting";
89 const char kTizenHardwareKey[] = "widget.setting.@hwkey";
90 const char kTizenMetaDataKey[] = "widget.metadata";
91 // Child keys inside 'kTizenMetaDataKey'
92 const char kTizenMetaDataNameKey[] = "@key";
93 const char kTizenMetaDataValueKey[] = "@value";
94 #endif
95 }  // namespace application_widget_keys
96
97 #if defined(OS_TIZEN)
98 const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
99 #endif
100
101 namespace application_manifest_errors {
102 const char kInvalidDescription[] =
103     "Invalid value for 'description'.";
104 const char kInvalidKey[] =
105     "Value 'key' is missing or invalid.";
106 const char kInvalidManifestVersion[] =
107     "Invalid value for 'manifest_version'. Must be an integer greater than "
108     "zero.";
109 const char kInvalidName[] =
110     "Required value 'name' is missing or invalid.";
111 const char kInvalidVersion[] =
112     "Required value 'version' is missing or invalid. It must be between 1-4 "
113     "dot-separated integers each between 0 and 65536.";
114 const char kManifestParseError[] =
115     "Manifest is not valid JSON.";
116 const char kManifestUnreadable[] =
117     "Manifest file is missing or unreadable.";
118 const char kPlatformAppNeedsManifestVersion2[] =
119     "Packaged apps need manifest_version set to >= 2";
120 }  // namespace application_manifest_errors
121
122 namespace application {
123
124 const char* GetNameKey(Manifest::PackageType package_type) {
125   if (package_type == Manifest::TYPE_WGT)
126     return application_widget_keys::kNameKey;
127
128   return application_manifest_keys::kNameKey;
129 }
130
131 const char* GetVersionKey(Manifest::PackageType package_type) {
132   if (package_type == Manifest::TYPE_WGT)
133     return application_widget_keys::kVersionKey;
134
135   return application_manifest_keys::kVersionKey;
136 }
137
138 const char* GetWebURLsKey(Manifest::PackageType package_type) {
139   if (package_type == Manifest::TYPE_WGT)
140     return application_widget_keys::kWebURLsKey;
141
142   return application_manifest_keys::kWebURLsKey;
143 }
144
145 const char* GetLaunchLocalPathKey(Manifest::PackageType package_type) {
146   if (package_type == Manifest::TYPE_WGT)
147     return application_widget_keys::kLaunchLocalPathKey;
148
149   return application_manifest_keys::kLaunchLocalPathKey;
150 }
151
152 const char* GetCSPKey(Manifest::PackageType package_type) {
153   if (package_type == Manifest::TYPE_WGT)
154     return application_widget_keys::kCSPKey;
155
156   return application_manifest_keys::kCSPKey;
157 }
158
159 #if defined(OS_TIZEN)
160 const char* GetTizenAppIdKey(Manifest::PackageType package_type) {
161   if (package_type == Manifest::TYPE_WGT)
162     return application_widget_keys::kTizenAppIdKey;
163
164   return application_manifest_keys::kTizenAppIdKey;
165 }
166
167 const char* GetIcon128Key(Manifest::PackageType package_type) {
168   if (package_type == Manifest::TYPE_WGT)
169     return application_widget_keys::kIcon128Key;
170
171   return application_manifest_keys::kIcon128Key;
172 }
173 #endif
174 }  // namespace application
175 }  // namespace xwalk