Chromium Code Reviews| Index: content/shell/browser/layout_test/layout_test_push_messaging_service.cc |
| diff --git a/content/shell/browser/layout_test/layout_test_push_messaging_service.cc b/content/shell/browser/layout_test/layout_test_push_messaging_service.cc |
| index cbbcb2cc170c39ab72281ab10516cfbad2a1d332..46fdb37fa036df2358b52b6a71abf0f6dc49e454 100644 |
| --- a/content/shell/browser/layout_test/layout_test_push_messaging_service.cc |
| +++ b/content/shell/browser/layout_test/layout_test_push_messaging_service.cc |
| @@ -22,6 +22,7 @@ void LayoutTestPushMessagingService::SetPermission(const GURL& origin, |
| void LayoutTestPushMessagingService::ClearPermissions() { |
| permission_map_.clear(); |
| + registrations_.clear(); |
| } |
| GURL LayoutTestPushMessagingService::GetPushEndpoint() { |
| @@ -48,6 +49,7 @@ void LayoutTestPushMessagingService::RegisterFromWorker( |
| if (GetPermissionStatus(requesting_origin, requesting_origin) == |
| blink::WebPushPermissionStatusGranted) { |
| callback.Run("layoutTestRegistrationId", PUSH_REGISTRATION_STATUS_SUCCESS); |
| + registrations_.insert(requesting_origin); |
|
Michael van Ouwerkerk
2014/12/12 13:55:41
Move this before running the callback.
mlamouri (slow - plz ping)
2014/12/15 11:29:37
Done.
|
| } else { |
| callback.Run("registration_id", PUSH_REGISTRATION_STATUS_PERMISSION_DENIED); |
| } |
| @@ -71,4 +73,11 @@ LayoutTestPushMessagingService::GetPermissionStatus( |
| return it->second; |
| } |
| +void LayoutTestPushMessagingService::Unregister( |
| + const GURL& requesting_origin, |
| + int64 service_worker_registration_id, |
| + const UnregisterCallback& callback) { |
| + callback.Run(registrations_.erase(requesting_origin) == 1); |
| +} |
| + |
| } // namespace content |