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..eb9ee096b17ce46e8ff782690045e510f2315612 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,13 @@ 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. |
+ ShutdownGCM(); |
+ RefreshHeartbeatSettings(); |
+} |
+ |
void HeartbeatScheduler::OnMessage(const std::string& app_id, |
const gcm::IncomingMessage& message) { |
// Should never be called because we don't get any incoming messages |