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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 // | 231 // |
231 // |scope| is used to identify the component that requests a custom interval | 232 // |scope| is used to identify the component that requests a custom interval |
232 // to be set, and allows that component to later revoke the setting. | 233 // to be set, and allows that component to later revoke the setting. |
233 // |interval_ms| should be between 2 minues and 15 minues (28 minues on | 234 // |interval_ms| should be between 2 minues and 15 minues (28 minues on |
234 // cellular networks). For details check | 235 // cellular networks). For details check |
235 // GetMin/MaxClientHeartbeatItnervalMs() in HeartbeatManager. | 236 // GetMin/MaxClientHeartbeatItnervalMs() in HeartbeatManager. |
236 virtual void AddHeartbeatInterval(const std::string& scope, | 237 virtual void AddHeartbeatInterval(const std::string& scope, |
237 int interval_ms) = 0; | 238 int interval_ms) = 0; |
238 virtual void RemoveHeartbeatInterval(const std::string& scope) = 0; | 239 virtual void RemoveHeartbeatInterval(const std::string& scope) = 0; |
239 | 240 |
241 // Should only be used by the InstanceID system. | |
242 GCMEncryptionProvider* encryption_provider_internal() { | |
Peter Beverloo
2016/05/11 16:04:59
(1) Please move this after GetInstanceIDHandlerInt
johnme
2016/05/13 16:25:45
Done.
| |
243 return &encryption_provider_; | |
244 } | |
245 | |
240 protected: | 246 protected: |
241 // Ensures that the GCM service starts (if necessary conditions are met). | 247 // Ensures that the GCM service starts (if necessary conditions are met). |
242 virtual GCMClient::Result EnsureStarted(GCMClient::StartMode start_mode) = 0; | 248 virtual GCMClient::Result EnsureStarted(GCMClient::StartMode start_mode) = 0; |
243 | 249 |
244 // Platform-specific implementation of Register. | 250 // Platform-specific implementation of Register. |
245 virtual void RegisterImpl(const std::string& app_id, | 251 virtual void RegisterImpl(const std::string& app_id, |
246 const std::vector<std::string>& sender_ids) = 0; | 252 const std::vector<std::string>& sender_ids) = 0; |
247 | 253 |
248 // Platform-specific implementation of Unregister. | 254 // Platform-specific implementation of Unregister. |
249 virtual void UnregisterImpl(const std::string& app_id) = 0; | 255 virtual void UnregisterImpl(const std::string& app_id) = 0; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 DefaultGCMAppHandler default_app_handler_; | 340 DefaultGCMAppHandler default_app_handler_; |
335 | 341 |
336 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; | 342 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; |
337 | 343 |
338 DISALLOW_COPY_AND_ASSIGN(GCMDriver); | 344 DISALLOW_COPY_AND_ASSIGN(GCMDriver); |
339 }; | 345 }; |
340 | 346 |
341 } // namespace gcm | 347 } // namespace gcm |
342 | 348 |
343 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ | 349 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ |
OLD | NEW |