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

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

Issue 919293002: Add related_applications field to manifest parser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do IPC stuff Created 5 years, 10 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
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 <vector> 8 #include <vector>
9 9
10 #include "base/strings/nullable_string16.h" 10 #include "base/strings/nullable_string16.h"
11 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" 12 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
13 #include "ui/gfx/geometry/size.h" 13 #include "ui/gfx/geometry/size.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 // The Manifest structure is an internal representation of the Manifest file 18 // The Manifest structure is an internal representation of the Manifest file
19 // described in the "Manifest for Web Application" document: 19 // described in the "Manifest for Web Application" document:
20 // http://w3c.github.io/manifest/ 20 // http://w3c.github.io/manifest/
21 struct CONTENT_EXPORT Manifest { 21 struct CONTENT_EXPORT Manifest {
22 enum DisplayMode { 22 enum DisplayMode {
23 DISPLAY_MODE_UNSPECIFIED, 23 DISPLAY_MODE_UNSPECIFIED,
24 DISPLAY_MODE_FULLSCREEN, 24 DISPLAY_MODE_FULLSCREEN,
25 DISPLAY_MODE_STANDALONE, 25 DISPLAY_MODE_STANDALONE,
26 DISPLAY_MODE_MINIMAL_UI, 26 DISPLAY_MODE_MINIMAL_UI,
27 DISPLAY_MODE_BROWSER 27 DISPLAY_MODE_BROWSER
28 }; 28 };
29 29
30 enum ChromeRelatedApplicationPlatform {
31 CHROME_RELATED_APPLICATION_PLATFORM_UNSPECIFIED,
32 CHROME_RELATED_APPLICATION_PLATFORM_ANDROID,
33 CHROME_RELATED_APPLICATION_PLATFORM_WEB,
34 };
35
30 // Structure representing an icon as per the Manifest specification, see: 36 // Structure representing an icon as per the Manifest specification, see:
31 // http://w3c.github.io/manifest/#dfn-icon-object 37 // http://w3c.github.io/manifest/#dfn-icon-object
32 struct CONTENT_EXPORT Icon { 38 struct CONTENT_EXPORT Icon {
33 Icon(); 39 Icon();
34 ~Icon(); 40 ~Icon();
35 41
36 // MUST be a valid url. If an icon doesn't have a valid URL, it will not be 42 // 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. 43 // successfully parsed, thus will not be represented in the Manifest.
38 GURL src; 44 GURL src;
39 45
40 // Null if the parsing failed or the field was not present. The type can be 46 // 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. 47 // 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 48 // It is up to the consumer of the object to check if the type matches a
43 // supported type. 49 // supported type.
44 base::NullableString16 type; 50 base::NullableString16 type;
45 51
46 // Default value is 1.0 if the value is missing or invalid. 52 // Default value is 1.0 if the value is missing or invalid.
47 double density; 53 double density;
48 54
49 // Empty if the parsing failed, the field was not present or empty. 55 // Empty if the parsing failed, the field was not present or empty.
50 // The special value "any" is represented by gfx::Size(0, 0). 56 // The special value "any" is represented by gfx::Size(0, 0).
51 std::vector<gfx::Size> sizes; 57 std::vector<gfx::Size> sizes;
52 58
53 // Default density. Set to 1.0. 59 // Default density. Set to 1.0.
54 static const double kDefaultDensity; 60 static const double kDefaultDensity;
55 }; 61 };
56 62
63 // Structure representing a related application.
64 struct CONTENT_EXPORT ChromeRelatedApplication {
65 ChromeRelatedApplication();
66 ~ChromeRelatedApplication();
67
68 // The platform the application runs on.
69 ChromeRelatedApplicationPlatform platform;
70
71 // Platform specific key identifying the application. May not be present
72 // for some platforms (e.g. WEB).
73 base::NullableString16 id;
74 };
75
57 Manifest(); 76 Manifest();
58 ~Manifest(); 77 ~Manifest();
59 78
60 // Returns whether this Manifest had no attribute set. A newly created 79 // Returns whether this Manifest had no attribute set. A newly created
61 // Manifest is always empty. 80 // Manifest is always empty.
62 bool IsEmpty() const; 81 bool IsEmpty() const;
63 82
64 // Null if the parsing failed or the field was not present. 83 // Null if the parsing failed or the field was not present.
65 base::NullableString16 name; 84 base::NullableString16 name;
66 85
(...skipping 18 matching lines...) Expand all
85 // This is a proprietary extension of the web Manifest, double-check that it 104 // This is a proprietary extension of the web Manifest, double-check that it
86 // is okay to use this entry. 105 // is okay to use this entry.
87 // Null if parsing failed or the field was not present. 106 // Null if parsing failed or the field was not present.
88 base::NullableString16 gcm_sender_id; 107 base::NullableString16 gcm_sender_id;
89 108
90 // This is a proprietary extension of the web Manifest, double-check that it 109 // This is a proprietary extension of the web Manifest, double-check that it
91 // is okay to use this entry. 110 // is okay to use this entry.
92 // False if parsing failed or the field was not present. 111 // False if parsing failed or the field was not present.
93 bool gcm_user_visible_only; 112 bool gcm_user_visible_only;
94 113
114 // Empty if the parsing failed, the field was not present, empty or all the
115 // applications inside the array were invalid.
116 std::vector<ChromeRelatedApplication> chrome_related_applications;
117
95 // Maximum length for all the strings inside the Manifest when it is sent over 118 // Maximum length for all the strings inside the Manifest when it is sent over
96 // IPC. The renderer process should truncate the strings before sending the 119 // IPC. The renderer process should truncate the strings before sending the
97 // Manifest and the browser process must do the same when receiving it. 120 // Manifest and the browser process must do the same when receiving it.
98 static const size_t kMaxIPCStringLength; 121 static const size_t kMaxIPCStringLength;
99 }; 122 };
100 123
101 } // namespace content 124 } // namespace content
102 125
103 #endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_ 126 #endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698