From 8d7918af2366fa91c8bbc537cc1ba3c3ffd44866 Mon Sep 17 00:00:00 2001 From: Rayan Kanso Date: Wed, 3 Jul 2019 21:03:38 +0000 Subject: [PATCH] [DevTools] Add a Background Services view for the Payment API The new view is behind a flag. Screenshot: https://bugs.chromium.org/p/chromium/issues/detail?id=980291#c3 Bug: 980291 Change-Id: I4c420c292a57796b7fc2042902be6661131fe5d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1684995 Commit-Queue: Rayan Kanso Reviewed-by: Alexei Filippov Cr-Original-Commit-Position: refs/heads/master@{#674609} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 4e07ff4d5a87dd7bdf8da9d64a1821faf0b436b3 --- front_end/main/Main.js | 1 + front_end/resources/ApplicationPanelSidebar.js | 9 +++++++++ front_end/resources/BackgroundServiceView.js | 2 ++ front_end/resources/resources_strings.grdp | 3 +++ 4 files changed, 15 insertions(+) diff --git a/front_end/main/Main.js b/front_end/main/Main.js index 69e4eadeb1..e104fcc6dd 100644 --- a/front_end/main/Main.js +++ b/front_end/main/Main.js @@ -110,6 +110,7 @@ Main.Main = class { 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('backgroundServicesPaymentHandler', 'Background services section for Payment Handler'); 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'); diff --git a/front_end/resources/ApplicationPanelSidebar.js b/front_end/resources/ApplicationPanelSidebar.js index 6c914490eb..0a21b8a7d6 100644 --- a/front_end/resources/ApplicationPanelSidebar.js +++ b/front_end/resources/ApplicationPanelSidebar.js @@ -119,6 +119,11 @@ Resources.ApplicationPanelSidebar = class extends UI.VBox { new Resources.BackgroundServiceTreeElement(panel, Protocol.BackgroundService.ServiceName.Notifications); backgroundServiceTreeElement.appendChild(this.notificationsTreeElement); } + if (Runtime.experiments.isEnabled('backgroundServicesPaymentHandler')) { + this.paymentHandlerTreeElement = + new Resources.BackgroundServiceTreeElement(panel, Protocol.BackgroundService.ServiceName.PaymentHandler); + backgroundServiceTreeElement.appendChild(this.paymentHandlerTreeElement); + } if (Runtime.experiments.isEnabled('backgroundServicesPushMessaging')) { this.pushMessagingTreeElement = new Resources.BackgroundServiceTreeElement(panel, Protocol.BackgroundService.ServiceName.PushMessaging); @@ -245,6 +250,8 @@ Resources.ApplicationPanelSidebar = class extends UI.VBox { this.backgroundSyncTreeElement._initialize(backgroundServiceModel); if (Runtime.experiments.isEnabled('backgroundServicesNotifications')) this.notificationsTreeElement._initialize(backgroundServiceModel); + if (Runtime.experiments.isEnabled('backgroundServicesPaymentHandler')) + this.paymentHandlerTreeElement._initialize(backgroundServiceModel); if (Runtime.experiments.isEnabled('backgroundServicesPushMessaging')) this.pushMessagingTreeElement._initialize(backgroundServiceModel); } @@ -762,6 +769,8 @@ Resources.BackgroundServiceTreeElement = class extends Resources.BaseStorageTree return 'mediumicon-cloud'; case Protocol.BackgroundService.ServiceName.Notifications: return 'mediumicon-bell'; + case Protocol.BackgroundService.ServiceName.PaymentHandler: + return 'mediumicon-payment'; default: console.error(`Service ${this._serviceName} does not have a dedicated icon`); return 'mediumicon-table'; diff --git a/front_end/resources/BackgroundServiceView.js b/front_end/resources/BackgroundServiceView.js index 45456bc595..05a63172aa 100644 --- a/front_end/resources/BackgroundServiceView.js +++ b/front_end/resources/BackgroundServiceView.js @@ -17,6 +17,8 @@ Resources.BackgroundServiceView = class extends UI.VBox { return ls`Push Messaging`; case Protocol.BackgroundService.ServiceName.Notifications: return ls`Notifications`; + case Protocol.BackgroundService.ServiceName.PaymentHandler: + return ls`Payment Handler`; default: return ''; } diff --git a/front_end/resources/resources_strings.grdp b/front_end/resources/resources_strings.grdp index 9353faf969..4ed2e5b185 100644 --- a/front_end/resources/resources_strings.grdp +++ b/front_end/resources/resources_strings.grdp @@ -404,4 +404,7 @@ read the "$1s" table. Source + + Payment Handler + \ No newline at end of file