summaryrefslogtreecommitdiffstats
path: root/google_apis/gcm/gcm_client_impl.h
diff options
context:
space:
mode:
authorfgorski@chromium.org <fgorski@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-15 20:34:28 +0000
committerfgorski@chromium.org <fgorski@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-15 20:34:28 +0000
commite400704fcf1b2b8ff15c73e9d26c8e4df30899ae (patch)
treeda6cfef1239f48b048f1d70859b8be3de59a0923 /google_apis/gcm/gcm_client_impl.h
parent1ea4c493152c8b225d397ade32ef1023870293c3 (diff)
downloadchromium_src-e400704fcf1b2b8ff15c73e9d26c8e4df30899ae.zip
chromium_src-e400704fcf1b2b8ff15c73e9d26c8e4df30899ae.tar.gz
chromium_src-e400704fcf1b2b8ff15c73e9d26c8e4df30899ae.tar.bz2
[GCM] Hooking up unregistration
* Implemetning GCMClientImpl.Unregister, added UnregisterCompleted * Added OnUnregisterFinished to GCMClient::Delegate - the status is passed as a bool, because we ignore it anyway, and it is simply a hook for testing. Functionality is triggered in response to downstream message and not user's interaction. * Added a test that consumes the delegate hook. * I considered removing messages related to APP ID, but decided not to add that functionality to GCM Store, as those messages would be sent to MCS before we realize that the app is uninstalled, and there is no point in writing code that would never really do much. BUG=284553 Review URL: https://codereview.chromium.org/163953013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251593 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis/gcm/gcm_client_impl.h')
-rw-r--r--google_apis/gcm/gcm_client_impl.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/google_apis/gcm/gcm_client_impl.h b/google_apis/gcm/gcm_client_impl.h
index 3e59702..40b90f2 100644
--- a/google_apis/gcm/gcm_client_impl.h
+++ b/google_apis/gcm/gcm_client_impl.h
@@ -35,7 +35,7 @@ namespace gcm {
class CheckinRequest;
class ConnectionFactory;
class GCMClientImplTest;
-class RegistrationRequest;
+class UnregistrationRequest;
// Implements the GCM Client. It is used to coordinate MCS Client (communication
// with MCS) and other pieces of GCM infrastructure like Registration and
@@ -90,12 +90,18 @@ class GCM_EXPORT GCMClientImpl : public GCMClient {
uint64 secret;
};
- // Collection of pending registration requests. Keys are app_id, while values
+ // Collection of pending registration requests. Keys are app IDs, while values
// are pending registration requests to obtain a registration ID for
// requesting application.
typedef std::map<std::string, RegistrationRequest*>
PendingRegistrations;
+ // Collection of pending unregistration requests. Keys are app IDs, while
+ // values are pending unregistration requests to disable the registration ID
+ // currently assigned to the application.
+ typedef std::map<std::string, UnregistrationRequest*>
+ PendingUnregistrations;
+
friend class GCMClientImplTest;
// Callbacks for the MCSClient.
@@ -140,6 +146,9 @@ class GCM_EXPORT GCMClientImpl : public GCMClient {
RegistrationRequest::Status status,
const std::string& registration_id);
+ // Completes the unregistration request.
+ void OnUnregisterCompleted(const std::string& app_id, bool status);
+
// Handles incoming data message and dispatches it the a relevant user
// delegate.
void HandleIncomingMessage(const gcm::MCSMessage& message);
@@ -192,6 +201,11 @@ class GCM_EXPORT GCMClientImpl : public GCMClient {
PendingRegistrations pending_registrations_;
STLValueDeleter<PendingRegistrations> pending_registrations_deleter_;
+ // Currently pending unregistrations. GCMClientImpl owns the
+ // UnregistrationRequests.
+ PendingUnregistrations pending_unregistrations_;
+ STLValueDeleter<PendingUnregistrations> pending_unregistrations_deleter_;
+
// Factory for creating references in callbacks.
base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_;