| 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
|
|
|