From https://codereview.chromium.org/2886433002/diff/250001/components/content_settings/core/browser/host_content_settings_map.cc#newcode406 :
We need something to ensure effectively the same as the following would do within HostContentSettingsMap::SetWebsiteSettingCustomScope, but in a neater way. (Ideally enforced at compile time - but that may be a bigger project):
#if defined(OS_ANDROID) && DCHECK_IS_ON()
// The notification permission on Android only allows valid origins with a
// restricted set of settings, or the global wildcard origin.
if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS &&
!primary_pattern.MatchesAllHosts()) {
// The |primary_pattern| must be a valid GURL as it may be presented to the
// user: Android Notification Channels may be used on Android O onward.
DCHECK(GURL(primary_pattern.ToString()).is_valid());
ContentSetting setting =
content_settings::ValueToContentSetting(value.get());
// Disallow notification content setting updates for specific origins that
// are not ALLOW/BLOCK/DEFAULT on Android.
DCHECK(setting == CONTENT_SETTING_ALLOW ||
setting == CONTENT_SETTING_BLOCK ||
setting == CONTENT_SETTING_DEFAULT);
}
#endif
Comment 1 by raymes@chromium.org
, Jun 12 2017Components: Internals>Permissions>Model
Owner: ----