[Offline Prefetch] Check notification pref
Before scheduling new notifications for prefetched offline pages, check
the state of the Content Suggestions Notification preference setting.
Start displaying the notification preference page on pre-O devices when
the prefetched pages feature is enabled.
On O+ devices, notifications are handled at the system level by
Notification channels, so this pref can be ignored.
Bug: 944912
Change-Id: I9e53fa2037952af4e98400416ed307ef8bbc3968
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586595
Commit-Queue: Natalie Chouinard <[email protected]>
Reviewed-by: Theresa <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Reviewed-by: Carlos Knippschild <[email protected]>
Cr-Commit-Position: refs/heads/master@{#667278}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 2d69e32..a2980c5a 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -436,6 +436,11 @@
"ntp.content_suggestions.notifications.sent_count";
const char kNotificationIDWithinCategory[] =
"ContentSuggestionsNotificationIDWithinCategory";
+
+// Deprecated 5/2019.
+const char kContentSuggestionsNotificationsEnabled[] =
+ "ntp.content_suggestions.notifications.enabled";
+
#endif // defined(OS_ANDROID)
#if !defined(OS_ANDROID)
@@ -499,6 +504,7 @@
registry->RegisterIntegerPref(kContentSuggestionsNotificationsSentDay, 0);
registry->RegisterIntegerPref(kContentSuggestionsNotificationsSentCount, 0);
registry->RegisterStringPref(kNotificationIDWithinCategory, std::string());
+ registry->RegisterBooleanPref(kContentSuggestionsNotificationsEnabled, true);
#endif // defined(OS_ANDROID)
#if !defined(OS_ANDROID)
@@ -1080,6 +1086,9 @@
profile_prefs->ClearPref(kContentSuggestionsNotificationsSentDay);
profile_prefs->ClearPref(kContentSuggestionsNotificationsSentCount);
profile_prefs->ClearPref(kNotificationIDWithinCategory);
+
+ // Added 5/2019.
+ profile_prefs->ClearPref(kContentSuggestionsNotificationsEnabled);
#endif // defined(OS_ANDROID)
#if !defined(OS_ANDROID)