| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 5 #ifndef GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
| 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 uint64 android_id; | 95 uint64 android_id; |
| 96 uint64 secret; | 96 uint64 secret; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 // Collection of pending registration requests. Keys are app IDs, while values | 99 // Collection of pending registration requests. Keys are app IDs, while values |
| 100 // are pending registration requests to obtain a registration ID for | 100 // are pending registration requests to obtain a registration ID for |
| 101 // requesting application. | 101 // requesting application. |
| 102 typedef std::map<std::string, RegistrationRequest*> | 102 typedef std::map<std::string, RegistrationRequest*> |
| 103 PendingRegistrations; | 103 PendingRegistrationRequests; |
| 104 | 104 |
| 105 // Collection of pending unregistration requests. Keys are app IDs, while | 105 // Collection of pending unregistration requests. Keys are app IDs, while |
| 106 // values are pending unregistration requests to disable the registration ID | 106 // values are pending unregistration requests to disable the registration ID |
| 107 // currently assigned to the application. | 107 // currently assigned to the application. |
| 108 typedef std::map<std::string, UnregistrationRequest*> | 108 typedef std::map<std::string, UnregistrationRequest*> |
| 109 PendingUnregistrations; | 109 PendingUnregistrationRequests; |
| 110 | 110 |
| 111 friend class GCMClientImplTest; | 111 friend class GCMClientImplTest; |
| 112 | 112 |
| 113 // Returns text representation of the enum State. | 113 // Returns text representation of the enum State. |
| 114 std::string GetStateString() const; | 114 std::string GetStateString() const; |
| 115 | 115 |
| 116 // Callbacks for the MCSClient. | 116 // Callbacks for the MCSClient. |
| 117 // Receives messages and dispatches them to relevant user delegates. | 117 // Receives messages and dispatches them to relevant user delegates. |
| 118 void OnMessageReceivedFromMCS(const gcm::MCSMessage& message); | 118 void OnMessageReceivedFromMCS(const gcm::MCSMessage& message); |
| 119 // Receives confirmation of sent messages or information about errors. | 119 // Receives confirmation of sent messages or information about errors. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 143 void StartCheckin(const CheckinInfo& checkin_info); | 143 void StartCheckin(const CheckinInfo& checkin_info); |
| 144 // Completes the device checkin request. | 144 // Completes the device checkin request. |
| 145 // |android_id| and |security_token| are expected to be non-zero or an error | 145 // |android_id| and |security_token| are expected to be non-zero or an error |
| 146 // is triggered. Function also cleans up the pending checkin. | 146 // is triggered. Function also cleans up the pending checkin. |
| 147 void OnCheckinCompleted(uint64 android_id, | 147 void OnCheckinCompleted(uint64 android_id, |
| 148 uint64 security_token); | 148 uint64 security_token); |
| 149 | 149 |
| 150 // Callback for persisting device credentials in the |gcm_store_|. | 150 // Callback for persisting device credentials in the |gcm_store_|. |
| 151 void SetDeviceCredentialsCallback(bool success); | 151 void SetDeviceCredentialsCallback(bool success); |
| 152 | 152 |
| 153 // Callback for persisting registration info in the |gcm_store_|. |
| 154 void UpdateRegistrationCallback(bool success); |
| 155 |
| 153 // Completes the registration request. | 156 // Completes the registration request. |
| 154 void OnRegisterCompleted(const std::string& app_id, | 157 void OnRegisterCompleted(const std::string& app_id, |
| 158 const std::vector<std::string>& sender_ids, |
| 155 RegistrationRequest::Status status, | 159 RegistrationRequest::Status status, |
| 156 const std::string& registration_id); | 160 const std::string& registration_id); |
| 157 | 161 |
| 158 // Completes the unregistration request. | 162 // Completes the unregistration request. |
| 159 void OnUnregisterCompleted(const std::string& app_id, | 163 void OnUnregisterCompleted(const std::string& app_id, |
| 160 UnregistrationRequest::Status status); | 164 UnregistrationRequest::Status status); |
| 161 | 165 |
| 162 // Completes the GCM store destroy request. | 166 // Completes the GCM store destroy request. |
| 163 void OnGCMStoreDestroyed(bool success); | 167 void OnGCMStoreDestroyed(bool success); |
| 164 | 168 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 net::BoundNetLog net_log_; | 211 net::BoundNetLog net_log_; |
| 208 scoped_ptr<ConnectionFactory> connection_factory_; | 212 scoped_ptr<ConnectionFactory> connection_factory_; |
| 209 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 213 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
| 210 | 214 |
| 211 // Controls receiving and sending of packets and reliable message queueing. | 215 // Controls receiving and sending of packets and reliable message queueing. |
| 212 scoped_ptr<MCSClient> mcs_client_; | 216 scoped_ptr<MCSClient> mcs_client_; |
| 213 | 217 |
| 214 scoped_ptr<CheckinRequest> checkin_request_; | 218 scoped_ptr<CheckinRequest> checkin_request_; |
| 215 std::vector<std::string> account_ids_; | 219 std::vector<std::string> account_ids_; |
| 216 | 220 |
| 217 // Currently pending registrations. GCMClientImpl owns the | 221 // Cached registration info. |
| 222 RegistrationInfoMap registrations_; |
| 223 |
| 224 // Currently pending registration requests. GCMClientImpl owns the |
| 218 // RegistrationRequests. | 225 // RegistrationRequests. |
| 219 PendingRegistrations pending_registrations_; | 226 PendingRegistrationRequests pending_registration_requests_; |
| 220 STLValueDeleter<PendingRegistrations> pending_registrations_deleter_; | 227 STLValueDeleter<PendingRegistrationRequests> |
| 228 pending_registration_requests_deleter_; |
| 221 | 229 |
| 222 // Currently pending unregistrations. GCMClientImpl owns the | 230 // Currently pending unregistration requests. GCMClientImpl owns the |
| 223 // UnregistrationRequests. | 231 // UnregistrationRequests. |
| 224 PendingUnregistrations pending_unregistrations_; | 232 PendingUnregistrationRequests pending_unregistration_requests_; |
| 225 STLValueDeleter<PendingUnregistrations> pending_unregistrations_deleter_; | 233 STLValueDeleter<PendingUnregistrationRequests> |
| 234 pending_unregistration_requests_deleter_; |
| 226 | 235 |
| 227 // Factory for creating references in callbacks. | 236 // Factory for creating references in callbacks. |
| 228 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 237 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
| 229 | 238 |
| 230 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 239 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
| 231 }; | 240 }; |
| 232 | 241 |
| 233 } // namespace gcm | 242 } // namespace gcm |
| 234 | 243 |
| 235 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 244 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
| OLD | NEW |