Migrate resources/ to import cross-module
Bug: 1006759
Change-Id: I95a6b04dcbac41ca56036e0ff7ae70f74e9fa8e8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2051994
Reviewed-by: Paul Lewis <[email protected]>
Commit-Queue: Tim van der Lippe <[email protected]>
diff --git a/front_end/resources/BackgroundServiceView.js b/front_end/resources/BackgroundServiceView.js
index 765b286..d74b0cf 100644
--- a/front_end/resources/BackgroundServiceView.js
+++ b/front_end/resources/BackgroundServiceView.js
@@ -2,9 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as Bindings from '../bindings/bindings.js';
+import * as DataGrid from '../data_grid/data_grid.js';
+import * as SDK from '../sdk/sdk.js';
+import * as UI from '../ui/ui.js';
+
import {BackgroundServiceModel, Events} from './BackgroundServiceModel.js'; // eslint-disable-line no-unused-vars
-export class BackgroundServiceView extends UI.VBox {
+export class BackgroundServiceView extends UI.Widget.VBox {
/**
* @param {string} serviceName The name of the background service.
* @return {string} The UI String to display.
@@ -46,49 +51,49 @@
this._model.addEventListener(Events.BackgroundServiceEventReceived, this._onEventReceived, this);
this._model.enable(this._serviceName);
- /** @const {?SDK.ServiceWorkerManager} */
- this._serviceWorkerManager = this._model.target().model(SDK.ServiceWorkerManager);
+ /** @const {?SDK.ServiceWorkerManager.ServiceWorkerManager} */
+ this._serviceWorkerManager = this._model.target().model(SDK.ServiceWorkerManager.ServiceWorkerManager);
- /** @const {?SDK.SecurityOriginManager} */
- this._securityOriginManager = this._model.target().model(SDK.SecurityOriginManager);
+ /** @const {?SDK.SecurityOriginManager.SecurityOriginManager} */
+ this._securityOriginManager = this._model.target().model(SDK.SecurityOriginManager.SecurityOriginManager);
this._securityOriginManager.addEventListener(
SDK.SecurityOriginManager.Events.MainSecurityOriginChanged, () => this._onOriginChanged());
- /** @const {!UI.Action} */
+ /** @const {!UI.Action.Action} */
this._recordAction =
- /** @type {!UI.Action} */ (self.UI.actionRegistry.action('background-service.toggle-recording'));
- /** @type {?UI.ToolbarButton} */
+ /** @type {!UI.Action.Action} */ (self.UI.actionRegistry.action('background-service.toggle-recording'));
+ /** @type {?UI.Toolbar.ToolbarButton} */
this._recordButton = null;
- /** @type {?UI.ToolbarCheckbox} */
+ /** @type {?UI.Toolbar.ToolbarCheckbox} */
this._originCheckbox = null;
- /** @type {?UI.ToolbarButton} */
+ /** @type {?UI.Toolbar.ToolbarButton} */
this._saveButton = null;
- /** @const {!UI.Toolbar} */
- this._toolbar = new UI.Toolbar('background-service-toolbar', this.contentElement);
+ /** @const {!UI.Toolbar.Toolbar} */
+ this._toolbar = new UI.Toolbar.Toolbar('background-service-toolbar', this.contentElement);
this._setupToolbar();
/**
* This will contain the DataGrid for displaying events, and a panel at the bottom for showing
* extra metadata related to the selected event.
- * @const {!UI.SplitWidget}
+ * @const {!UI.SplitWidget.SplitWidget}
*/
- this._splitWidget = new UI.SplitWidget(/* isVertical= */ false, /* secondIsSidebar= */ true);
+ this._splitWidget = new UI.SplitWidget.SplitWidget(/* isVertical= */ false, /* secondIsSidebar= */ true);
this._splitWidget.show(this.contentElement);
- /** @const {!DataGrid.DataGrid} */
+ /** @const {!DataGrid.DataGrid.DataGridImpl} */
this._dataGrid = this._createDataGrid();
- /** @const {!UI.VBox} */
- this._previewPanel = new UI.VBox();
+ /** @const {!UI.Widget.VBox} */
+ this._previewPanel = new UI.Widget.VBox();
/** @type {?EventDataNode} */
this._selectedEventNode = null;
- /** @type {?UI.Widget} */
+ /** @type {?UI.Widget.Widget} */
this._preview = null;
this._splitWidget.setMainWidget(this._dataGrid.asWidget());
@@ -101,23 +106,23 @@
* Creates the toolbar UI element.
*/
async _setupToolbar() {
- this._recordButton = UI.Toolbar.createActionButton(this._recordAction);
+ this._recordButton = UI.Toolbar.Toolbar.createActionButton(this._recordAction);
this._toolbar.appendToolbarItem(this._recordButton);
- const clearButton = new UI.ToolbarButton(ls`Clear`, 'largeicon-clear');
- clearButton.addEventListener(UI.ToolbarButton.Events.Click, () => this._clearEvents());
+ const clearButton = new UI.Toolbar.ToolbarButton(ls`Clear`, 'largeicon-clear');
+ clearButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, () => this._clearEvents());
this._toolbar.appendToolbarItem(clearButton);
this._toolbar.appendSeparator();
- this._saveButton = new UI.ToolbarButton(ls`Save events`, 'largeicon-download');
- this._saveButton.addEventListener(UI.ToolbarButton.Events.Click, () => this._saveToFile());
+ this._saveButton = new UI.Toolbar.ToolbarButton(ls`Save events`, 'largeicon-download');
+ this._saveButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, () => this._saveToFile());
this._saveButton.setEnabled(false);
this._toolbar.appendToolbarItem(this._saveButton);
this._toolbar.appendSeparator();
- this._originCheckbox = new UI.ToolbarCheckbox(
+ this._originCheckbox = new UI.Toolbar.ToolbarCheckbox(
ls`Show events from other domains`, ls`Show events from other domains`, () => this._refreshView());
this._toolbar.appendToolbarItem(this._originCheckbox);
}
@@ -209,7 +214,7 @@
}
/**
- * @return {!DataGrid.DataGrid}
+ * @return {!DataGrid.DataGrid.DataGridImpl}
*/
_createDataGrid() {
const columns = /** @type {!Array<!DataGrid.ColumnDescriptor>} */ ([
@@ -220,7 +225,7 @@
{id: 'swScope', title: ls`SW Scope`, weight: 2},
{id: 'instanceId', title: ls`Instance ID`, weight: 10},
]);
- const dataGrid = new DataGrid.DataGrid({displayName: ls`Background Services`, columns});
+ const dataGrid = new DataGrid.DataGrid.DataGridImpl({displayName: ls`Background Services`, columns});
dataGrid.setStriped(true);
dataGrid.addEventListener(
@@ -245,7 +250,7 @@
return {
id: this._dataGrid.rootNode().children.length + 1,
- timestamp: UI.formatTimestamp(serviceEvent.timestamp * 1000, /* full= */ true),
+ timestamp: UI.UIUtils.formatTimestamp(serviceEvent.timestamp * 1000, /* full= */ true),
origin: serviceEvent.origin,
swScope,
eventName: serviceEvent.eventName,
@@ -297,7 +302,7 @@
break;
}
- return UI.XLink.create(url, ls`Learn more`);
+ return UI.XLink.XLink.create(url, ls`Learn more`);
}
/**
@@ -320,7 +325,7 @@
return;
}
- this._preview = new UI.VBox();
+ this._preview = new UI.Widget.VBox();
this._preview.contentElement.classList.add('background-service-preview', 'fill');
const centered = this._preview.contentElement.createChild('div');
@@ -334,16 +339,16 @@
centered.createChild('p').textContent =
ls`DevTools will record all ${featureName} activity for up to 3 days, even when closed.`;
} else {
- const landingRecordButton = UI.Toolbar.createActionButton(this._recordAction);
+ const landingRecordButton = UI.Toolbar.Toolbar.createActionButton(this._recordAction);
const recordKey = createElementWithClass('b', 'background-service-shortcut');
recordKey.textContent =
self.UI.shortcutRegistry.shortcutDescriptorsForAction('background-service.toggle-recording')[0].name;
- const inlineButton = UI.createInlineButton(landingRecordButton);
+ const inlineButton = UI.UIUtils.createInlineButton(landingRecordButton);
inlineButton.classList.add('background-service-record-inline-button');
- centered.createChild('p').appendChild(
- UI.formatLocalized('Click the record button %s or hit %s to start recording.', [inlineButton, recordKey]));
+ centered.createChild('p').appendChild(UI.UIUtils.formatLocalized(
+ 'Click the record button %s or hit %s to start recording.', [inlineButton, recordKey]));
centered.appendChild(this._createLearnMoreLink());
}
@@ -356,7 +361,7 @@
*/
async _saveToFile() {
const fileName = `${this._serviceName}-${new Date().toISO8601Compact()}.json`;
- const stream = new Bindings.FileOutputStream();
+ const stream = new Bindings.FileUtils.FileOutputStream();
const accepted = await stream.open(fileName);
if (!accepted) {
@@ -369,7 +374,7 @@
}
}
-export class EventDataNode extends DataGrid.DataGridNode {
+export class EventDataNode extends DataGrid.DataGrid.DataGridNode {
/**
* @param {!Object<string, string>} data
* @param {!Array<!Protocol.BackgroundService.EventMetadata>} eventMetadata
@@ -382,10 +387,10 @@
}
/**
- * @return {!UI.VBox}
+ * @return {!UI.Widget.VBox}
*/
createPreview() {
- const preview = new UI.VBox();
+ const preview = new UI.Widget.VBox();
preview.element.classList.add('background-service-metadata');
for (const entry of this._eventMetadata) {
@@ -411,13 +416,13 @@
}
/**
- * @implements {UI.ActionDelegate}
+ * @implements {UI.ActionDelegate.ActionDelegate}
* @unrestricted
*/
export class ActionDelegate {
/**
* @override
- * @param {!UI.Context} context
+ * @param {!UI.Context.Context} context
* @param {string} actionId
* @return {boolean}
*/