Upstream version 6.35.121.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 const char kTizenSettingKey[] = "widget.setting";
77 const char kTizenHardwareKey[] = "widget.setting.@hwkey";
78 #endif
79 }  // namespace application_widget_keys
80
81 #if defined(OS_TIZEN)
82 const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
83 #endif
84
85 namespace application_manifest_errors {
86 const char kInvalidDescription[] =
87     "Invalid value for 'description'.";
88 const char kInvalidKey[] =
89     "Value 'key' is missing or invalid.";
90 const char kInvalidManifestVersion[] =
91     "Invalid value for 'manifest_version'. Must be an integer greater than "
92     "zero.";
93 const char kInvalidName[] =
94     "Required value 'name' is missing or invalid.";
95 const char kInvalidVersion[] =
96     "Required value 'version' is missing or invalid. It must be between 1-4 "
97     "dot-separated integers each between 0 and 65536.";
98 const char kManifestParseError[] =
99     "Manifest is not valid JSON.";
100 const char kManifestUnreadable[] =
101     "Manifest file is missing or unreadable.";
102 const char kPlatformAppNeedsManifestVersion2[] =
103     "Packaged apps need manifest_version set to >= 2";
104 }  // namespace application_manifest_errors
105
106 namespace application {
107
108 const char* GetNameKey(Manifest::PackageType package_type) {
109   if (package_type == Manifest::TYPE_WGT)
110     return application_widget_keys::kNameKey;
111
112   return application_manifest_keys::kNameKey;
113 }
114
115 const char* GetVersionKey(Manifest::PackageType package_type) {
116   if (package_type == Manifest::TYPE_WGT)
117     return application_widget_keys::kVersionKey;
118
119   return application_manifest_keys::kVersionKey;
120 }
121
122 const char* GetWebURLsKey(Manifest::PackageType package_type) {
123   if (package_type == Manifest::TYPE_WGT)
124     return application_widget_keys::kWebURLsKey;
125
126   return application_manifest_keys::kWebURLsKey;
127 }
128
129 const char* GetLaunchLocalPathKey(Manifest::PackageType package_type) {
130   if (package_type == Manifest::TYPE_WGT)
131     return application_widget_keys::kLaunchLocalPathKey;
132
133   return application_manifest_keys::kLaunchLocalPathKey;
134 }
135
136 const char* GetCSPKey(Manifest::PackageType package_type) {
137   if (package_type == Manifest::TYPE_WGT)
138     return application_widget_keys::kCSPKey;
139
140   return application_manifest_keys::kCSPKey;
141 }
142
143 #if defined(OS_TIZEN)
144 const char* GetTizenAppIdKey(Manifest::PackageType package_type) {
145   if (package_type == Manifest::TYPE_WGT)
146     return application_widget_keys::kTizenAppIdKey;
147
148   return application_manifest_keys::kTizenAppIdKey;
149 }
150
151 const char* GetIcon128Key(Manifest::PackageType package_type) {
152   if (package_type == Manifest::TYPE_WGT)
153     return application_widget_keys::kIcon128Key;
154
155   return application_manifest_keys::kIcon128Key;
156 }
157 #endif
158 }  // namespace application
159 }  // namespace xwalk