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