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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 // Runs the Send callback. | 261 // Runs the Send callback. |
262 void SendFinished(const std::string& app_id, | 262 void SendFinished(const std::string& app_id, |
263 const std::string& message_id, | 263 const std::string& message_id, |
264 GCMClient::Result result); | 264 GCMClient::Result result); |
265 | 265 |
266 bool HasRegisterCallback(const std::string& app_id); | 266 bool HasRegisterCallback(const std::string& app_id); |
267 | 267 |
268 void ClearCallbacks(); | 268 void ClearCallbacks(); |
269 | 269 |
| 270 // Dispatches the OnMessage event to the app handler associated with |app_id|. |
| 271 // If |message| has been encrypted, it will be decrypted asynchronously and |
| 272 // dispatched when the decryption operation was successful. Otherwise, the |
| 273 // |message| will be dispatched immediately to the handler for |app_id|. |
| 274 void DispatchMessage(const std::string& app_id, |
| 275 const IncomingMessage& message); |
| 276 |
270 private: | 277 private: |
271 // Common code shared by Unregister and UnregisterWithSenderId. | 278 // Common code shared by Unregister and UnregisterWithSenderId. |
272 void UnregisterInternal(const std::string& app_id, | 279 void UnregisterInternal(const std::string& app_id, |
273 const std::string* sender_id, | 280 const std::string* sender_id, |
274 const UnregisterCallback& callback); | 281 const UnregisterCallback& callback); |
275 | 282 |
276 // Called after unregistration completes in order to trigger the pending | 283 // Called after unregistration completes in order to trigger the pending |
277 // registration. | 284 // registration. |
278 void RegisterAfterUnregister( | 285 void RegisterAfterUnregister( |
279 const std::string& app_id, | 286 const std::string& app_id, |
(...skipping 22 matching lines...) Expand all Loading... |
302 DefaultGCMAppHandler default_app_handler_; | 309 DefaultGCMAppHandler default_app_handler_; |
303 | 310 |
304 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; | 311 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; |
305 | 312 |
306 DISALLOW_COPY_AND_ASSIGN(GCMDriver); | 313 DISALLOW_COPY_AND_ASSIGN(GCMDriver); |
307 }; | 314 }; |
308 | 315 |
309 } // namespace gcm | 316 } // namespace gcm |
310 | 317 |
311 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ | 318 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ |
OLD | NEW |