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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 // Ask the handlers whether they know how to handle it. | 258 // Ask the handlers whether they know how to handle it. |
259 for (iter = app_handlers_.begin(); iter != app_handlers_.end(); ++iter) { | 259 for (iter = app_handlers_.begin(); iter != app_handlers_.end(); ++iter) { |
260 if (iter->second->CanHandle(app_id)) | 260 if (iter->second->CanHandle(app_id)) |
261 return iter->second; | 261 return iter->second; |
262 } | 262 } |
263 | 263 |
264 return &default_app_handler_; | 264 return &default_app_handler_; |
265 } | 265 } |
266 | 266 |
| 267 GCMEncryptionProvider* GCMDriver::GetEncryptionProviderInternal() { |
| 268 return &encryption_provider_; |
| 269 } |
| 270 |
267 bool GCMDriver::HasRegisterCallback(const std::string& app_id) { | 271 bool GCMDriver::HasRegisterCallback(const std::string& app_id) { |
268 return register_callbacks_.find(app_id) != register_callbacks_.end(); | 272 return register_callbacks_.find(app_id) != register_callbacks_.end(); |
269 } | 273 } |
270 | 274 |
271 void GCMDriver::ClearCallbacks() { | 275 void GCMDriver::ClearCallbacks() { |
272 register_callbacks_.clear(); | 276 register_callbacks_.clear(); |
273 unregister_callbacks_.clear(); | 277 unregister_callbacks_.clear(); |
274 send_callbacks_.clear(); | 278 send_callbacks_.clear(); |
275 } | 279 } |
276 | 280 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 GCMClient::Result result) { | 316 GCMClient::Result result) { |
313 // Invoke the original unregister callback. | 317 // Invoke the original unregister callback. |
314 unregister_callback.Run(result); | 318 unregister_callback.Run(result); |
315 | 319 |
316 // Trigger the pending registration. | 320 // Trigger the pending registration. |
317 DCHECK(register_callbacks_.find(app_id) != register_callbacks_.end()); | 321 DCHECK(register_callbacks_.find(app_id) != register_callbacks_.end()); |
318 RegisterImpl(app_id, normalized_sender_ids); | 322 RegisterImpl(app_id, normalized_sender_ids); |
319 } | 323 } |
320 | 324 |
321 } // namespace gcm | 325 } // namespace gcm |
OLD | NEW |