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

Unified Diff: chrome/browser/extensions/api/gcm/gcm_api.cc

Issue 141433030: [GCM] Updating the list of restricted keys for GCM API messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/api/gcm.json » ('j') | chrome/common/extensions/api/gcm.json » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/gcm/gcm_api.cc
diff --git a/chrome/browser/extensions/api/gcm/gcm_api.cc b/chrome/browser/extensions/api/gcm/gcm_api.cc
index d4f1b78b48137fc69daa7db2bff82cf3ed5d4b3d..e2bbfbd2d3577cdd7cff551c51dee161a36f15a5 100644
--- a/chrome/browser/extensions/api/gcm/gcm_api.cc
+++ b/chrome/browser/extensions/api/gcm/gcm_api.cc
@@ -22,6 +22,8 @@
namespace {
const size_t kMaximumMessageSize = 4096; // in bytes.
+const char kCollapseKey[] = "collapse_key";
+const size_t kCollapseKeyLength = arraysize(kCollapseKey) - 1;
not at google - send to devlin 2014/02/12 01:42:23 I don't really understand why you can't inline the
fgorski 2014/02/12 21:52:22 Done.
const char kGoogDotRestrictedPrefix[] = "goog.";
const size_t kGoogDotPrefixLength = arraysize(kGoogDotRestrictedPrefix) - 1;
const char kGoogleRestrictedPrefix[] = "google";
@@ -71,9 +73,12 @@ const char* GcmResultToError(gcm::GCMClient::Result result) {
}
bool IsMessageKeyValid(const std::string& key) {
+ std::string lower;
+ std::transform(key.begin(), key.end(), lower.begin(), ::tolower);
jianli 2014/02/12 01:30:32 nit: use base::StringToLowerASCII. Or even better,
fgorski 2014/02/12 21:52:22 Done.
return !key.empty() &&
- key.compare(0, kGooglePrefixLength, kGoogleRestrictedPrefix) != 0 &&
- key.compare(0, kGoogDotPrefixLength, kGoogDotRestrictedPrefix) != 0;
+ key.compare(0, kCollapseKeyLength, kCollapseKey) != 0 &&
+ lower.compare(0, kGooglePrefixLength, kGoogleRestrictedPrefix) != 0 &&
+ lower.compare(0, kGoogDotPrefixLength, kGoogDotRestrictedPrefix) != 0;
}
} // namespace
« no previous file with comments | « no previous file | chrome/common/extensions/api/gcm.json » ('j') | chrome/common/extensions/api/gcm.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698