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

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: browsertests and override fix 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
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

Powered by Google App Engine
This is Rietveld 408576698