Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1324)

Unified Diff: content/shell/browser/layout_test/layout_test_push_messaging_service.cc

Issue 793403002: Implement WebPushProvider.unregister() in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mvan_2
Patch Set: jochen review comments Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/browser/layout_test/layout_test_push_messaging_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e6639c3bd68c41edd1a33adc884ac553f892a306..70ca79f4cdbfdd39a9e520c3e7b8fb7779091030 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() {
@@ -47,6 +48,7 @@ void LayoutTestPushMessagingService::RegisterFromWorker(
const PushMessagingService::RegisterCallback& callback) {
if (GetPermissionStatus(requesting_origin, requesting_origin) ==
blink::WebPushPermissionStatusGranted) {
+ registrations_.insert(requesting_origin);
callback.Run("layoutTestRegistrationId",
PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE);
} else {
@@ -72,4 +74,17 @@ LayoutTestPushMessagingService::GetPermissionStatus(
return it->second;
}
+void LayoutTestPushMessagingService::Unregister(
+ const GURL& requesting_origin,
+ int64 service_worker_registration_id,
+ const UnregisterCallback& callback) {
+ PushUnregistrationStatus status;
+ if (registrations_.erase(requesting_origin) == 1)
+ status = PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTER;
+ else
+ status = PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED;
+
+ callback.Run(status);
+}
+
} // namespace content
« no previous file with comments | « content/shell/browser/layout_test/layout_test_push_messaging_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698