Commit 2aac74d3 authored by Anita Woodruff's avatar Anita Woodruff Committed by Commit Bot

Revert "[Android O] Clean up notification settings on channel migration"

This reverts commit 7860090b.

Reason for revert: Likely cause of ANR / DCHECK

Original change's description:
> [Android O] Clean up notification settings on channel migration
> 
> - Previously when migrating to channels, the content settings were
> simply copied over to the NotificationChannelsProviderAndroid from
> the PrefProvider.
> 
> - Now they are deleted from the PrefProvider as they are copied over
> to the NCPA.
> 
> - This avoids old content settings hanging around and getting
> reinstated on channel deletion.
> 
> Bug: 781524
> Change-Id: Ic00ddd4996e8a17775678193b6ffdb0b4d62d5fa
> Reviewed-on: https://chromium-review.googlesource.com/760936
> Reviewed-by: Raymes Khoury <raymes@chromium.org>
> Reviewed-by: Peter Beverloo <peter@chromium.org>
> Commit-Queue: Anita Woodruff <awdf@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#515538}

TBR=raymes@chromium.org,peter@chromium.org,awdf@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 781524,784823
Change-Id: I53d19029118bbd0c907ad1317f744e3e6e0a80c3
Reviewed-on: https://chromium-review.googlesource.com/768787Reviewed-by: default avatarAnita Woodruff <awdf@chromium.org>
Commit-Queue: Anita Woodruff <awdf@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516297}
parent b436fc7b
......@@ -188,14 +188,8 @@ void NotificationChannelsProviderAndroid::MigrateToChannelsIfNecessary(
std::unique_ptr<content_settings::RuleIterator> it(
pref_provider->GetRuleIterator(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
std::string(), false /* incognito */));
while (it && it->HasNext()) {
const content_settings::Rule& rule = it->Next();
CreateChannelForRule(rule);
pref_provider->SetWebsiteSetting(
rule.primary_pattern, rule.secondary_pattern,
CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
content_settings::ResourceIdentifier(), nullptr);
}
while (it && it->HasNext())
CreateChannelForRule(it->Next());
prefs->SetBoolean(prefs::kMigratedToSiteNotificationChannels, true);
}
......
......@@ -602,9 +602,6 @@ TEST_F(NotificationChannelsProviderAndroidTest,
checked_blocked = true;
}
}
EXPECT_FALSE(
old_provider->GetRuleIterator(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
std::string(), false /* incognito */));
}
TEST_F(NotificationChannelsProviderAndroidTest,
......
......@@ -28,13 +28,8 @@ bool MockProvider::SetWebsiteSetting(
base::Value* value) {
if (read_only_)
return false;
if (value) {
value_map_.SetValue(requesting_url_pattern, embedding_url_pattern,
content_type, resource_identifier, base::Time(), value);
} else {
value_map_.DeleteValue(requesting_url_pattern, embedding_url_pattern,
content_type, resource_identifier);
}
value_map_.SetValue(requesting_url_pattern, embedding_url_pattern,
content_type, resource_identifier, base::Time(), value);
return true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment