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

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: Tweak comment per jianli 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
« no previous file with comments | « components/gcm_driver/gcm_driver.h ('k') | components/gcm_driver/gcm_driver_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..080ba526bdfb9efbd6668795368fb9ef3f1575e7 100644
--- a/components/gcm_driver/gcm_driver.cc
+++ b/components/gcm_driver/gcm_driver.cc
@@ -70,6 +70,20 @@ void GCMDriver::Register(const std::string& app_id,
void GCMDriver::Unregister(const std::string& app_id,
const UnregisterCallback& callback) {
+ UnregisterInternal(app_id, nullptr /* sender_id */, callback);
+}
+
+void GCMDriver::UnregisterWithSenderId(
+ const std::string& app_id,
+ const std::string& sender_id,
+ const UnregisterCallback& callback) {
+ DCHECK(!sender_id.empty());
+ UnregisterInternal(app_id, &sender_id, callback);
+}
+
+void GCMDriver::UnregisterInternal(const std::string& app_id,
+ const std::string* sender_id,
fgorski 2015/02/17 23:31:58 nit: was passing an empty string from the version
johnme 2015/02/17 23:38:20 That would be ambiguous though - for example on An
+ const UnregisterCallback& callback) {
DCHECK(!app_id.empty());
DCHECK(!callback.is_null());
@@ -88,7 +102,10 @@ void GCMDriver::Unregister(const std::string& app_id,
unregister_callbacks_[app_id] = callback;
- UnregisterImpl(app_id);
+ if (sender_id)
+ UnregisterWithSenderIdImpl(app_id, *sender_id);
+ else
+ UnregisterImpl(app_id);
}
void GCMDriver::Send(const std::string& app_id,
@@ -117,6 +134,11 @@ void GCMDriver::Send(const std::string& app_id,
SendImpl(app_id, receiver_id, message);
}
+void GCMDriver::UnregisterWithSenderIdImpl(const std::string& app_id,
+ const std::string& sender_id) {
+ NOTREACHED();
+}
+
void GCMDriver::RegisterFinished(const std::string& app_id,
const std::string& registration_id,
GCMClient::Result result) {
« no previous file with comments | « components/gcm_driver/gcm_driver.h ('k') | components/gcm_driver/gcm_driver_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698