OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_HEARTBEAT_SCHEDULER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_HEARTBEAT_SCHEDULER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_HEARTBEAT_SCHEDULER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_HEARTBEAT_SCHEDULER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/basictypes.h" | |
11 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
16 #include "chrome/browser/chromeos/settings/cros_settings.h" | 17 #include "chrome/browser/chromeos/settings/cros_settings.h" |
17 #include "components/gcm_driver/gcm_app_handler.h" | 18 #include "components/gcm_driver/gcm_app_handler.h" |
18 #include "components/gcm_driver/gcm_client.h" | 19 #include "components/gcm_driver/gcm_client.h" |
19 #include "components/gcm_driver/gcm_connection_observer.h" | 20 #include "components/gcm_driver/gcm_connection_observer.h" |
20 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 21 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
(...skipping 10 matching lines...) Expand all Loading... |
31 | 32 |
32 class EnterpriseInstallAttributes; | 33 class EnterpriseInstallAttributes; |
33 class HeartbeatRegistrationHelper; | 34 class HeartbeatRegistrationHelper; |
34 | 35 |
35 // Class responsible for periodically sending heartbeats to the policy service | 36 // Class responsible for periodically sending heartbeats to the policy service |
36 // for monitoring device connectivity. | 37 // for monitoring device connectivity. |
37 class HeartbeatScheduler : public gcm::GCMAppHandler, | 38 class HeartbeatScheduler : public gcm::GCMAppHandler, |
38 gcm::GCMConnectionObserver { | 39 gcm::GCMConnectionObserver { |
39 public: | 40 public: |
40 // Default interval for how often we send up a heartbeat. | 41 // Default interval for how often we send up a heartbeat. |
41 static const int64 kDefaultHeartbeatIntervalMs; | 42 static const int64_t kDefaultHeartbeatIntervalMs; |
42 | 43 |
43 // Constructor. |cloud_policy_client| will be used to send registered GCM id | 44 // Constructor. |cloud_policy_client| will be used to send registered GCM id |
44 // to DM server, and can be null. |driver| can be null for tests. | 45 // to DM server, and can be null. |driver| can be null for tests. |
45 HeartbeatScheduler( | 46 HeartbeatScheduler( |
46 gcm::GCMDriver* driver, | 47 gcm::GCMDriver* driver, |
47 policy::CloudPolicyClient* cloud_policy_client, | 48 policy::CloudPolicyClient* cloud_policy_client, |
48 const std::string& enrollment_domain, | 49 const std::string& enrollment_domain, |
49 const std::string& device_id, | 50 const std::string& device_id, |
50 const scoped_refptr<base::SequencedTaskRunner>& task_runner); | 51 const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
51 | 52 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Note: This should remain the last member so it'll be destroyed and | 154 // Note: This should remain the last member so it'll be destroyed and |
154 // invalidate the weak pointers before any other members are destroyed. | 155 // invalidate the weak pointers before any other members are destroyed. |
155 base::WeakPtrFactory<HeartbeatScheduler> weak_factory_; | 156 base::WeakPtrFactory<HeartbeatScheduler> weak_factory_; |
156 | 157 |
157 DISALLOW_COPY_AND_ASSIGN(HeartbeatScheduler); | 158 DISALLOW_COPY_AND_ASSIGN(HeartbeatScheduler); |
158 }; | 159 }; |
159 | 160 |
160 } // namespace policy | 161 } // namespace policy |
161 | 162 |
162 #endif // CHROME_BROWSER_CHROMEOS_POLICY_HEARTBEAT_SCHEDULER_H_ | 163 #endif // CHROME_BROWSER_CHROMEOS_POLICY_HEARTBEAT_SCHEDULER_H_ |
OLD | NEW |