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_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ |
6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 virtual base::Time GetLastTokenFetchTime() = 0; | 162 virtual base::Time GetLastTokenFetchTime() = 0; |
163 virtual void SetLastTokenFetchTime(const base::Time& time) = 0; | 163 virtual void SetLastTokenFetchTime(const base::Time& time) = 0; |
164 | 164 |
165 // Sets whether or not GCM should try to wake the system from suspend in order | 165 // Sets whether or not GCM should try to wake the system from suspend in order |
166 // to send a heartbeat message. | 166 // to send a heartbeat message. |
167 virtual void WakeFromSuspendForHeartbeat(bool wake) = 0; | 167 virtual void WakeFromSuspendForHeartbeat(bool wake) = 0; |
168 | 168 |
169 // Supports saving the Instance ID data in the GCM store. | 169 // Supports saving the Instance ID data in the GCM store. |
170 virtual InstanceIDStore* GetInstanceIDStore() = 0; | 170 virtual InstanceIDStore* GetInstanceIDStore() = 0; |
171 | 171 |
172 // Adds or removes a custom client requested heartbeat interval. If multiple | |
173 // components set that setting, the lowest setting will be used. If the | |
174 // setting is outside of GetMax/MinClientHeartbeatIntervalMs() it will be | |
175 // ignored. If a new setting is less than the currently used, the connection | |
176 // will be reset with the new heartbeat. Client that no longer require | |
177 // aggressive heartbeats, should remove their requested interval. Heartbeats | |
178 // set this way survive connection/Chrome restart. | |
179 // | |
180 // GCM Driver can decide to postpone the action until Client is properly | |
181 // initialized, hence this setting can be called at any time. | |
182 // | |
183 // Server can overwrite the setting to a different value. | |
184 // | |
185 // |scope| is used to identify the component that requests a custom interval | |
186 // to be set, and allows that component to later revoke the setting. | |
187 // |interval_ms| should be between 2 and 15 (28 on cellular networks). For | |
Nicolas Zea
2015/05/13 17:57:36
2 and 15 are in units of minutes right? I'd call t
fgorski
2015/05/13 18:59:16
Done.
| |
188 // details check GetMin/MaxClientHeartbeatItnervalMs() in HeartbeatManager. | |
189 virtual void AddHeartbeatInterval(const std::string& scope, | |
190 int interval_ms) = 0; | |
191 virtual void RemoveHeartbeatInterval(const std::string& scope) = 0; | |
192 | |
172 protected: | 193 protected: |
173 // Ensures that the GCM service starts (if necessary conditions are met). | 194 // Ensures that the GCM service starts (if necessary conditions are met). |
174 virtual GCMClient::Result EnsureStarted(GCMClient::StartMode start_mode) = 0; | 195 virtual GCMClient::Result EnsureStarted(GCMClient::StartMode start_mode) = 0; |
175 | 196 |
176 // Platform-specific implementation of Register. | 197 // Platform-specific implementation of Register. |
177 virtual void RegisterImpl(const std::string& app_id, | 198 virtual void RegisterImpl(const std::string& app_id, |
178 const std::vector<std::string>& sender_ids) = 0; | 199 const std::vector<std::string>& sender_ids) = 0; |
179 | 200 |
180 // Platform-specific implementation of Unregister. | 201 // Platform-specific implementation of Unregister. |
181 virtual void UnregisterImpl(const std::string& app_id) = 0; | 202 virtual void UnregisterImpl(const std::string& app_id) = 0; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 DefaultGCMAppHandler default_app_handler_; | 259 DefaultGCMAppHandler default_app_handler_; |
239 | 260 |
240 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; | 261 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; |
241 | 262 |
242 DISALLOW_COPY_AND_ASSIGN(GCMDriver); | 263 DISALLOW_COPY_AND_ASSIGN(GCMDriver); |
243 }; | 264 }; |
244 | 265 |
245 } // namespace gcm | 266 } // namespace gcm |
246 | 267 |
247 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ | 268 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ |
OLD | NEW |