Index: chrome/browser/chromeos/policy/heartbeat_scheduler.h |
diff --git a/chrome/browser/chromeos/policy/heartbeat_scheduler.h b/chrome/browser/chromeos/policy/heartbeat_scheduler.h |
index ab3140c612890872b28884fd7df1162ebe028345..1b46709f0cf74c1e7ee4e67ba2e8bb353da2a991 100644 |
--- a/chrome/browser/chromeos/policy/heartbeat_scheduler.h |
+++ b/chrome/browser/chromeos/policy/heartbeat_scheduler.h |
@@ -16,6 +16,7 @@ |
#include "chrome/browser/chromeos/settings/cros_settings.h" |
#include "components/gcm_driver/gcm_app_handler.h" |
#include "components/gcm_driver/gcm_client.h" |
+#include "components/gcm_driver/gcm_connection_observer.h" |
#include "components/policy/core/common/cloud/cloud_policy_client.h" |
namespace base { |
@@ -33,7 +34,8 @@ class HeartbeatRegistrationHelper; |
// Class responsible for periodically sending heartbeats to the policy service |
// for monitoring device connectivity. |
-class HeartbeatScheduler : public gcm::GCMAppHandler { |
+class HeartbeatScheduler : public gcm::GCMAppHandler, |
+ gcm::GCMConnectionObserver { |
public: |
// Default interval for how often we send up a heartbeat. |
static const int64 kDefaultHeartbeatIntervalMs; |
@@ -63,6 +65,9 @@ class HeartbeatScheduler : public gcm::GCMAppHandler { |
void OnSendAcknowledged(const std::string& app_id, |
const std::string& message_id) override; |
+ // GCMConnectionObserver overrides. |
+ void OnConnected(const net::IPEndPoint&) override; |
+ |
private: |
// Callback invoked periodically to send a heartbeat to the policy service. |
void SendHeartbeat(); |
@@ -74,6 +79,10 @@ class HeartbeatScheduler : public gcm::GCMAppHandler { |
void OnHeartbeatSent(const std::string& message_id, |
gcm::GCMClient::Result result); |
+ // Invoked after a upstream notification sign up message has been sent. |
+ void OnUpstreamNotificationSent(const std::string& message_id, |
+ gcm::GCMClient::Result result); |
+ |
// Helper method that figures out when the next heartbeat should |
// be scheduled. |
void ScheduleNextHeartbeat(); |
@@ -92,6 +101,9 @@ class HeartbeatScheduler : public gcm::GCMAppHandler { |
// Callback for the GCM id update request. |
void OnGcmIdUpdateRequestSent(bool status); |
+ // Helper function to signup for upstream notification. |
+ void SignUpUpstreamNotification(); |
+ |
// TaskRunner used for scheduling heartbeats. |
const scoped_refptr<base::SequencedTaskRunner> task_runner_; |