OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/gcm_driver/gcm_driver.h" | 5 #include "components/gcm_driver/gcm_driver.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 if (callback_iter == register_callbacks_.end()) { | 180 if (callback_iter == register_callbacks_.end()) { |
181 // The callback could have been removed when the app is uninstalled. | 181 // The callback could have been removed when the app is uninstalled. |
182 return; | 182 return; |
183 } | 183 } |
184 | 184 |
185 RegisterCallback callback = callback_iter->second; | 185 RegisterCallback callback = callback_iter->second; |
186 register_callbacks_.erase(callback_iter); | 186 register_callbacks_.erase(callback_iter); |
187 callback.Run(registration_id, result); | 187 callback.Run(registration_id, result); |
188 } | 188 } |
189 | 189 |
| 190 void GCMDriver::UnregisterRemoveEncryptionInfo(const std::string& app_id, |
| 191 GCMClient::Result result) { |
| 192 encryption_provider_.RemoveEncryptionInfo( |
| 193 app_id, base::Bind(&GCMDriver::UnregisterFinished, |
| 194 weak_ptr_factory_.GetWeakPtr(), app_id, result)); |
| 195 } |
| 196 |
190 void GCMDriver::UnregisterFinished(const std::string& app_id, | 197 void GCMDriver::UnregisterFinished(const std::string& app_id, |
191 GCMClient::Result result) { | 198 GCMClient::Result result) { |
192 std::map<std::string, UnregisterCallback>::iterator callback_iter = | 199 std::map<std::string, UnregisterCallback>::iterator callback_iter = |
193 unregister_callbacks_.find(app_id); | 200 unregister_callbacks_.find(app_id); |
194 if (callback_iter == unregister_callbacks_.end()) | 201 if (callback_iter == unregister_callbacks_.end()) |
195 return; | 202 return; |
196 | 203 |
197 UnregisterCallback callback = callback_iter->second; | 204 UnregisterCallback callback = callback_iter->second; |
198 unregister_callbacks_.erase(callback_iter); | 205 unregister_callbacks_.erase(callback_iter); |
199 callback.Run(result); | 206 callback.Run(result); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 GCMClient::Result result) { | 293 GCMClient::Result result) { |
287 // Invoke the original unregister callback. | 294 // Invoke the original unregister callback. |
288 unregister_callback.Run(result); | 295 unregister_callback.Run(result); |
289 | 296 |
290 // Trigger the pending registration. | 297 // Trigger the pending registration. |
291 DCHECK(register_callbacks_.find(app_id) != register_callbacks_.end()); | 298 DCHECK(register_callbacks_.find(app_id) != register_callbacks_.end()); |
292 RegisterImpl(app_id, normalized_sender_ids); | 299 RegisterImpl(app_id, normalized_sender_ids); |
293 } | 300 } |
294 | 301 |
295 } // namespace gcm | 302 } // namespace gcm |
OLD | NEW |