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

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

Issue 770023002: Push registration should read a "gcm_user_visible_only" key from the Manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « content/renderer/manifest/manifest_parser.h ('k') | content/renderer/manifest/manifest_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9a3e8520932cc7d18b6054066deda1d8f0a65c29 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_);
}
@@ -144,6 +145,22 @@ bool ManifestParser::failed() const {
return failed_;
}
+bool ManifestParser::ParseBoolean(const base::DictionaryValue& dictionary,
+ 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;
+}
+
base::NullableString16 ManifestParser::ParseString(
const base::DictionaryValue& dictionary,
const std::string& key,
@@ -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
« no previous file with comments | « content/renderer/manifest/manifest_parser.h ('k') | content/renderer/manifest/manifest_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698