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

Unified Diff: content/renderer/manifest/manifest_parser.cc

Issue 580513002: Add support for gcm_sender_id in Manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@manifest_start_url
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/manifest/manifest_parser.cc
diff --git a/content/renderer/manifest/manifest_parser.cc b/content/renderer/manifest/manifest_parser.cc
index dc1624a2ba7660ecadbe0b66b1d05d3428214740..a68ca2ae72e3fb14b86582ebae006612bfd7d201 100644
--- a/content/renderer/manifest/manifest_parser.cc
+++ b/content/renderer/manifest/manifest_parser.cc
@@ -94,7 +94,6 @@ GURL ParseStartURL(const base::DictionaryValue& dictionary,
// parsing failed.
Manifest::DisplayMode ParseDisplay(const base::DictionaryValue& dictionary) {
base::NullableString16 display = ParseString(dictionary, "display", Trim);
-
if (display.is_null())
return Manifest::DISPLAY_MODE_UNSPECIFIED;
@@ -275,6 +274,14 @@ std::vector<Manifest::Icon> ParseIcons(const base::DictionaryValue& dictionary,
return icons;
}
+// Parses the 'gcm_sender_id' field of the manifest.
+// This is a proprietary extension of the Web Manifest specification.
+// Returns the parsed string if any, a null string if the parsing failed.
+base::NullableString16 ParseGCMSenderID(
+ const base::DictionaryValue& dictionary) {
+ return ParseString(dictionary, "gcm_sender_id", Trim);
+}
+
} // anonymous namespace
Manifest ManifestParser::Parse(const base::StringPiece& json,
@@ -307,6 +314,7 @@ Manifest ManifestParser::Parse(const base::StringPiece& json,
manifest.display = ParseDisplay(*dictionary);
manifest.orientation = ParseOrientation(*dictionary);
manifest.icons = ParseIcons(*dictionary, manifest_url);
+ manifest.gcm_sender_id = ParseGCMSenderID(*dictionary);
return manifest;
}
« no previous file with comments | « content/renderer/manifest/manifest_manager.cc ('k') | content/renderer/manifest/manifest_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698