| 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 <bitset> | 7 #include <bitset> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 break; | 599 break; |
| 600 } | 600 } |
| 601 RegisterEnd(callback, registration_id, status); | 601 RegisterEnd(callback, registration_id, status); |
| 602 DecreasePushRegistrationCount(1, true /* was_pending */); | 602 DecreasePushRegistrationCount(1, true /* was_pending */); |
| 603 } | 603 } |
| 604 | 604 |
| 605 void PushMessagingServiceImpl::DidRequestPermission( | 605 void PushMessagingServiceImpl::DidRequestPermission( |
| 606 const PushMessagingApplicationId& application_id, | 606 const PushMessagingApplicationId& application_id, |
| 607 const std::string& sender_id, | 607 const std::string& sender_id, |
| 608 const content::PushMessagingService::RegisterCallback& register_callback, | 608 const content::PushMessagingService::RegisterCallback& register_callback, |
| 609 bool allow) { | 609 ContentSetting content_setting) { |
| 610 if (!allow) { | 610 if (content_setting != CONTENT_SETTING_ALLOW) { |
| 611 RegisterEnd(register_callback, | 611 RegisterEnd(register_callback, |
| 612 std::string(), | 612 std::string(), |
| 613 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); | 613 content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); |
| 614 return; | 614 return; |
| 615 } | 615 } |
| 616 | 616 |
| 617 // The GCMDriver could be NULL if GCMProfileService has been shut down. | 617 // The GCMDriver could be NULL if GCMProfileService has been shut down. |
| 618 if (!gcm_profile_service_->driver()) | 618 if (!gcm_profile_service_->driver()) |
| 619 return; | 619 return; |
| 620 | 620 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 return permission_context->GetPermissionStatus(origin, origin) == | 782 return permission_context->GetPermissionStatus(origin, origin) == |
| 783 CONTENT_SETTING_ALLOW; | 783 CONTENT_SETTING_ALLOW; |
| 784 } | 784 } |
| 785 | 785 |
| 786 void PushMessagingServiceImpl::SetProfileForTesting(Profile* profile) { | 786 void PushMessagingServiceImpl::SetProfileForTesting(Profile* profile) { |
| 787 profile_ = profile; | 787 profile_ = profile; |
| 788 profile_->GetHostContentSettingsMap()->AddObserver(this); | 788 profile_->GetHostContentSettingsMap()->AddObserver(this); |
| 789 } | 789 } |
| 790 | 790 |
| 791 } // namespace gcm | 791 } // namespace gcm |
| OLD | NEW |