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

Side by Side Diff: content/renderer/manifest/manifest_parser.h

Issue 919293002: Add related_applications field to manifest parser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update for additions to spec Created 5 years, 8 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_RENDERER_MANIFEST_MANIFEST_PARSER_H_ 5 #ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_
6 #define CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ 6 #define CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_
7 7
8 #include "base/strings/nullable_string16.h" 8 #include "base/strings/nullable_string16.h"
9 #include "base/strings/string_piece.h" 9 #include "base/strings/string_piece.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // by gfx::Size(0, 0). 117 // by gfx::Size(0, 0).
118 std::vector<gfx::Size> ParseIconSizes(const base::DictionaryValue& icon); 118 std::vector<gfx::Size> ParseIconSizes(const base::DictionaryValue& icon);
119 119
120 // Parses the 'icons' field of a Manifest, as defined in: 120 // Parses the 'icons' field of a Manifest, as defined in:
121 // http://w3c.github.io/manifest/#dfn-steps-for-processing-the-icons-member 121 // http://w3c.github.io/manifest/#dfn-steps-for-processing-the-icons-member
122 // Returns a vector of Manifest::Icon with the successfully parsed icons, if 122 // Returns a vector of Manifest::Icon with the successfully parsed icons, if
123 // any. An empty vector if the field was not present or empty. 123 // any. An empty vector if the field was not present or empty.
124 std::vector<Manifest::Icon> ParseIcons( 124 std::vector<Manifest::Icon> ParseIcons(
125 const base::DictionaryValue& dictionary); 125 const base::DictionaryValue& dictionary);
126 126
127 // Parses the 'platform' field of a related application, as defined in:
128 // https://w3c.github.io/manifest/#dfn-steps-for-processing-the-platform-membe r-of-an-application
129 // Returns RELATED_APPLICATION_PLATFORM_UNSPECIFIED if the parsing
130 // failed.
131 Manifest::RelatedApplicationPlatform ParseRelatedApplicationPlatform(
132 const base::DictionaryValue& application);
mlamouri (slow - plz ping) 2015/04/10 09:49:45 The spec say it should return a string.
benwells 2015/04/15 06:45:22 Done.
133
134 // Parses the 'url' field of a related application, as defined in:
135 // https://w3c.github.io/manifest/#dfn-steps-for-processing-the-url-member-of- an-application
136 // Returns the paresed GURL if any, an empty GURL if the parsing failed.
137 GURL ParseRelatedApplicationURL(const base::DictionaryValue& application);
138
139 // Parses the 'id' field of a related application, as defined in:
140 // https://w3c.github.io/manifest/#dfn-steps-for-processing-the-id-member-of-a n-application
141 // Returns the parsed string if any, a null string if the parsing failed.
142 base::NullableString16 ParseRelatedApplicationId(
143 const base::DictionaryValue& application);
144
145 // Parses the 'related_applications' field of the manifest, as defined in:
146 // https://w3c.github.io/manifest/#dfn-steps-for-processing-the-related_applic ations-member
147 // Returns a vector of Manifest::RelatedApplication with the successfully
148 // parsed applications, if any. An empty vector if the field was not present
149 // or empty.
150 std::vector<Manifest::RelatedApplication> ParseRelatedApplications(
151 const base::DictionaryValue& dictionary);
152
153 // Parses the 'prefer_related_applications' field on the manifest, as defined
154 // in:
155 // https://w3c.github.io/manifest/#dfn-steps-for-processing-the-prefer_related _applications-member
156 // returns true iff the field could be parsed as the boolean true.
157 bool ParsePreferRelatedApplications(const base::DictionaryValue& dictionary);
158
127 // Parses the 'gcm_sender_id' field of the manifest. 159 // Parses the 'gcm_sender_id' field of the manifest.
128 // This is a proprietary extension of the Web Manifest specification. 160 // This is a proprietary extension of the Web Manifest specification.
129 // Returns the parsed string if any, a null string if the parsing failed. 161 // Returns the parsed string if any, a null string if the parsing failed.
130 base::NullableString16 ParseGCMSenderID( 162 base::NullableString16 ParseGCMSenderID(
131 const base::DictionaryValue& dictionary); 163 const base::DictionaryValue& dictionary);
132 164
133 // Parses the 'gcm_user_visible_only' field of the manifest. 165 // Parses the 'gcm_user_visible_only' field of the manifest.
134 // This is a proprietary extension of the Web Manifest specification. 166 // This is a proprietary extension of the Web Manifest specification.
135 // Returns true iff the string could be parsed as the boolean true. 167 // Returns true iff the string could be parsed as the boolean true.
136 bool ParseGCMUserVisibleOnly(const base::DictionaryValue& dictionary); 168 bool ParseGCMUserVisibleOnly(const base::DictionaryValue& dictionary);
137 169
138 const base::StringPiece& data_; 170 const base::StringPiece& data_;
139 GURL manifest_url_; 171 GURL manifest_url_;
140 GURL document_url_; 172 GURL document_url_;
141 173
142 bool failed_; 174 bool failed_;
143 Manifest manifest_; 175 Manifest manifest_;
144 std::vector<std::string> errors_; 176 std::vector<std::string> errors_;
145 177
146 DISALLOW_COPY_AND_ASSIGN(ManifestParser); 178 DISALLOW_COPY_AND_ASSIGN(ManifestParser);
147 }; 179 };
148 180
149 } // namespace content 181 } // namespace content
150 182
151 #endif // CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ 183 #endif // CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698