| Index: chrome/android/java/src/org/chromium/chrome/browser/notifications/ChannelsInitializer.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/ChannelsInitializer.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/ChannelsInitializer.java
|
| index dfafe8deb3a348edc4639ccad8eaadea9475dec6..1f8ce6404c3e654cfde39863770414b63608a371 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/ChannelsInitializer.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/ChannelsInitializer.java
|
| @@ -30,6 +30,11 @@ public class ChannelsInitializer {
|
| private @interface ChannelGroupId {}
|
| static final String CHANNEL_GROUP_ID_GENERAL = "general";
|
|
|
| + /**
|
| + * The set of predefined channels to be initialized on startup.
|
| + * {@link ChannelsUpdater#CHANNELS_VERSION} must be incremented every time an entry is modified,
|
| + * removed or added to this map.
|
| + */
|
| private static final Map<String, Channel> CHANNELS;
|
| static {
|
| Map<String, Channel> map = new HashMap<>();
|
| @@ -59,6 +64,18 @@ public class ChannelsInitializer {
|
| mNotificationManager = notificationManagerProxy;
|
| }
|
|
|
| + public void initializeStartupChannels() {
|
| + for (@ChannelId String channelId : CHANNELS.keySet()) {
|
| + ensureInitialized(channelId);
|
| + }
|
| + }
|
| +
|
| + void deleteAllChannels() {
|
| + for (String channelId : mNotificationManager.getNotificationChannelIds()) {
|
| + mNotificationManager.deleteNotificationChannel(channelId);
|
| + }
|
| + }
|
| +
|
| /**
|
| * Ensures the given channel has been created on the notification manager so a notification
|
| * can be safely posted to it. This should only be used for channels that are predefined in
|
| @@ -83,7 +100,7 @@ public class ChannelsInitializer {
|
| */
|
| public static class Channel {
|
| @ChannelId
|
| - final String mId;
|
| + public final String mId;
|
| final int mNameResId;
|
| final int mImportance;
|
| @ChannelGroupId
|
|
|