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 "chrome/browser/services/gcm/push_messaging_service_impl.h" | 5 #include "chrome/browser/services/gcm/push_messaging_service_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 PushMessagingPermissionContextFactory::GetForProfile(profile_); | 365 PushMessagingPermissionContextFactory::GetForProfile(profile_); |
366 return ToPushPermission(permission_context->GetPermissionStatus( | 366 return ToPushPermission(permission_context->GetPermissionStatus( |
367 requesting_origin, embedding_origin)); | 367 requesting_origin, embedding_origin)); |
368 } | 368 } |
369 | 369 |
370 void PushMessagingServiceImpl::RegisterEnd( | 370 void PushMessagingServiceImpl::RegisterEnd( |
371 const content::PushMessagingService::RegisterCallback& callback, | 371 const content::PushMessagingService::RegisterCallback& callback, |
372 const std::string& registration_id, | 372 const std::string& registration_id, |
373 content::PushRegistrationStatus status) { | 373 content::PushRegistrationStatus status) { |
374 callback.Run(registration_id, status); | 374 callback.Run(registration_id, status); |
375 if (status == content::PUSH_REGISTRATION_STATUS_SUCCESS) | 375 if (status == content::PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE) |
376 IncreasePushRegistrationCount(1); | 376 IncreasePushRegistrationCount(1); |
377 } | 377 } |
378 | 378 |
379 void PushMessagingServiceImpl::DidRegister( | 379 void PushMessagingServiceImpl::DidRegister( |
380 const content::PushMessagingService::RegisterCallback& callback, | 380 const content::PushMessagingService::RegisterCallback& callback, |
381 const std::string& registration_id, | 381 const std::string& registration_id, |
382 GCMClient::Result result) { | 382 GCMClient::Result result) { |
383 content::PushRegistrationStatus status = | 383 content::PushRegistrationStatus status = |
384 result == GCMClient::SUCCESS | 384 result == GCMClient::SUCCESS |
385 ? content::PUSH_REGISTRATION_STATUS_SUCCESS | 385 ? content::PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE |
386 : content::PUSH_REGISTRATION_STATUS_SERVICE_ERROR; | 386 : content::PUSH_REGISTRATION_STATUS_SERVICE_ERROR; |
387 RegisterEnd(callback, registration_id, status); | 387 RegisterEnd(callback, registration_id, status); |
388 } | 388 } |
389 | 389 |
390 void PushMessagingServiceImpl::DidRequestPermission( | 390 void PushMessagingServiceImpl::DidRequestPermission( |
391 const PushMessagingApplicationId& application_id, | 391 const PushMessagingApplicationId& application_id, |
392 const std::string& sender_id, | 392 const std::string& sender_id, |
393 const content::PushMessagingService::RegisterCallback& register_callback, | 393 const content::PushMessagingService::RegisterCallback& register_callback, |
394 bool allow) { | 394 bool allow) { |
395 if (!allow) { | 395 if (!allow) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 442 } |
443 | 443 |
444 void PushMessagingServiceImpl::AddAppHandlerIfNecessary() { | 444 void PushMessagingServiceImpl::AddAppHandlerIfNecessary() { |
445 if (gcm_profile_service_->driver()->GetAppHandler( | 445 if (gcm_profile_service_->driver()->GetAppHandler( |
446 kPushMessagingApplicationIdPrefix) != this) | 446 kPushMessagingApplicationIdPrefix) != this) |
447 gcm_profile_service_->driver()->AddAppHandler( | 447 gcm_profile_service_->driver()->AddAppHandler( |
448 kPushMessagingApplicationIdPrefix, this); | 448 kPushMessagingApplicationIdPrefix, this); |
449 } | 449 } |
450 | 450 |
451 } // namespace gcm | 451 } // namespace gcm |
OLD | NEW |