Chromium Code Reviews| Index: components/gcm_driver/gcm_client.h |
| diff --git a/components/gcm_driver/gcm_client.h b/components/gcm_driver/gcm_client.h |
| index c4dd12adc914375e3c8cf118e114589f292a7df5..92e177b8caa75ea58301e6e3e254130c8840e726 100644 |
| --- a/components/gcm_driver/gcm_client.h |
| +++ b/components/gcm_driver/gcm_client.h |
| @@ -16,6 +16,7 @@ |
| #include "components/gcm_driver/common/gcm_messages.h" |
| #include "components/gcm_driver/crypto/gcm_encryption_provider.h" |
| #include "components/gcm_driver/gcm_activity.h" |
| +#include "components/gcm_driver/gcm_message_status.h" |
| #include "components/gcm_driver/registration_info.h" |
| template <class T> class scoped_refptr; |
| @@ -139,6 +140,8 @@ class GCMClient { |
| std::string access_token; |
| }; |
| + typedef base::Callback<void(GCMMessageStatus)> MessageReceiptCallback; |
|
Peter Beverloo
2017/01/13 01:46:11
Architecturally, why did you choose to keep this i
Peter Beverloo
2017/01/13 01:46:11
nit: C++11ize
using MessageReceiptCallback = base
harkness
2017/01/19 13:20:41
Done.
harkness
2017/01/19 13:20:41
The main architectural reason was to have it in th
|
| + |
| // A delegate interface that allows the GCMClient instance to interact with |
| // its caller, i.e. notifying asynchronous event. |
| class Delegate { |
| @@ -173,8 +176,10 @@ class GCMClient { |
| // Called when a message has been received. |
| // |app_id|: application ID. |
| // |message|: message received. |
| + // |callback|: callback to invoke when processing the message is complete. |
| virtual void OnMessageReceived(const std::string& app_id, |
| - const IncomingMessage& message) = 0; |
| + const IncomingMessage& message, |
| + const MessageReceiptCallback& callback) = 0; |
|
Peter Beverloo
2017/01/13 01:46:11
(This will largely apply to app handlers, but it's
harkness
2017/01/19 13:20:41
Done.
|
| // Called when some messages have been deleted from the server. |
| // |app_id|: application ID. |
| @@ -276,6 +281,13 @@ class GCMClient { |
| const std::string& receiver_id, |
| const OutgoingMessage& message) = 0; |
| + // Send a message to GCM with information about the final status of a |
| + // previously received message. This can be run as a result of a callback |
| + // being executed from an AppHandler. |
| + virtual void SendMessageReceipt(const std::string& message_id, |
| + const std::string& app_id, |
| + GCMMessageStatus status) = 0; |
|
Peter Beverloo
2017/01/13 01:46:11
This doesn't have to live in the gcm_client.h inte
harkness
2017/01/19 13:20:41
Good point! I've moved it.
|
| + |
| // Records a decryption failure due to |result| for the |app_id|. |
| virtual void RecordDecryptionFailure( |
| const std::string& app_id, |