OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ |
6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void GetGCMStatistics(const GetGCMStatisticsCallback& callback, | 76 void GetGCMStatistics(const GetGCMStatisticsCallback& callback, |
77 bool clear_logs) override; | 77 bool clear_logs) override; |
78 void SetGCMRecording(const GetGCMStatisticsCallback& callback, | 78 void SetGCMRecording(const GetGCMStatisticsCallback& callback, |
79 bool recording) override; | 79 bool recording) override; |
80 void SetAccountTokens( | 80 void SetAccountTokens( |
81 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) override; | 81 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) override; |
82 void UpdateAccountMapping(const AccountMapping& account_mapping) override; | 82 void UpdateAccountMapping(const AccountMapping& account_mapping) override; |
83 void RemoveAccountMapping(const std::string& account_id) override; | 83 void RemoveAccountMapping(const std::string& account_id) override; |
84 base::Time GetLastTokenFetchTime() override; | 84 base::Time GetLastTokenFetchTime() override; |
85 void SetLastTokenFetchTime(const base::Time& time) override; | 85 void SetLastTokenFetchTime(const base::Time& time) override; |
| 86 void WakeFromSuspendForHeartbeat(bool wake) override; |
86 | 87 |
87 // Exposed for testing purpose. | 88 // Exposed for testing purpose. |
88 bool gcm_enabled() const { return gcm_enabled_; } | 89 bool gcm_enabled() const { return gcm_enabled_; } |
89 GCMChannelStatusSyncer* gcm_channel_status_syncer_for_testing() { | 90 GCMChannelStatusSyncer* gcm_channel_status_syncer_for_testing() { |
90 return gcm_channel_status_syncer_.get(); | 91 return gcm_channel_status_syncer_.get(); |
91 } | 92 } |
92 | 93 |
93 protected: | 94 protected: |
94 // GCMDriver implementation: | 95 // GCMDriver implementation: |
95 GCMClient::Result EnsureStarted() override; | 96 GCMClient::Result EnsureStarted() override; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 scoped_ptr<GCMAccountMapper> account_mapper_; | 157 scoped_ptr<GCMAccountMapper> account_mapper_; |
157 | 158 |
158 // Time of last token fetching. | 159 // Time of last token fetching. |
159 base::Time last_token_fetch_time_; | 160 base::Time last_token_fetch_time_; |
160 | 161 |
161 scoped_refptr<base::SequencedTaskRunner> ui_thread_; | 162 scoped_refptr<base::SequencedTaskRunner> ui_thread_; |
162 scoped_refptr<base::SequencedTaskRunner> io_thread_; | 163 scoped_refptr<base::SequencedTaskRunner> io_thread_; |
163 | 164 |
164 scoped_ptr<GCMDelayedTaskController> delayed_task_controller_; | 165 scoped_ptr<GCMDelayedTaskController> delayed_task_controller_; |
165 | 166 |
| 167 // Whether the HeartbeatManager should try to wake the system from suspend for |
| 168 // sending heartbeat messages. |
| 169 bool wake_from_suspend_enabled_; |
| 170 |
166 // For all the work occurring on the IO thread. Must be destroyed on the IO | 171 // For all the work occurring on the IO thread. Must be destroyed on the IO |
167 // thread. | 172 // thread. |
168 scoped_ptr<IOWorker> io_worker_; | 173 scoped_ptr<IOWorker> io_worker_; |
169 | 174 |
170 // Callback for GetGCMStatistics. | 175 // Callback for GetGCMStatistics. |
171 GetGCMStatisticsCallback request_gcm_statistics_callback_; | 176 GetGCMStatisticsCallback request_gcm_statistics_callback_; |
172 | 177 |
173 // Used to pass a weak pointer to the IO worker. | 178 // Used to pass a weak pointer to the IO worker. |
174 base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_; | 179 base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_; |
175 | 180 |
176 DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop); | 181 DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop); |
177 }; | 182 }; |
178 | 183 |
179 } // namespace gcm | 184 } // namespace gcm |
180 | 185 |
181 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 186 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ |
OLD | NEW |