Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Unified Diff: components/gcm_driver/gcm_client_impl.h

Issue 1137463003: Support getting and deleting token for Instance ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new files Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/gcm_driver/gcm_client_impl.h
diff --git a/components/gcm_driver/gcm_client_impl.h b/components/gcm_driver/gcm_client_impl.h
index 2db1805d7ea1668a267cfccd947e9103147088f2..382ae282440169467d30cd4191aaa27136b08225 100644
--- a/components/gcm_driver/gcm_client_impl.h
+++ b/components/gcm_driver/gcm_client_impl.h
@@ -111,9 +111,9 @@ class GCMClientImpl
GCMClient::Delegate* delegate) override;
void Start(StartMode start_mode) override;
void Stop() override;
- void Register(const std::string& app_id,
- const std::vector<std::string>& sender_ids) override;
- void Unregister(const std::string& app_id) override;
+ void Register(const linked_ptr<RegistrationInfo>& registration_info) override;
+ void Unregister(
+ const linked_ptr<RegistrationInfo>& registration_info) override;
void Send(const std::string& app_id,
const std::string& receiver_id,
const OutgoingMessage& message) override;
@@ -163,23 +163,33 @@ class GCMClientImpl
std::set<std::string> last_checkin_accounts;
};
- // 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*>
- PendingRegistrationRequests;
+ // Collection of pending registration requests. Keys are RegistrationInfo
+ // instance, while values are pending registration requests to obtain a
+ // registration ID for requesting application.
+ typedef std::map<linked_ptr<RegistrationInfo>,
+ RegistrationRequest*,
+ RegistrationInfoComparer> PendingRegistrationRequests;
- // 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*>
- PendingUnregistrationRequests;
+ // Collection of pending unregistration requests. Keys are RegistrationInfo
+ // instance, while values are pending unregistration requests to disable the
+ // registration ID currently assigned to the application.
+ typedef std::map<linked_ptr<RegistrationInfo>,
+ UnregistrationRequest*,
+ RegistrationInfoComparer> PendingUnregistrationRequests;
friend class GCMClientImplTest;
// Returns text representation of the enum State.
std::string GetStateString() const;
+ // Builds RequestInfo that is passed to registration/unregistration requests.
+ scoped_ptr<RegistrationRequest::RequestInfo>
+ BuildRegistrationRequestInfo(
+ const RegistrationInfo& registration_info) const;
+ scoped_ptr<UnregistrationRequest::RequestInfo>
+ BuildUnregistrationRequestInfo(
+ const RegistrationInfo& registration_info) const;
+
// Callbacks for the MCSClient.
// Receives messages and dispatches them to relevant user delegates.
void OnMessageReceivedFromMCS(const gcm::MCSMessage& message);
@@ -245,14 +255,15 @@ class GCMClientImpl
void ResetStoreCallback(bool success);
// Completes the registration request.
- void OnRegisterCompleted(const std::string& app_id,
- const std::vector<std::string>& sender_ids,
- RegistrationRequest::Status status,
- const std::string& registration_id);
+ void OnRegisterCompleted(
+ const linked_ptr<RegistrationInfo>& registration_info,
+ RegistrationRequest::Status status,
+ const std::string& registration_id);
// Completes the unregistration request.
- void OnUnregisterCompleted(const std::string& app_id,
- UnregistrationRequest::Status status);
+ void OnUnregisterCompleted(
+ const linked_ptr<RegistrationInfo>& registration_info,
+ UnregistrationRequest::Status status);
// Completes the GCM store destroy request.
void OnGCMStoreDestroyed(bool success);

Powered by Google App Engine
This is Rietveld 408576698