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

Unified Diff: components/gcm_driver/registration_info.cc

Issue 2111973002: Add support for GCM subtypes to desktop Instance ID implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid9push
Patch Set: Remove channel from product_category_for_subtypes, and address nits Created 4 years, 4 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 | « components/gcm_driver/registration_info.h ('k') | google_apis/gcm/engine/gcm_request_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/registration_info.cc
diff --git a/components/gcm_driver/registration_info.cc b/components/gcm_driver/registration_info.cc
index c91d1ccfabdaa92ea67262b9d78290566cd37b91..84ca33d37c42b9fbb1dba28b2e239b0c5ba543ce 100644
--- a/components/gcm_driver/registration_info.cc
+++ b/components/gcm_driver/registration_info.cc
@@ -12,9 +12,9 @@
namespace gcm {
namespace {
-const char kInsanceIDSerializationPrefix[] = "iid-";
-const int kInsanceIDSerializationPrefixLength =
- sizeof(kInsanceIDSerializationPrefix) / sizeof(char) - 1;
+const char kInstanceIDSerializationPrefix[] = "iid-";
+const int kInstanceIDSerializationPrefixLength =
+ sizeof(kInstanceIDSerializationPrefix) / sizeof(char) - 1;
} // namespace
// static
@@ -24,7 +24,7 @@ std::unique_ptr<RegistrationInfo> RegistrationInfo::BuildFromString(
std::string* registration_id) {
std::unique_ptr<RegistrationInfo> registration;
- if (base::StartsWith(serialized_key, kInsanceIDSerializationPrefix,
+ if (base::StartsWith(serialized_key, kInstanceIDSerializationPrefix,
base::CompareCase::SENSITIVE))
registration.reset(new InstanceIDTokenInfo);
else
@@ -158,14 +158,15 @@ RegistrationInfo::RegistrationType InstanceIDTokenInfo::GetType() const {
}
std::string InstanceIDTokenInfo::GetSerializedKey() const {
- DCHECK(authorized_entity.find(',') == std::string::npos &&
+ DCHECK(app_id.find(',') == std::string::npos &&
+ authorized_entity.find(',') == std::string::npos &&
scope.find(',') == std::string::npos);
// Multiple registrations are supported for Instance ID. So the key is based
// on the combination of (app_id, authorized_entity, scope).
// Adds a prefix to differentiate easily with GCM registration key.
- std::string key(kInsanceIDSerializationPrefix);
+ std::string key(kInstanceIDSerializationPrefix);
key += app_id;
key += ",";
key += authorized_entity;
@@ -186,13 +187,13 @@ bool InstanceIDTokenInfo::Deserialize(
if (serialized_key.empty() || serialized_value.empty())
return false;
- if (!base::StartsWith(serialized_key, kInsanceIDSerializationPrefix,
+ if (!base::StartsWith(serialized_key, kInstanceIDSerializationPrefix,
base::CompareCase::SENSITIVE))
return false;
std::vector<std::string> fields = base::SplitString(
- serialized_key.substr(kInsanceIDSerializationPrefixLength),
- ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+ serialized_key.substr(kInstanceIDSerializationPrefixLength), ",",
+ base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (fields.size() != 3 || fields[0].empty() ||
fields[1].empty() || fields[2].empty()) {
return false;
@@ -214,7 +215,7 @@ bool RegistrationInfoComparer::operator()(
DCHECK(a.get() && b.get());
// For GCMRegistrationInfo, the comparison is based on app_id only.
- // For InstanceIDTokenInfo, the comparison is bsaed on
+ // For InstanceIDTokenInfo, the comparison is based on
// <app_id, authorized_entity, scope>.
if (a->app_id < b->app_id)
return true;
« no previous file with comments | « components/gcm_driver/registration_info.h ('k') | google_apis/gcm/engine/gcm_request_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698