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