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

Unified Diff: components/gcm_driver/gcm_driver.cc

Issue 914693002: Push API: Fix unsubscribing from GCM on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment nits I missed earlier Created 5 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
Index: components/gcm_driver/gcm_driver.cc
diff --git a/components/gcm_driver/gcm_driver.cc b/components/gcm_driver/gcm_driver.cc
index a82e7b1bcff9e284809f57530eef878fea907d35..f9187b54027e1a6adb93f587d751d49869a4833a 100644
--- a/components/gcm_driver/gcm_driver.cc
+++ b/components/gcm_driver/gcm_driver.cc
@@ -69,8 +69,12 @@ void GCMDriver::Register(const std::string& app_id,
}
void GCMDriver::Unregister(const std::string& app_id,
+ const std::vector<std::string>& sender_ids,
const UnregisterCallback& callback) {
DCHECK(!app_id.empty());
+#if defined(OS_ANDROID)
+ DCHECK(!sender_ids.empty());
+#endif
DCHECK(!callback.is_null());
GCMClient::Result result = EnsureStarted(GCMClient::IMMEDIATE_START);
@@ -86,9 +90,13 @@ void GCMDriver::Unregister(const std::string& app_id,
return;
}
+ // Normalize the sender IDs by making them sorted.
+ std::vector<std::string> normalized_sender_ids = sender_ids;
+ std::sort(normalized_sender_ids.begin(), normalized_sender_ids.end());
+
unregister_callbacks_[app_id] = callback;
- UnregisterImpl(app_id);
+ UnregisterImpl(app_id, normalized_sender_ids);
}
void GCMDriver::Send(const std::string& app_id,

Powered by Google App Engine
This is Rietveld 408576698