[DevTools] Add Notifications & Push Messaging views.

Add basic UI for Notifications & Push Messaging in Application >
Background Services.
One UI flag per feature is created.

TBR=caseq@chromium.org

Screenshot: crbug.com/942174#c28
Bug: 942174
Change-Id: Ifcdca9d3d78593968b0bd93d02d9dfea9419b822
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1611612
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Reviewed-by: Alexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661384}
diff --git a/third_party/blink/renderer/core/inspector/browser_protocol.pdl b/third_party/blink/renderer/core/inspector/browser_protocol.pdl
index 46999b9..9de341f 100644
--- a/third_party/blink/renderer/core/inspector/browser_protocol.pdl
+++ b/third_party/blink/renderer/core/inspector/browser_protocol.pdl
@@ -479,6 +479,8 @@
     enum
       backgroundFetch
       backgroundSync
+      pushMessaging
+      notifications
 
   # Enables event updates for the service.
   command startObserving
diff --git a/third_party/blink/renderer/devtools/front_end/main/Main.js b/third_party/blink/renderer/devtools/front_end/main/Main.js
index 57a7bcc..6b0399f 100644
--- a/third_party/blink/renderer/devtools/front_end/main/Main.js
+++ b/third_party/blink/renderer/devtools/front_end/main/Main.js
@@ -109,6 +109,8 @@
     Runtime.experiments.register('applyCustomStylesheet', 'Allow custom UI themes');
     Runtime.experiments.register('sourcesPrettyPrint', 'Automatically pretty print in the Sources Panel');
     Runtime.experiments.register('backgroundServices', 'Background web platform feature events', true);
+    Runtime.experiments.register('backgroundServicesNotifications', 'Background services section for Notifications');
+    Runtime.experiments.register('backgroundServicesPushMessaging', 'Background services section for Push Messaging');
     Runtime.experiments.register('blackboxJSFramesOnTimeline', 'Blackbox JavaScript frames on Timeline', true);
     Runtime.experiments.register('emptySourceMapAutoStepping', 'Empty sourcemap auto-stepping');
     Runtime.experiments.register('inputEventsOnTimelineOverview', 'Input events on Timeline overview', true);
diff --git a/third_party/blink/renderer/devtools/front_end/resources/ApplicationPanelSidebar.js b/third_party/blink/renderer/devtools/front_end/resources/ApplicationPanelSidebar.js
index 40faebd..426e783 100644
--- a/third_party/blink/renderer/devtools/front_end/resources/ApplicationPanelSidebar.js
+++ b/third_party/blink/renderer/devtools/front_end/resources/ApplicationPanelSidebar.js
@@ -113,6 +113,17 @@
       this.backgroundSyncTreeElement =
           new Resources.BackgroundServiceTreeElement(panel, Protocol.BackgroundService.ServiceName.BackgroundSync);
       backgroundServiceTreeElement.appendChild(this.backgroundSyncTreeElement);
+
+      if (Runtime.experiments.isEnabled('backgroundServicesNotifications')) {
+        this.notificationsTreeElement =
+            new Resources.BackgroundServiceTreeElement(panel, Protocol.BackgroundService.ServiceName.Notifications);
+        backgroundServiceTreeElement.appendChild(this.notificationsTreeElement);
+      }
+      if (Runtime.experiments.isEnabled('backgroundServicesPushMessaging')) {
+        this.pushMessagingTreeElement =
+            new Resources.BackgroundServiceTreeElement(panel, Protocol.BackgroundService.ServiceName.PushMessaging);
+        backgroundServiceTreeElement.appendChild(this.pushMessagingTreeElement);
+      }
     }
 
     this._resourcesSection = new Resources.ResourcesSection(panel, this._addSidebarSection(Common.UIString('Frames')));
@@ -232,6 +243,10 @@
     if (Runtime.experiments.isEnabled('backgroundServices')) {
       this.backgroundFetchTreeElement._initialize(backgroundServiceModel);
       this.backgroundSyncTreeElement._initialize(backgroundServiceModel);
+      if (Runtime.experiments.isEnabled('backgroundServicesNotifications'))
+        this.notificationsTreeElement._initialize(backgroundServiceModel);
+      if (Runtime.experiments.isEnabled('backgroundServicesPushMessaging'))
+        this.pushMessagingTreeElement._initialize(backgroundServiceModel);
     }
   }
 
@@ -743,6 +758,10 @@
         return 'mediumicon-fetch';
       case Protocol.BackgroundService.ServiceName.BackgroundSync:
         return 'mediumicon-sync';
+      case Protocol.BackgroundService.ServiceName.PushMessaging:
+        return 'mediumicon-cloud';
+      case Protocol.BackgroundService.ServiceName.Notifications:
+        return 'mediumicon-bell';
       default:
         console.error(`Service ${this._serviceName} does not have a dedicated icon`);
         return 'mediumicon-table';
diff --git a/third_party/blink/renderer/devtools/front_end/resources/BackgroundServiceView.js b/third_party/blink/renderer/devtools/front_end/resources/BackgroundServiceView.js
index a92d8b1..7a65f4b 100644
--- a/third_party/blink/renderer/devtools/front_end/resources/BackgroundServiceView.js
+++ b/third_party/blink/renderer/devtools/front_end/resources/BackgroundServiceView.js
@@ -13,6 +13,10 @@
         return ls`Background Fetch`;
       case Protocol.BackgroundService.ServiceName.BackgroundSync:
         return ls`Background Sync`;
+      case Protocol.BackgroundService.ServiceName.PushMessaging:
+        return ls`Push Messaging`;
+      case Protocol.BackgroundService.ServiceName.Notifications:
+        return ls`Notifications`;
       default:
         return '';
     }