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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // |receiver_id|: registration ID of the receiver party. | 131 // |receiver_id|: registration ID of the receiver party. |
132 // |message|: message to be sent. | 132 // |message|: message to be sent. |
133 // |callback|: to be called once the asynchronous operation is done. | 133 // |callback|: to be called once the asynchronous operation is done. |
134 void Send(const std::string& app_id, | 134 void Send(const std::string& app_id, |
135 const std::string& receiver_id, | 135 const std::string& receiver_id, |
136 const OutgoingMessage& message, | 136 const OutgoingMessage& message, |
137 const SendCallback& callback); | 137 const SendCallback& callback); |
138 | 138 |
139 // Get the public encryption key and the authentication secret associated with | 139 // Get the public encryption key and the authentication secret associated with |
140 // |app_id|. If none have been associated with |app_id| yet, they will be | 140 // |app_id|. If none have been associated with |app_id| yet, they will be |
141 // created. The |callback| will be invoked when it is available. | 141 // created. The |callback| will be invoked when it is available. Only use with |
| 142 // GCM registrations; use InstanceID::GetEncryptionInfo for InstanceID tokens. |
142 void GetEncryptionInfo(const std::string& app_id, | 143 void GetEncryptionInfo(const std::string& app_id, |
143 const GetEncryptionInfoCallback& callback); | 144 const GetEncryptionInfoCallback& callback); |
144 | 145 |
145 const GCMAppHandlerMap& app_handlers() const { return app_handlers_; } | 146 const GCMAppHandlerMap& app_handlers() const { return app_handlers_; } |
146 | 147 |
147 // This method must be called before destroying the GCMDriver. Once it has | 148 // This method must be called before destroying the GCMDriver. Once it has |
148 // been called, no other GCMDriver methods may be used. | 149 // been called, no other GCMDriver methods may be used. |
149 virtual void Shutdown(); | 150 virtual void Shutdown(); |
150 | 151 |
151 // Called when the user signs in to or out of a GAIA account. | 152 // Called when the user signs in to or out of a GAIA account. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 virtual void RemoveAccountMapping(const std::string& account_id) = 0; | 206 virtual void RemoveAccountMapping(const std::string& account_id) = 0; |
206 | 207 |
207 // Getter and setter of last token fetch time. | 208 // Getter and setter of last token fetch time. |
208 virtual base::Time GetLastTokenFetchTime() = 0; | 209 virtual base::Time GetLastTokenFetchTime() = 0; |
209 virtual void SetLastTokenFetchTime(const base::Time& time) = 0; | 210 virtual void SetLastTokenFetchTime(const base::Time& time) = 0; |
210 | 211 |
211 // Sets whether or not GCM should try to wake the system from suspend in order | 212 // Sets whether or not GCM should try to wake the system from suspend in order |
212 // to send a heartbeat message. | 213 // to send a heartbeat message. |
213 virtual void WakeFromSuspendForHeartbeat(bool wake) = 0; | 214 virtual void WakeFromSuspendForHeartbeat(bool wake) = 0; |
214 | 215 |
215 // Supports InstanceID handling. Must only be used by the InstanceID system. | 216 // These methods must only be used by the InstanceID system. |
| 217 // The InstanceIDHandler provides an implementation for the InstanceID system. |
216 virtual InstanceIDHandler* GetInstanceIDHandlerInternal() = 0; | 218 virtual InstanceIDHandler* GetInstanceIDHandlerInternal() = 0; |
| 219 // Allows the InstanceID system to integrate with GCM encryption storage. |
| 220 GCMEncryptionProvider* GetEncryptionProviderInternal(); |
217 | 221 |
218 // Adds or removes a custom client requested heartbeat interval. If multiple | 222 // Adds or removes a custom client requested heartbeat interval. If multiple |
219 // components set that setting, the lowest setting will be used. If the | 223 // components set that setting, the lowest setting will be used. If the |
220 // setting is outside of GetMax/MinClientHeartbeatIntervalMs() it will be | 224 // setting is outside of GetMax/MinClientHeartbeatIntervalMs() it will be |
221 // ignored. If a new setting is less than the currently used, the connection | 225 // ignored. If a new setting is less than the currently used, the connection |
222 // will be reset with the new heartbeat. Client that no longer require | 226 // will be reset with the new heartbeat. Client that no longer require |
223 // aggressive heartbeats, should remove their requested interval. Heartbeats | 227 // aggressive heartbeats, should remove their requested interval. Heartbeats |
224 // set this way survive connection/Chrome restart. | 228 // set this way survive connection/Chrome restart. |
225 // | 229 // |
226 // GCM Driver can decide to postpone the action until Client is properly | 230 // GCM Driver can decide to postpone the action until Client is properly |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 DefaultGCMAppHandler default_app_handler_; | 338 DefaultGCMAppHandler default_app_handler_; |
335 | 339 |
336 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; | 340 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; |
337 | 341 |
338 DISALLOW_COPY_AND_ASSIGN(GCMDriver); | 342 DISALLOW_COPY_AND_ASSIGN(GCMDriver); |
339 }; | 343 }; |
340 | 344 |
341 } // namespace gcm | 345 } // namespace gcm |
342 | 346 |
343 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ | 347 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ |
OLD | NEW |