Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / public / common / manifest.h
blobc1eba7c2111d532035be0e2c4c4521029123aee3
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_
8 #include <vector>
10 #include "base/strings/nullable_string16.h"
11 #include "content/common/content_export.h"
12 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationLockType.h"
13 #include "ui/gfx/geometry/size.h"
14 #include "url/gurl.h"
16 namespace content {
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 {
22 enum DisplayMode {
23 DISPLAY_MODE_UNSPECIFIED,
24 DISPLAY_MODE_FULLSCREEN,
25 DISPLAY_MODE_STANDALONE,
26 DISPLAY_MODE_MINIMAL_UI,
27 DISPLAY_MODE_BROWSER
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 {
33 Icon();
34 ~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.
38 GURL src;
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
43 // supported type.
44 base::NullableString16 type;
46 // Default value is 1.0 if the value is missing or invalid.
47 double density;
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 {
59 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
64 // parsing failed.
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.
69 GURL url;
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
73 // was not present.
74 base::NullableString16 id;
77 Manifest();
78 ~Manifest();
80 // Returns whether this Manifest had no attribute set. A newly created
81 // Manifest is always empty.
82 bool IsEmpty() const;
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.
91 GURL start_url;
93 // Set to DISPLAY_MODE_UNSPECIFIED if the parsing failed or the field was not
94 // present.
95 DisplayMode display;
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 64 bit integer because we need to represent an error state. The
116 // color itself should only be 32 bits long if the value is not
117 // kInvalidOrMissingThemeColor and can be safely cast to SkColor if is valid.
118 // Set to kInvalidOrMissingThemeColor if parsing failed or field is not
119 // present.
120 int64_t theme_color;
122 // This is a proprietary extension of the web Manifest, double-check that it
123 // is okay to use this entry.
124 // Null if parsing failed or the field was not present.
125 base::NullableString16 gcm_sender_id;
127 // Maximum length for all the strings inside the Manifest when it is sent over
128 // IPC. The renderer process should truncate the strings before sending the
129 // Manifest and the browser process must do the same when receiving it.
130 static const size_t kMaxIPCStringLength;
132 // Constant representing an invalid theme color. Set to -1.
133 static const int64_t kInvalidOrMissingThemeColor;
136 } // namespace content
138 #endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_