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

Unified Diff: chrome/browser/chromeos/policy/heartbeat_scheduler.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: chrome/browser/chromeos/policy/heartbeat_scheduler.cc
diff --git a/chrome/browser/chromeos/policy/heartbeat_scheduler.cc b/chrome/browser/chromeos/policy/heartbeat_scheduler.cc
index 6782c70d408e8dd6e693c53d8c05ebc86071abc2..bb831ec042b9d5a589a06d030e032d2e080a4d3b 100644
--- a/chrome/browser/chromeos/policy/heartbeat_scheduler.cc
+++ b/chrome/browser/chromeos/policy/heartbeat_scheduler.cc
@@ -247,7 +247,6 @@ void HeartbeatScheduler::RefreshHeartbeatSettings() {
// outstanding registration attempts and disconnect from GCM so the
// connection can be shut down. If heartbeats are re-enabled later, we
// will re-register with GCM.
- heartbeat_callback_.Cancel();
ShutdownGCM();
} else {
// Schedule a new upload with the new frequency.
@@ -259,6 +258,7 @@ void HeartbeatScheduler::RefreshHeartbeatSettings() {
}
void HeartbeatScheduler::ShutdownGCM() {
+ heartbeat_callback_.Cancel();
registration_helper_.reset();
registration_id_.clear();
if (registered_app_handler_) {
@@ -424,6 +424,15 @@ void HeartbeatScheduler::ShutdownHandler() {
NOTREACHED() << "HeartbeatScheduler should be destroyed before GCMDriver";
}
+void HeartbeatScheduler::OnStoreReset() {
+ // TODO(crbug.com/661660): Tell server that |registration_id_| is no longer
+ // valid. See also crbug.com/516375.
+ if (!registration_helper_) {
+ ShutdownGCM();
+ RefreshHeartbeatSettings();
+ } // Otherwise let the pending registration complete normally.
+}
+
void HeartbeatScheduler::OnMessage(const std::string& app_id,
const gcm::IncomingMessage& message) {
// Should never be called because we don't get any incoming messages
« no previous file with comments | « chrome/browser/chromeos/policy/heartbeat_scheduler.h ('k') | chrome/browser/chromeos/policy/heartbeat_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698