Chromium Code Reviews| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 virtual void RemoveAccountMapping(const std::string& account_id) = 0; | 139 virtual void RemoveAccountMapping(const std::string& account_id) = 0; |
| 140 | 140 |
| 141 // Getter and setter of last token fetch time. | 141 // Getter and setter of last token fetch time. |
| 142 virtual base::Time GetLastTokenFetchTime() = 0; | 142 virtual base::Time GetLastTokenFetchTime() = 0; |
| 143 virtual void SetLastTokenFetchTime(const base::Time& time) = 0; | 143 virtual void SetLastTokenFetchTime(const base::Time& time) = 0; |
| 144 | 144 |
| 145 // Sets whether or not GCM should try to wake the system from suspend in order | 145 // Sets whether or not GCM should try to wake the system from suspend in order |
| 146 // to send a heartbeat message. | 146 // to send a heartbeat message. |
| 147 virtual void WakeFromSuspendForHeartbeat(bool wake) = 0; | 147 virtual void WakeFromSuspendForHeartbeat(bool wake) = 0; |
| 148 | 148 |
| 149 // Adds or removes a custom client requested heartbeat interval. If multiple | |
| 150 // components set that setting, the lowest setting will be used. If the | |
| 151 // setting is outside of GetMax/MinClientHeartbeatIntervalMs() it will be | |
| 152 // ignored. If a new setting is less than the currently used, the connection | |
| 153 // will be reset with the new heartbeat. Client that no longer require | |
| 154 // aggressive heartbeats, should remove their requested interval. Heartbeats | |
| 155 // set this way survive connection/Chrome restart. | |
| 156 // Server can overwrite the setting to a different value. | |
| 157 virtual void AddHeartbeatInterval(const std::string& scope, | |
|
Nicolas Zea
2015/05/07 18:13:52
nit: describe what scope is and how it should be s
fgorski
2015/05/10 06:44:34
Done.
| |
| 158 int interval_ms) = 0; | |
| 159 virtual void RemoveHeartbeatInterval(const std::string& scope) = 0; | |
| 160 | |
| 149 protected: | 161 protected: |
| 150 // Ensures that the GCM service starts (if necessary conditions are met). | 162 // Ensures that the GCM service starts (if necessary conditions are met). |
| 151 virtual GCMClient::Result EnsureStarted(GCMClient::StartMode start_mode) = 0; | 163 virtual GCMClient::Result EnsureStarted(GCMClient::StartMode start_mode) = 0; |
| 152 | 164 |
| 153 // Platform-specific implementation of Register. | 165 // Platform-specific implementation of Register. |
| 154 virtual void RegisterImpl(const std::string& app_id, | 166 virtual void RegisterImpl(const std::string& app_id, |
| 155 const std::vector<std::string>& sender_ids) = 0; | 167 const std::vector<std::string>& sender_ids) = 0; |
| 156 | 168 |
| 157 // Platform-specific implementation of Unregister. | 169 // Platform-specific implementation of Unregister. |
| 158 virtual void UnregisterImpl(const std::string& app_id) = 0; | 170 virtual void UnregisterImpl(const std::string& app_id) = 0; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 DefaultGCMAppHandler default_app_handler_; | 227 DefaultGCMAppHandler default_app_handler_; |
| 216 | 228 |
| 217 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; | 229 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; |
| 218 | 230 |
| 219 DISALLOW_COPY_AND_ASSIGN(GCMDriver); | 231 DISALLOW_COPY_AND_ASSIGN(GCMDriver); |
| 220 }; | 232 }; |
| 221 | 233 |
| 222 } // namespace gcm | 234 } // namespace gcm |
| 223 | 235 |
| 224 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ | 236 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ |
| OLD | NEW |