1 // Copyright 2014 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 #ifndef CONTENT_PUBLIC_COMMON_MANIFEST_H_
6 #define CONTENT_PUBLIC_COMMON_MANIFEST_H_
10 #include "base/strings/nullable_string16.h"
11 #include "content/common/content_export.h"
12 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
13 #include "ui/gfx/geometry/size.h"
18 // The Manifest structure is an internal representation of the Manifest file
19 // described in the "Manifest for Web Application" document:
20 // http://w3c.github.io/manifest/
21 struct CONTENT_EXPORT Manifest
{
23 DISPLAY_MODE_UNSPECIFIED
,
24 DISPLAY_MODE_FULLSCREEN
,
25 DISPLAY_MODE_STANDALONE
,
26 DISPLAY_MODE_MINIMAL_UI
,
30 // Structure representing an icon as per the Manifest specification, see:
31 // http://w3c.github.io/manifest/#dfn-icon-object
32 struct CONTENT_EXPORT Icon
{
36 // MUST be a valid url. If an icon doesn't have a valid URL, it will not be
37 // successfully parsed, thus will not be represented in the Manifest.
40 // Null if the parsing failed or the field was not present. The type can be
41 // any string and doesn't have to be a valid image MIME type at this point.
42 // It is up to the consumer of the object to check if the type matches a
44 base::NullableString16 type
;
46 // Default value is 1.0 if the value is missing or invalid.
49 // Empty if the parsing failed, the field was not present or empty.
50 // The special value "any" is represented by gfx::Size(0, 0).
51 std::vector
<gfx::Size
> sizes
;
53 // Default density. Set to 1.0.
54 static const double kDefaultDensity
;
57 // Structure representing a related application.
58 struct CONTENT_EXPORT RelatedApplication
{
60 ~RelatedApplication();
62 // The platform on which the application can be found. This can be any
63 // string, and is interpreted by the consumer of the object. Empty if the
65 base::NullableString16 platform
;
67 // URL at which the application can be found. One of |url| and |id| must be
68 // present. Empty if the parsing failed or the field was not present.
71 // An id which is used to represent the application on the platform. One of
72 // |url| and |id| must be present. Empty if the parsing failed or the field
74 base::NullableString16 id
;
80 // Returns whether this Manifest had no attribute set. A newly created
81 // Manifest is always empty.
84 // Null if the parsing failed or the field was not present.
85 base::NullableString16 name
;
87 // Null if the parsing failed or the field was not present.
88 base::NullableString16 short_name
;
90 // Empty if the parsing failed or the field was not present.
93 // Set to DISPLAY_MODE_UNSPECIFIED if the parsing failed or the field was not
97 // Set to blink::WebScreenOrientationLockDefault if the parsing failed or the
98 // field was not present.
99 blink::WebScreenOrientationLockType orientation
;
101 // Empty if the parsing failed, the field was not present, empty or all the
102 // icons inside the JSON array were invalid.
103 std::vector
<Icon
> icons
;
105 // Empty if the parsing failed, the field was not present, empty or all the
106 // applications inside the array were invalid. The order of the array
107 // indicates the priority of the application to use.
108 std::vector
<RelatedApplication
> related_applications
;
110 // A boolean that is used as a hint for the user agent to say that related
111 // applications should be preferred over the web application. False if missing
112 // or there is a parsing failure.
113 bool prefer_related_applications
;
115 // This is a proprietary extension of the web Manifest, double-check that it
116 // is okay to use this entry.
117 // Null if parsing failed or the field was not present.
118 base::NullableString16 gcm_sender_id
;
120 // This is a proprietary extension of the web Manifest, double-check that it
121 // is okay to use this entry.
122 // False if parsing failed or the field was not present.
123 bool gcm_user_visible_only
;
125 // Maximum length for all the strings inside the Manifest when it is sent over
126 // IPC. The renderer process should truncate the strings before sending the
127 // Manifest and the browser process must do the same when receiving it.
128 static const size_t kMaxIPCStringLength
;
131 } // namespace content
133 #endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_