Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: content/public/common/manifest.h

Issue 2425833002: Parse "purpose" member from Web Manifest (Closed)
Patch Set: Addressing comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/manifest/manifest_parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_COMMON_MANIFEST_H_ 5 #ifndef CONTENT_PUBLIC_COMMON_MANIFEST_H_
6 #define CONTENT_PUBLIC_COMMON_MANIFEST_H_ 6 #define CONTENT_PUBLIC_COMMON_MANIFEST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/strings/nullable_string16.h" 13 #include "base/strings/nullable_string16.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "third_party/WebKit/public/platform/WebDisplayMode.h" 16 #include "third_party/WebKit/public/platform/WebDisplayMode.h"
17 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h" 17 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h"
18 #include "ui/gfx/geometry/size.h" 18 #include "ui/gfx/geometry/size.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 namespace content { 21 namespace content {
22 22
23 // The Manifest structure is an internal representation of the Manifest file 23 // The Manifest structure is an internal representation of the Manifest file
24 // described in the "Manifest for Web Application" document: 24 // described in the "Manifest for Web Application" document:
25 // http://w3c.github.io/manifest/ 25 // http://w3c.github.io/manifest/
26 struct CONTENT_EXPORT Manifest { 26 struct CONTENT_EXPORT Manifest {
27 // Structure representing an icon as per the Manifest specification, see: 27 // Structure representing an icon as per the Manifest specification, see:
28 // http://w3c.github.io/manifest/#dfn-icon-object 28 // http://w3c.github.io/manifest/#dfn-icon-object
29 struct CONTENT_EXPORT Icon { 29 struct CONTENT_EXPORT Icon {
30 enum IconPurpose {
31 ANY = 0,
32 BADGE,
33 };
34
30 Icon(); 35 Icon();
31 Icon(const Icon& other); 36 Icon(const Icon& other);
32 ~Icon(); 37 ~Icon();
33 38
34 bool operator==(const Icon& other) const; 39 bool operator==(const Icon& other) const;
35 40
36 // MUST be a valid url. If an icon doesn't have a valid URL, it will not be 41 // 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. 42 // successfully parsed, thus will not be represented in the Manifest.
38 GURL src; 43 GURL src;
39 44
40 // Empty if the parsing failed or the field was not present. The type can be 45 // Empty 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. 46 // 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 47 // It is up to the consumer of the object to check if the type matches a
43 // supported type. 48 // supported type.
44 base::string16 type; 49 base::string16 type;
45 50
46 // Empty if the parsing failed, the field was not present or empty. 51 // Empty if the parsing failed, the field was not present or empty.
47 // The special value "any" is represented by gfx::Size(0, 0). 52 // The special value "any" is represented by gfx::Size(0, 0).
48 std::vector<gfx::Size> sizes; 53 std::vector<gfx::Size> sizes;
54
55 // Empty if the field was not present or not of type "string". Defaults to
56 // {IconPurpose::ANY} for all other parsing exceptions.
pkotwicz 2016/10/18 17:16:12 The curly braces around {IconPurpose::ANY} are new
F 2016/10/18 19:29:55 Fixed. Sorry I meant a vector with IconPurpose::AN
57 std::vector<IconPurpose> purpose;
49 }; 58 };
50 59
51 // Structure representing a related application. 60 // Structure representing a related application.
52 struct CONTENT_EXPORT RelatedApplication { 61 struct CONTENT_EXPORT RelatedApplication {
53 RelatedApplication(); 62 RelatedApplication();
54 ~RelatedApplication(); 63 ~RelatedApplication();
55 64
56 // The platform on which the application can be found. This can be any 65 // The platform on which the application can be found. This can be any
57 // string, and is interpreted by the consumer of the object. Empty if the 66 // string, and is interpreted by the consumer of the object. Empty if the
58 // parsing failed. 67 // parsing failed.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 static const size_t kMaxIPCStringLength; 144 static const size_t kMaxIPCStringLength;
136 145
137 // Constant representing an invalid color. Set to a value outside the 146 // Constant representing an invalid color. Set to a value outside the
138 // range of a 32-bit integer. 147 // range of a 32-bit integer.
139 static const int64_t kInvalidOrMissingColor; 148 static const int64_t kInvalidOrMissingColor;
140 }; 149 };
141 150
142 } // namespace content 151 } // namespace content
143 152
144 #endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_ 153 #endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/manifest/manifest_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698