22f90e12b27c44172c7f849b5755d0f85f06dec4
[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 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";
26
27 #if defined(OS_TIZEN)
28 const char kTizenAppIdKey[] = "tizen_app_id";
29 const char kIcon128Key[] = "icons.128";
30 #endif
31
32 }  // namespace application_manifest_keys
33
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";
52
53 // Child keys inside 'kPreferencesKey'.
54 const char kPreferencesNameKey[] = "@name";
55 const char kPreferencesValueKey[] = "@value";
56 const char kPreferencesReadonlyKey[] = "@readonly";
57
58 // Child keys inside 'kAccessKey'.
59 const char kAccessOriginKey[] = "@origin";
60 const char kAccessSubdomainsKey[] = "@subdomains";
61
62 #if defined(OS_TIZEN)
63 const char kIcon128Key[] = "widget.icon.@src";
64 const char kTizenAppIdKey[] = "widget.application.@package";
65 #endif
66 }  // namespace application_widget_keys
67
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 "
75     "zero.";
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
88
89 namespace application {
90
91 const char* GetNameKey(Manifest::PackageType package_type) {
92   if (package_type == Manifest::TYPE_WGT)
93     return application_widget_keys::kNameKey;
94
95   return application_manifest_keys::kNameKey;
96 }
97
98 const char* GetVersionKey(Manifest::PackageType package_type) {
99   if (package_type == Manifest::TYPE_WGT)
100     return application_widget_keys::kVersionKey;
101
102   return application_manifest_keys::kVersionKey;
103 }
104
105 const char* GetWebURLsKey(Manifest::PackageType package_type) {
106   if (package_type == Manifest::TYPE_WGT)
107     return application_widget_keys::kWebURLsKey;
108
109   return application_manifest_keys::kWebURLsKey;
110 }
111
112 const char* GetLaunchLocalPathKey(Manifest::PackageType package_type) {
113   if (package_type == Manifest::TYPE_WGT)
114     return application_widget_keys::kLaunchLocalPathKey;
115
116   return application_manifest_keys::kLaunchLocalPathKey;
117 }
118
119 const char* GetCSPKey(Manifest::PackageType package_type) {
120   if (package_type == Manifest::TYPE_WGT)
121     return application_widget_keys::kCSPKey;
122
123   return application_manifest_keys::kCSPKey;
124 }
125
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;
130
131   return application_manifest_keys::kTizenAppIdKey;
132 }
133
134 const char* GetIcon128Key(Manifest::PackageType package_type) {
135   if (package_type == Manifest::TYPE_WGT)
136     return application_widget_keys::kIcon128Key;
137
138   return application_manifest_keys::kIcon128Key;
139 }
140 #endif
141 }  // namespace application
142 }  // namespace xwalk