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

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

Issue 1258313002: Send GCM id to DMServer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add tests Created 5 years, 5 months 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.h
diff --git a/chrome/browser/chromeos/policy/heartbeat_scheduler.h b/chrome/browser/chromeos/policy/heartbeat_scheduler.h
index 9c268fa482f212397a3312785312d8bfe34d0cdf..9b4c7f5e4130ad7aa009b1843c2e1060b9ca70e3 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/policy/core/common/cloud/cloud_policy_client.h"
namespace base {
class SequencedTaskRunner;
@@ -37,9 +38,11 @@ class HeartbeatScheduler : public gcm::GCMAppHandler {
// Default interval for how often we send up a heartbeat.
static const int64 kDefaultHeartbeatIntervalMs;
- // Constructor. |driver| can be null for tests.
+ // Constructor. |cloud_policy_client| will be used to send registred GCM id
Andrew T Wilson (Slow) 2015/08/03 13:52:26 nit: registered
binjin 2015/08/03 17:54:25 Done.
+ // to DM server, and can be null. |driver| can be null for tests.
HeartbeatScheduler(
gcm::GCMDriver* driver,
+ policy::CloudPolicyClient* cloud_policy_client,
const std::string& enrollment_domain,
const std::string& device_id,
const scoped_refptr<base::SequencedTaskRunner>& task_runner);
@@ -60,6 +63,12 @@ class HeartbeatScheduler : public gcm::GCMAppHandler {
void OnSendAcknowledged(const std::string& app_id,
const std::string& message_id) override;
+ void SetCloudPolicyClientForTesting(policy::CloudPolicyClient* client);
+
+ bool latest_gcm_id_mapping_succeeded() const {
+ return latest_gcm_id_mapping_succeeded_;
+ }
+
private:
// Callback invoked periodically to send a heartbeat to the policy service.
void SendHeartbeat();
@@ -86,6 +95,9 @@ class HeartbeatScheduler : public gcm::GCMAppHandler {
// Shuts down our GCM connection (called when heartbeats are disabled).
void ShutdownGCM();
+ // Callback for the update GCM id mapping request.
+ void OnGcmIdMappingRequestSent(bool status);
+
// TaskRunner used for scheduling heartbeats.
const scoped_refptr<base::SequencedTaskRunner> task_runner_;
@@ -116,6 +128,8 @@ class HeartbeatScheduler : public gcm::GCMAppHandler {
// Callback invoked via a delay to send a heartbeat.
base::CancelableClosure heartbeat_callback_;
+ policy::CloudPolicyClient* cloud_policy_client_;
+
// The GCMDriver used to send heartbeat messages.
gcm::GCMDriver* const gcm_driver_;
@@ -126,6 +140,9 @@ class HeartbeatScheduler : public gcm::GCMAppHandler {
// destroyed.
bool registered_app_handler_ = false;
+ // Whether latest GCM id mapping request is successful or not.
+ bool latest_gcm_id_mapping_succeeded_ = false;
+
// Helper class to manage registering with the GCM server, including
// retries, etc.
scoped_ptr<HeartbeatRegistrationHelper> registration_helper_;

Powered by Google App Engine
This is Rietveld 408576698