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

Unified Diff: chrome/browser/chromeos/policy/heartbeat_scheduler.h

Issue 1267983002: Signup for GCM upstream notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcm-registration
Patch Set: add heartbeats bits Created 5 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/heartbeat_scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/heartbeat_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698