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

Unified Diff: components/invalidation/impl/gcm_network_channel.cc

Issue 2473813002: Notify GCMAppHandlers when the store is reset, so they clear cached IDs (Closed)
Patch Set: Update Cryptauth comment Created 4 years, 1 month 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/invalidation/impl/gcm_network_channel.cc
diff --git a/components/invalidation/impl/gcm_network_channel.cc b/components/invalidation/impl/gcm_network_channel.cc
index 6204ecc957e97051e99588e5ad016ed8b843616e..5b2aafeb81a01c78ad6d420f9ff989f56673e8ed 100644
--- a/components/invalidation/impl/gcm_network_channel.cc
+++ b/components/invalidation/impl/gcm_network_channel.cc
@@ -121,8 +121,10 @@ GCMNetworkChannel::GCMNetworkChannel(
diagnostic_info_(this),
weak_factory_(this) {
net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
- delegate_->Initialize(base::Bind(&GCMNetworkChannel::OnConnectionStateChanged,
- weak_factory_.GetWeakPtr()));
+ delegate_->Initialize(
+ base::Bind(&GCMNetworkChannel::OnConnectionStateChanged,
+ weak_factory_.GetWeakPtr()),
+ base::Bind(&GCMNetworkChannel::OnStoreReset, weak_factory_.GetWeakPtr()));
Register();
}
@@ -194,7 +196,7 @@ void GCMNetworkChannel::OnGetTokenComplete(
const GoogleServiceAuthError& error,
const std::string& token) {
DCHECK(CalledOnValidThread());
- if (cached_message_.empty()) {
+ if (cached_message_.empty() || registration_id_.empty()) {
// Nothing to do.
return;
}
@@ -302,6 +304,11 @@ void GCMNetworkChannel::OnConnectionStateChanged(bool online) {
UpdateGcmChannelState(online);
}
+void GCMNetworkChannel::OnStoreReset() {
+ // TODO(crbug.com/661660): Tell server the registration ID is no longer valid.
+ registration_id_.clear();
+}
+
void GCMNetworkChannel::OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType connection_type) {
// Network connection is restored. Let's notify cacheinvalidations so it has
« no previous file with comments | « components/invalidation/impl/gcm_network_channel.h ('k') | components/invalidation/impl/gcm_network_channel_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698