Index: content/renderer/manifest/manifest_parser.cc |
diff --git a/content/renderer/manifest/manifest_parser.cc b/content/renderer/manifest/manifest_parser.cc |
index 961ab3742cd32e27340a779b734701429778156b..981d5f1dfe81dae88300d05937644d83e9581abe 100644 |
--- a/content/renderer/manifest/manifest_parser.cc |
+++ b/content/renderer/manifest/manifest_parser.cc |
@@ -128,6 +128,7 @@ void ManifestParser::Parse() { |
manifest_.orientation = ParseOrientation(*dictionary); |
manifest_.icons = ParseIcons(*dictionary); |
manifest_.gcm_sender_id = ParseGCMSenderID(*dictionary); |
+ manifest_.gcm_user_visible_only = ParseGCMUserVisibleOnly(*dictionary); |
ManifestUmaUtil::ParseSucceeded(manifest_); |
} |
@@ -163,6 +164,22 @@ base::NullableString16 ManifestParser::ParseString( |
return base::NullableString16(value, false); |
} |
+bool ManifestParser::ParseBoolean(const base::DictionaryValue& dictionary, |
mlamouri (slow - plz ping)
2014/12/01 21:05:09
Could you get ::ParseBoolean() on top, around Pars
Peter Beverloo
2014/12/03 15:01:59
Done.
|
+ const std::string& key, |
+ bool default_value) { |
+ if (!dictionary.HasKey(key)) |
+ return default_value; |
+ |
+ bool value; |
+ if (!dictionary.GetBoolean(key, &value)) { |
+ errors_.push_back(GetErrorPrefix() + |
+ "property '" + key + "' ignored, type boolean expected."); |
+ return default_value; |
+ } |
+ |
+ return value; |
+} |
+ |
GURL ManifestParser::ParseURL(const base::DictionaryValue& dictionary, |
const std::string& key, |
const GURL& base_url) { |
@@ -322,4 +339,9 @@ base::NullableString16 ManifestParser::ParseGCMSenderID( |
return ParseString(dictionary, "gcm_sender_id", Trim); |
} |
+bool ManifestParser::ParseGCMUserVisibleOnly( |
+ const base::DictionaryValue& dictionary) { |
+ return ParseBoolean(dictionary, "gcm_user_visible_only", false); |
+} |
+ |
} // namespace content |