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

Unified Diff: chrome/browser/push_messaging/push_messaging_permission_context.cc

Issue 1816123002: Add testing for subscription from service workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix asan errors Created 4 years, 9 months 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: chrome/browser/push_messaging/push_messaging_permission_context.cc
diff --git a/chrome/browser/push_messaging/push_messaging_permission_context.cc b/chrome/browser/push_messaging/push_messaging_permission_context.cc
index 6125f3ebfd3ab245f66518fa08ef6a867994c06e..2214145796414bc0fb034c4676e9481b72b71bf5 100644
--- a/chrome/browser/push_messaging/push_messaging_permission_context.cc
+++ b/chrome/browser/push_messaging/push_messaging_permission_context.cc
@@ -53,12 +53,15 @@ ContentSetting PushMessagingPermissionContext::GetPermissionStatus(
push_content_setting == CONTENT_SETTING_BLOCK) {
return CONTENT_SETTING_BLOCK;
}
- if (notifications_permission == CONTENT_SETTING_ASK ||
- push_content_setting == CONTENT_SETTING_ASK) {
+ if (notifications_permission == CONTENT_SETTING_ASK)
return CONTENT_SETTING_ASK;
- }
- DCHECK_EQ(CONTENT_SETTING_ALLOW, notifications_permission);
- DCHECK_EQ(CONTENT_SETTING_ALLOW, push_content_setting);
+
+ DCHECK(push_content_setting == CONTENT_SETTING_ALLOW ||
+ push_content_setting == CONTENT_SETTING_ASK);
+
+ // If the notifications permission has already been granted,
+ // and the push permission isn't explicitly blocked, then grant
+ // allow permission.
return CONTENT_SETTING_ALLOW;
#else
return CONTENT_SETTING_BLOCK;

Powered by Google App Engine
This is Rietveld 408576698