| Index: components/gcm_driver/gcm_driver.h
|
| diff --git a/components/gcm_driver/gcm_driver.h b/components/gcm_driver/gcm_driver.h
|
| index 04fb53660dbd7db2ec8ee9603c895b46c1baab50..fb20f3ac3af6435e31771301fcb296c98f15d9ce 100644
|
| --- a/components/gcm_driver/gcm_driver.h
|
| +++ b/components/gcm_driver/gcm_driver.h
|
| @@ -37,8 +37,9 @@ class GCMDriver {
|
| GCMDriver();
|
| virtual ~GCMDriver();
|
|
|
| - // Registers |sender_id| for an app. A registration ID will be returned by
|
| - // the GCM server.
|
| + // Registers |sender_ids| for an app. A registration ID will be returned by
|
| + // the GCM server. On Android, only a single sender ID is supported, but
|
| + // instead multiple simultaneous registrations are allowed.
|
| // |app_id|: application ID.
|
| // |sender_ids|: list of IDs of the servers that are allowed to send the
|
| // messages to the application. These IDs are assigned by the
|
| @@ -48,12 +49,22 @@ class GCMDriver {
|
| const std::vector<std::string>& sender_ids,
|
| const RegisterCallback& callback);
|
|
|
| - // Unregisters an app from using GCM.
|
| + // Unregisters all sender_ids for an app. Only works on non-Android.
|
| // |app_id|: application ID.
|
| // |callback|: to be called once the asynchronous operation is done.
|
| void Unregister(const std::string& app_id,
|
| const UnregisterCallback& callback);
|
|
|
| + // Unregisters an (app_id, sender_id) pair from using GCM. Only works on
|
| + // Android.
|
| + // TODO(jianli): Switch to using GCM's unsubscribe API.
|
| + // |app_id|: application ID.
|
| + // |sender_id|: the sender ID that was passed when registering.
|
| + // |callback|: to be called once the asynchronous operation is done.
|
| + void UnregisterWithSenderId(const std::string& app_id,
|
| + const std::string& sender_id,
|
| + const UnregisterCallback& callback);
|
| +
|
| // Sends a message to a given receiver.
|
| // |app_id|: application ID.
|
| // |receiver_id|: registration ID of the receiver party.
|
| @@ -146,6 +157,10 @@ class GCMDriver {
|
| // Platform-specific implementation of Unregister.
|
| virtual void UnregisterImpl(const std::string& app_id) = 0;
|
|
|
| + // Platform-specific implementation of UnregisterWithSenderId.
|
| + virtual void UnregisterWithSenderIdImpl(const std::string& app_id,
|
| + const std::string& sender_id);
|
| +
|
| // Platform-specific implementation of Send.
|
| virtual void SendImpl(const std::string& app_id,
|
| const std::string& receiver_id,
|
| @@ -170,6 +185,11 @@ class GCMDriver {
|
| void ClearCallbacks();
|
|
|
| private:
|
| + // Common code shared by Unregister and UnregisterWithSenderId.
|
| + void UnregisterInternal(const std::string& app_id,
|
| + const std::string* sender_id,
|
| + const UnregisterCallback& callback);
|
| +
|
| // Called after unregistration completes in order to trigger the pending
|
| // registration.
|
| void RegisterAfterUnregister(
|
|
|