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 {
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 kLaunchLocalPathKey[] = "app.launch.local_path";
17 const char kLaunchScreen[] = "launch_screen";
18 const char kLaunchScreenReadyWhen[] = "launch_screen.ready_when";
19 const char kLaunchWebURLKey[] = "app.launch.web_url";
20 const char kManifestVersionKey[] = "manifest_version";
21 const char kNameKey[] = "name";
22 const char kPermissionsKey[] = "permissions";
23 const char kURLKey[] = "url";
24 const char kVersionKey[] = "version";
25 const char kWebURLsKey[] = "app.urls";
28 const char kTizenAppIdKey[] = "tizen_app_id";
29 const char kIcon128Key[] = "icons.128";
32 } // namespace application_manifest_keys
34 // manifest keys for widget applications.
35 namespace application_widget_keys {
36 const char kNameKey[] = "widget.name.#text";
37 const char kVersionKey[] = "widget.@version";
38 const char kWidgetKey[] = "widget";
39 const char kLaunchLocalPathKey[] = "widget.content.@src";
40 const char kWebURLsKey[] = "widget.@id";
41 const char kAuthorKey[] = "widget.author.#text";
42 const char kDescriptionKey[] = "widget.description.#text";
43 const char kShortNameKey[] = "widget.name.@short";
44 const char kIDKey[] = "widget.@id";
45 const char kAuthorEmailKey[] = "widget.author.@email";
46 const char kAuthorHrefKey[] = "widget.author.@href";
47 const char kHeightKey[] = "widget.@height";
48 const char kWidthKey[] = "widget.@width";
49 const char kPreferencesKey[] = "widget.preference";
50 const char kCSPKey[] = "widget.content-security-policy.#text";
51 const char kAccessKey[] = "widget.access";
53 // Child keys inside 'kPreferencesKey'.
54 const char kPreferencesNameKey[] = "@name";
55 const char kPreferencesValueKey[] = "@value";
56 const char kPreferencesReadonlyKey[] = "@readonly";
58 // Child keys inside 'kAccessKey'.
59 const char kAccessOriginKey[] = "@origin";
60 const char kAccessSubdomainsKey[] = "@subdomains";
63 const char kIcon128Key[] = "widget.icon.@src";
64 const char kTizenAppIdKey[] = "widget.application.@package";
66 } // namespace application_widget_keys
68 namespace application_manifest_errors {
69 const char kInvalidDescription[] =
70 "Invalid value for 'description'.";
71 const char kInvalidKey[] =
72 "Value 'key' is missing or invalid.";
73 const char kInvalidManifestVersion[] =
74 "Invalid value for 'manifest_version'. Must be an integer greater than "
76 const char kInvalidName[] =
77 "Required value 'name' is missing or invalid.";
78 const char kInvalidVersion[] =
79 "Required value 'version' is missing or invalid. It must be between 1-4 "
80 "dot-separated integers each between 0 and 65536.";
81 const char kManifestParseError[] =
82 "Manifest is not valid JSON.";
83 const char kManifestUnreadable[] =
84 "Manifest file is missing or unreadable.";
85 const char kPlatformAppNeedsManifestVersion2[] =
86 "Packaged apps need manifest_version set to >= 2";
87 } // namespace application_manifest_errors
89 namespace application {
91 const char* GetNameKey(Manifest::PackageType package_type) {
92 if (package_type == Manifest::TYPE_WGT)
93 return application_widget_keys::kNameKey;
95 return application_manifest_keys::kNameKey;
98 const char* GetVersionKey(Manifest::PackageType package_type) {
99 if (package_type == Manifest::TYPE_WGT)
100 return application_widget_keys::kVersionKey;
102 return application_manifest_keys::kVersionKey;
105 const char* GetWebURLsKey(Manifest::PackageType package_type) {
106 if (package_type == Manifest::TYPE_WGT)
107 return application_widget_keys::kWebURLsKey;
109 return application_manifest_keys::kWebURLsKey;
112 const char* GetLaunchLocalPathKey(Manifest::PackageType package_type) {
113 if (package_type == Manifest::TYPE_WGT)
114 return application_widget_keys::kLaunchLocalPathKey;
116 return application_manifest_keys::kLaunchLocalPathKey;
119 const char* GetCSPKey(Manifest::PackageType package_type) {
120 if (package_type == Manifest::TYPE_WGT)
121 return application_widget_keys::kCSPKey;
123 return application_manifest_keys::kCSPKey;
126 #if defined(OS_TIZEN)
127 const char* GetTizenAppIdKey(Manifest::PackageType package_type) {
128 if (package_type == Manifest::TYPE_WGT)
129 return application_widget_keys::kTizenAppIdKey;
131 return application_manifest_keys::kTizenAppIdKey;
134 const char* GetIcon128Key(Manifest::PackageType package_type) {
135 if (package_type == Manifest::TYPE_WGT)
136 return application_widget_keys::kIcon128Key;
138 return application_manifest_keys::kIcon128Key;
141 } // namespace application