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/AppManifestView.js b/front_end/resources/AppManifestView.js
index b341084..2e70319 100644
--- a/front_end/resources/AppManifestView.js
+++ b/front_end/resources/AppManifestView.js
@@ -2,66 +2,72 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as Common from '../common/common.js';
+import * as Components from '../components/components.js';
+import * as InlineEditor from '../inline_editor/inline_editor.js';
+import * as SDK from '../sdk/sdk.js';
+import * as UI from '../ui/ui.js';
+
/**
- * @implements {SDK.TargetManager.Observer}
+ * @implements {SDK.SDKModel.Observer}
* @unrestricted
*/
-export class AppManifestView extends UI.VBox {
+export class AppManifestView extends UI.Widget.VBox {
constructor() {
super(true);
this.registerRequiredCSS('resources/appManifestView.css');
self.Common.settings.moduleSetting('colorFormat').addChangeListener(this._updateManifest.bind(this, true));
- this._emptyView = new UI.EmptyWidget(Common.UIString('No manifest detected'));
+ this._emptyView = new UI.EmptyWidget.EmptyWidget(Common.UIString.UIString('No manifest detected'));
this._emptyView.appendLink(
'https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/?utm_source=devtools');
this._emptyView.show(this.contentElement);
this._emptyView.hideWidget();
- this._reportView = new UI.ReportView(Common.UIString('App Manifest'));
+ this._reportView = new UI.ReportView.ReportView(Common.UIString.UIString('App Manifest'));
this._reportView.show(this.contentElement);
this._reportView.hideWidget();
- this._errorsSection = this._reportView.appendSection(Common.UIString('Errors and warnings'));
- this._installabilitySection = this._reportView.appendSection(Common.UIString('Installability'));
- this._identitySection = this._reportView.appendSection(Common.UIString('Identity'));
+ this._errorsSection = this._reportView.appendSection(Common.UIString.UIString('Errors and warnings'));
+ this._installabilitySection = this._reportView.appendSection(Common.UIString.UIString('Installability'));
+ this._identitySection = this._reportView.appendSection(Common.UIString.UIString('Identity'));
- this._presentationSection = this._reportView.appendSection(Common.UIString('Presentation'));
- this._iconsSection = this._reportView.appendSection(Common.UIString('Icons'), 'report-section-icons');
+ this._presentationSection = this._reportView.appendSection(Common.UIString.UIString('Presentation'));
+ this._iconsSection = this._reportView.appendSection(Common.UIString.UIString('Icons'), 'report-section-icons');
- this._nameField = this._identitySection.appendField(Common.UIString('Name'));
- this._shortNameField = this._identitySection.appendField(Common.UIString('Short name'));
+ this._nameField = this._identitySection.appendField(Common.UIString.UIString('Name'));
+ this._shortNameField = this._identitySection.appendField(Common.UIString.UIString('Short name'));
- this._startURLField = this._presentationSection.appendField(Common.UIString('Start URL'));
+ this._startURLField = this._presentationSection.appendField(Common.UIString.UIString('Start URL'));
- const themeColorField = this._presentationSection.appendField(Common.UIString('Theme color'));
- this._themeColorSwatch = InlineEditor.ColorSwatch.create();
+ const themeColorField = this._presentationSection.appendField(Common.UIString.UIString('Theme color'));
+ this._themeColorSwatch = InlineEditor.ColorSwatch.ColorSwatch.create();
themeColorField.appendChild(this._themeColorSwatch);
- const backgroundColorField = this._presentationSection.appendField(Common.UIString('Background color'));
- this._backgroundColorSwatch = InlineEditor.ColorSwatch.create();
+ const backgroundColorField = this._presentationSection.appendField(Common.UIString.UIString('Background color'));
+ this._backgroundColorSwatch = InlineEditor.ColorSwatch.ColorSwatch.create();
backgroundColorField.appendChild(this._backgroundColorSwatch);
- this._orientationField = this._presentationSection.appendField(Common.UIString('Orientation'));
- this._displayField = this._presentationSection.appendField(Common.UIString('Display'));
+ this._orientationField = this._presentationSection.appendField(Common.UIString.UIString('Orientation'));
+ this._displayField = this._presentationSection.appendField(Common.UIString.UIString('Display'));
- this._throttler = new Common.Throttler(1000);
+ this._throttler = new Common.Throttler.Throttler(1000);
self.SDK.targetManager.observeTargets(this);
}
/**
* @override
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
*/
targetAdded(target) {
if (this._target) {
return;
}
this._target = target;
- this._resourceTreeModel = target.model(SDK.ResourceTreeModel);
- this._serviceWorkerManager = target.model(SDK.ServiceWorkerManager);
+ this._resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
+ this._serviceWorkerManager = target.model(SDK.ServiceWorkerManager.ServiceWorkerManager);
if (!this._resourceTreeModel || !this._serviceWorkerManager) {
return;
}
@@ -78,7 +84,7 @@
/**
* @override
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
*/
targetRemoved(target) {
if (this._target !== target) {
@@ -89,7 +95,7 @@
}
delete this._resourceTreeModel;
delete this._serviceWorkerManager;
- Common.EventTarget.removeEventListeners(this._registeredListeners);
+ Common.EventTarget.EventTarget.removeEventListeners(this._registeredListeners);
}
/**
@@ -119,14 +125,14 @@
this._emptyView.hideWidget();
this._reportView.showWidget();
- const link = Components.Linkifier.linkifyURL(url);
+ const link = Components.Linkifier.Linkifier.linkifyURL(url);
link.tabIndex = 0;
this._reportView.setURL(link);
this._errorsSection.clearContent();
this._errorsSection.element.classList.toggle('hidden', !errors.length);
for (const error of errors) {
this._errorsSection.appendRow().appendChild(
- UI.createIconLabel(error.message, error.critical ? 'smallicon-error' : 'smallicon-warning'));
+ UI.UIUtils.createIconLabel(error.message, error.critical ? 'smallicon-error' : 'smallicon-warning'));
}
if (!data) {
@@ -144,20 +150,21 @@
this._startURLField.removeChildren();
const startURL = stringProperty('start_url');
if (startURL) {
- const completeURL = /** @type {string} */ (Common.ParsedURL.completeURL(url, startURL));
- const link = Components.Linkifier.linkifyURL(completeURL, {text: startURL});
+ const completeURL = /** @type {string} */ (Common.ParsedURL.ParsedURL.completeURL(url, startURL));
+ const link = Components.Linkifier.Linkifier.linkifyURL(completeURL, {text: startURL});
link.tabIndex = 0;
this._startURLField.appendChild(link);
}
this._themeColorSwatch.classList.toggle('hidden', !stringProperty('theme_color'));
- const themeColor = Common.Color.parse(stringProperty('theme_color') || 'white') || Common.Color.parse('white');
- this._themeColorSwatch.setColor(/** @type {!Common.Color} */ (themeColor));
+ const themeColor =
+ Common.Color.Color.parse(stringProperty('theme_color') || 'white') || Common.Color.Color.parse('white');
+ this._themeColorSwatch.setColor(/** @type {!Common.Color.Color} */ (themeColor));
this._themeColorSwatch.setFormat(Common.Settings.detectColorFormat(this._themeColorSwatch.color()));
this._backgroundColorSwatch.classList.toggle('hidden', !stringProperty('background_color'));
const backgroundColor =
- Common.Color.parse(stringProperty('background_color') || 'white') || Common.Color.parse('white');
- this._backgroundColorSwatch.setColor(/** @type {!Common.Color} */ (backgroundColor));
+ Common.Color.Color.parse(stringProperty('background_color') || 'white') || Common.Color.Color.parse('white');
+ this._backgroundColorSwatch.setColor(/** @type {!Common.Color.Color} */ (backgroundColor));
this._backgroundColorSwatch.setFormat(Common.Settings.detectColorFormat(this._backgroundColorSwatch.color()));
this._orientationField.textContent = stringProperty('orientation');
@@ -170,14 +177,16 @@
const imageErrors = [];
const setIconMaskedCheckbox =
- UI.CheckboxLabel.create(Common.UIString('Show only the minimum safe area for maskable icons'));
+ UI.UIUtils.CheckboxLabel.create(Common.UIString.UIString('Show only the minimum safe area for maskable icons'));
setIconMaskedCheckbox.classList.add('mask-checkbox');
setIconMaskedCheckbox.addEventListener('click', () => {
this._iconsSection.setIconMasked(setIconMaskedCheckbox.checkboxElement.checked);
});
this._iconsSection.appendRow().appendChild(setIconMaskedCheckbox);
- const documentationLink = UI.XLink.create('https://web.dev/maskable-icon/', ls`documentation on maskable icons`);
- this._iconsSection.appendRow().appendChild(UI.formatLocalized('Need help? Read our %s.', [documentationLink]));
+ const documentationLink =
+ UI.XLink.XLink.create('https://web.dev/maskable-icon/', ls`documentation on maskable icons`);
+ this._iconsSection.appendRow().appendChild(
+ UI.UIUtils.formatLocalized('Need help? Read our %s.', [documentationLink]));
if (manifestIcons && manifestIcons.primaryIcon) {
const wrapper = createElement('div');
@@ -194,7 +203,7 @@
}
for (const icon of icons) {
- const iconUrl = Common.ParsedURL.completeURL(url, icon['src']);
+ const iconUrl = Common.ParsedURL.ParsedURL.completeURL(url, icon['src']);
const result = await this._loadImage(iconUrl);
if (!result) {
imageErrors.push(ls`Icon ${iconUrl} failed to load`);
@@ -229,12 +238,12 @@
this._installabilitySection.element.classList.toggle('hidden', !installabilityErrors.length);
const errorMessages = this.getInstallabilityErrorMessages(installabilityErrors);
for (const error of errorMessages) {
- this._installabilitySection.appendRow().appendChild(UI.createIconLabel(error, 'smallicon-warning'));
+ this._installabilitySection.appendRow().appendChild(UI.UIUtils.createIconLabel(error, 'smallicon-warning'));
}
this._errorsSection.element.classList.toggle('hidden', !errors.length && !imageErrors.length);
for (const error of imageErrors) {
- this._errorsSection.appendRow().appendChild(UI.createIconLabel(error, 'smallicon-warning'));
+ this._errorsSection.appendRow().appendChild(UI.UIUtils.createIconLabel(error, 'smallicon-warning'));
}
/**
diff --git a/front_end/resources/ApplicationCacheItemsView.js b/front_end/resources/ApplicationCacheItemsView.js
index 056eb01..b32063c 100644
--- a/front_end/resources/ApplicationCacheItemsView.js
+++ b/front_end/resources/ApplicationCacheItemsView.js
@@ -23,22 +23,26 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
+import * as DataGrid from '../data_grid/data_grid.js';
+import * as UI from '../ui/ui.js';
+
import {CHECKING, DOWNLOADING, IDLE, OBSOLETE, UNCACHED, UPDATEREADY} from './ApplicationCacheModel.js';
/**
* @unrestricted
*/
-export class ApplicationCacheItemsView extends UI.SimpleView {
+export class ApplicationCacheItemsView extends UI.View.SimpleView {
constructor(model, frameId) {
- super(Common.UIString('AppCache'));
+ super(Common.UIString.UIString('AppCache'));
this._model = model;
this.element.classList.add('storage-view', 'table');
- this._deleteButton = new UI.ToolbarButton(Common.UIString('Delete'), 'largeicon-delete');
+ this._deleteButton = new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Delete'), 'largeicon-delete');
this._deleteButton.setVisible(false);
- this._deleteButton.addEventListener(UI.ToolbarButton.Events.Click, this._deleteButtonClicked, this);
+ this._deleteButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._deleteButtonClicked, this);
this._connectivityIcon = createElement('span', 'dt-icon-label');
this._connectivityIcon.style.margin = '0 2px 0 5px';
@@ -47,7 +51,8 @@
this._frameId = frameId;
- this._emptyWidget = new UI.EmptyWidget(Common.UIString('No Application Cache information available.'));
+ this._emptyWidget =
+ new UI.EmptyWidget.EmptyWidget(Common.UIString.UIString('No Application Cache information available.'));
this._emptyWidget.show(this.element);
this._markDirty();
@@ -63,12 +68,12 @@
/**
* @override
- * @return {!Promise<!Array.<!UI.ToolbarItem>>}
+ * @return {!Promise<!Array.<!UI.Toolbar.ToolbarItem>>}
*/
async toolbarItems() {
return [
- this._deleteButton, new UI.ToolbarItem(this._connectivityIcon), new UI.ToolbarSeparator(),
- new UI.ToolbarItem(this._statusIcon)
+ this._deleteButton, new UI.Toolbar.ToolbarItem(this._connectivityIcon), new UI.Toolbar.ToolbarSeparator(),
+ new UI.Toolbar.ToolbarItem(this._statusIcon)
];
}
@@ -132,10 +137,10 @@
updateNetworkState(isNowOnline) {
if (isNowOnline) {
this._connectivityIcon.type = 'smallicon-green-ball';
- this._connectivityIcon.textContent = Common.UIString('Online');
+ this._connectivityIcon.textContent = Common.UIString.UIString('Online');
} else {
this._connectivityIcon.type = 'smallicon-red-ball';
- this._connectivityIcon.textContent = Common.UIString('Offline');
+ this._connectivityIcon.textContent = Common.UIString.UIString('Offline');
}
}
@@ -175,16 +180,21 @@
// FIXME: For Chrome, put creationTime and updateTime somewhere.
// NOTE: localizedString has not yet been added.
- // Common.UIString("(%s) Created: %s Updated: %s", this._size, this._creationTime, this._updateTime);
+ // Common.UIString.UIString("(%s) Created: %s Updated: %s", this._size, this._creationTime, this._updateTime);
}
_createDataGrid() {
const columns = /** @type {!Array<!DataGrid.ColumnDescriptor>} */ ([
- {id: 'resource', title: Common.UIString('Resource'), sort: DataGrid.DataGrid.Order.Ascending, sortable: true},
- {id: 'type', title: Common.UIString('Type'), sortable: true},
- {id: 'size', title: Common.UIString('Size'), align: DataGrid.DataGrid.Align.Right, sortable: true}
+ {
+ id: 'resource',
+ title: Common.UIString.UIString('Resource'),
+ sort: DataGrid.DataGrid.Order.Ascending,
+ sortable: true
+ },
+ {id: 'type', title: Common.UIString.UIString('Type'), sortable: true},
+ {id: 'size', title: Common.UIString.UIString('Size'), align: DataGrid.DataGrid.Align.Right, sortable: true}
]);
- this._dataGrid = new DataGrid.DataGrid({displayName: ls`Application Cache`, columns});
+ this._dataGrid = new DataGrid.DataGrid.DataGridImpl({displayName: ls`Application Cache`, columns});
this._dataGrid.setStriped(true);
this._dataGrid.asWidget().show(this.element);
this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, this._populateDataGrid, this);
@@ -226,7 +236,7 @@
data.resource = resource.url;
data.type = resource.type;
data.size = Number.bytesToString(resource.size);
- const node = new DataGrid.DataGridNode(data);
+ const node = new DataGrid.DataGrid.DataGridNode(data);
node.resource = resource;
node.selectable = true;
this._dataGrid.rootNode().appendChild(node);
diff --git a/front_end/resources/ApplicationCacheModel.js b/front_end/resources/ApplicationCacheModel.js
index 1a46536..55e4b84 100644
--- a/front_end/resources/ApplicationCacheModel.js
+++ b/front_end/resources/ApplicationCacheModel.js
@@ -26,12 +26,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as SDK from '../sdk/sdk.js';
+
/**
* @unrestricted
*/
-export class ApplicationCacheModel extends SDK.SDKModel {
+export class ApplicationCacheModel extends SDK.SDKModel.SDKModel {
/**
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
*/
constructor(target) {
super(target);
@@ -40,7 +42,7 @@
this._agent = target.applicationCacheAgent();
this._agent.enable();
- const resourceTreeModel = target.model(SDK.ResourceTreeModel);
+ const resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.FrameNavigated, this._frameNavigated, this);
resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.FrameDetached, this._frameDetached, this);
@@ -55,7 +57,7 @@
* @param {!Common.Event} event
*/
async _frameNavigated(event) {
- const frame = /** @type {!SDK.ResourceTreeFrame} */ (event.data);
+ const frame = /** @type {!SDK.ResourceTreeModel.ResourceTreeFrame} */ (event.data);
if (frame.isMainFrame()) {
this._mainFrameNavigated();
return;
@@ -72,7 +74,7 @@
* @param {!Common.Event} event
*/
_frameDetached(event) {
- const frame = /** @type {!SDK.ResourceTreeFrame} */ (event.data);
+ const frame = /** @type {!SDK.ResourceTreeModel.ResourceTreeFrame} */ (event.data);
this._frameManifestRemoved(frame.id);
}
@@ -184,7 +186,7 @@
}
}
-SDK.SDKModel.register(ApplicationCacheModel, SDK.Target.Capability.DOM, false);
+SDK.SDKModel.SDKModel.register(ApplicationCacheModel, SDK.SDKModel.Capability.DOM, false);
/** @enum {symbol} */
export const Events = {
diff --git a/front_end/resources/ApplicationPanelSidebar.js b/front_end/resources/ApplicationPanelSidebar.js
index 053e08b..72aff16 100644
--- a/front_end/resources/ApplicationPanelSidebar.js
+++ b/front_end/resources/ApplicationPanelSidebar.js
@@ -28,6 +28,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
+import * as Host from '../host/host.js';
+import * as SDK from '../sdk/sdk.js';
+import * as SourceFrame from '../source_frame/source_frame.js';
+import * as UI from '../ui/ui.js';
+
import {ApplicationCacheItemsView} from './ApplicationCacheItemsView.js';
import {ApplicationCacheModel, Events as ApplicationCacheModelEvents} from './ApplicationCacheModel.js';
import {AppManifestView} from './AppManifestView.js';
@@ -44,19 +50,19 @@
import {ServiceWorkersView} from './ServiceWorkersView.js';
/**
- * @implements {SDK.TargetManager.Observer}
+ * @implements {SDK.SDKModel.Observer}
* @unrestricted
*/
-export class ApplicationPanelSidebar extends UI.VBox {
+export class ApplicationPanelSidebar extends UI.Widget.VBox {
/**
- * @param {!UI.PanelWithSidebar} panel
+ * @param {!UI.Panel.PanelWithSidebar} panel
*/
constructor(panel) {
super();
this._panel = panel;
- this._sidebarTree = new UI.TreeOutlineInShadow();
+ this._sidebarTree = new UI.TreeOutline.TreeOutlineInShadow();
this._sidebarTree.element.classList.add('resources-sidebar');
this._sidebarTree.registerRequiredCSS('resources/resourcesSidebar.css');
this._sidebarTree.element.classList.add('filter-all');
@@ -64,7 +70,7 @@
this._sidebarTree.addEventListener(UI.TreeOutline.Events.ElementAttached, this._treeElementAdded, this);
this.contentElement.appendChild(this._sidebarTree.element);
- this._applicationTreeElement = this._addSidebarSection(Common.UIString('Application'));
+ this._applicationTreeElement = this._addSidebarSection(Common.UIString.UIString('Application'));
const manifestTreeElement = new AppManifestTreeElement(panel);
this._applicationTreeElement.appendChild(manifestTreeElement);
this.serviceWorkersTreeElement = new ServiceWorkersTreeElement(panel);
@@ -72,20 +78,20 @@
const clearStorageTreeElement = new ClearStorageTreeElement(panel);
this._applicationTreeElement.appendChild(clearStorageTreeElement);
- const storageTreeElement = this._addSidebarSection(Common.UIString('Storage'));
+ const storageTreeElement = this._addSidebarSection(Common.UIString.UIString('Storage'));
this.localStorageListTreeElement =
- new StorageCategoryTreeElement(panel, Common.UIString('Local Storage'), 'LocalStorage');
+ new StorageCategoryTreeElement(panel, Common.UIString.UIString('Local Storage'), 'LocalStorage');
this.localStorageListTreeElement.setLink(
'https://developers.google.com/web/tools/chrome-devtools/storage/localstorage?utm_source=devtools');
- const localStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ const localStorageIcon = UI.Icon.Icon.create('mediumicon-table', 'resource-tree-item');
this.localStorageListTreeElement.setLeadingIcons([localStorageIcon]);
storageTreeElement.appendChild(this.localStorageListTreeElement);
this.sessionStorageListTreeElement =
- new StorageCategoryTreeElement(panel, Common.UIString('Session Storage'), 'SessionStorage');
+ new StorageCategoryTreeElement(panel, Common.UIString.UIString('Session Storage'), 'SessionStorage');
this.sessionStorageListTreeElement.setLink(
'https://developers.google.com/web/tools/chrome-devtools/storage/sessionstorage?utm_source=devtools');
- const sessionStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ const sessionStorageIcon = UI.Icon.Icon.create('mediumicon-table', 'resource-tree-item');
this.sessionStorageListTreeElement.setLeadingIcons([sessionStorageIcon]);
storageTreeElement.appendChild(this.sessionStorageListTreeElement);
@@ -93,28 +99,29 @@
this.indexedDBListTreeElement.setLink(
'https://developers.google.com/web/tools/chrome-devtools/storage/indexeddb?utm_source=devtools');
storageTreeElement.appendChild(this.indexedDBListTreeElement);
- this.databasesListTreeElement = new StorageCategoryTreeElement(panel, Common.UIString('Web SQL'), 'Databases');
+ this.databasesListTreeElement =
+ new StorageCategoryTreeElement(panel, Common.UIString.UIString('Web SQL'), 'Databases');
this.databasesListTreeElement.setLink(
'https://developers.google.com/web/tools/chrome-devtools/storage/websql?utm_source=devtools');
- const databaseIcon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
+ const databaseIcon = UI.Icon.Icon.create('mediumicon-database', 'resource-tree-item');
this.databasesListTreeElement.setLeadingIcons([databaseIcon]);
storageTreeElement.appendChild(this.databasesListTreeElement);
- this.cookieListTreeElement = new StorageCategoryTreeElement(panel, Common.UIString('Cookies'), 'Cookies');
+ this.cookieListTreeElement = new StorageCategoryTreeElement(panel, Common.UIString.UIString('Cookies'), 'Cookies');
this.cookieListTreeElement.setLink(
'https://developers.google.com/web/tools/chrome-devtools/storage/cookies?utm_source=devtools');
- const cookieIcon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item');
+ const cookieIcon = UI.Icon.Icon.create('mediumicon-cookie', 'resource-tree-item');
this.cookieListTreeElement.setLeadingIcons([cookieIcon]);
storageTreeElement.appendChild(this.cookieListTreeElement);
- const cacheTreeElement = this._addSidebarSection(Common.UIString('Cache'));
+ const cacheTreeElement = this._addSidebarSection(Common.UIString.UIString('Cache'));
this.cacheStorageListTreeElement = new ServiceWorkerCacheTreeElement(panel);
cacheTreeElement.appendChild(this.cacheStorageListTreeElement);
this.applicationCacheListTreeElement =
- new StorageCategoryTreeElement(panel, Common.UIString('Application Cache'), 'ApplicationCache');
+ new StorageCategoryTreeElement(panel, Common.UIString.UIString('Application Cache'), 'ApplicationCache');
this.applicationCacheListTreeElement.setLink(
'https://developers.google.com/web/tools/chrome-devtools/storage/applicationcache?utm_source=devtools');
- const applicationCacheIcon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ const applicationCacheIcon = UI.Icon.Icon.create('mediumicon-table', 'resource-tree-item');
this.applicationCacheListTreeElement.setLeadingIcons([applicationCacheIcon]);
cacheTreeElement.appendChild(this.applicationCacheListTreeElement);
@@ -149,7 +156,7 @@
}
}
- this._resourcesSection = new ResourcesSection(panel, this._addSidebarSection(Common.UIString('Frames')));
+ this._resourcesSection = new ResourcesSection(panel, this._addSidebarSection(Common.UIString.UIString('Frames')));
/** @type {!Map.<!DatabaseModelDatabase, !Object.<string, !DatabaseTableView>>} */
this._databaseTableViews = new Map();
@@ -167,7 +174,8 @@
self.SDK.targetManager.observeTargets(this);
self.SDK.targetManager.addModelListener(
- SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this._frameNavigated, this);
+ SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this._frameNavigated,
+ this);
const selection = this._panel.lastSelectedItemPath();
if (!selection.length) {
@@ -177,10 +185,10 @@
/**
* @param {string} title
- * @return {!UI.TreeElement}
+ * @return {!UI.TreeOutline.TreeElement}
*/
_addSidebarSection(title) {
- const treeElement = new UI.TreeElement(title, true);
+ const treeElement = new UI.TreeOutline.TreeElement(title, true);
treeElement.listItemElement.classList.add('storage-group-list-item');
treeElement.setCollapsible(false);
treeElement.selectable = false;
@@ -190,7 +198,7 @@
/**
* @override
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
*/
targetAdded(target) {
if (this._target) {
@@ -203,7 +211,7 @@
this._databaseModel.addEventListener(DatabaseModelEvents.DatabasesRemoved, this._resetWebSQL, this);
}
- const resourceTreeModel = target.model(SDK.ResourceTreeModel);
+ const resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
if (!resourceTreeModel) {
return;
}
@@ -219,7 +227,7 @@
/**
* @override
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
*/
targetRemoved(target) {
if (target !== this._target) {
@@ -227,7 +235,7 @@
}
delete this._target;
- const resourceTreeModel = target.model(SDK.ResourceTreeModel);
+ const resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
if (resourceTreeModel) {
resourceTreeModel.removeEventListener(SDK.ResourceTreeModel.Events.CachedResourcesLoaded, this._initialize, this);
resourceTreeModel.removeEventListener(
@@ -250,32 +258,32 @@
}
_initialize() {
- for (const frame of SDK.ResourceTreeModel.frames()) {
+ for (const frame of SDK.ResourceTreeModel.ResourceTreeModel.frames()) {
this._addCookieDocument(frame);
}
if (this._databaseModel) {
this._databaseModel.enable();
}
- const cacheStorageModel = this._target.model(SDK.ServiceWorkerCacheModel);
+ const cacheStorageModel = this._target.model(SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel);
if (cacheStorageModel) {
cacheStorageModel.enable();
}
- const resourceTreeModel = this._target.model(SDK.ResourceTreeModel);
+ const resourceTreeModel = this._target.model(SDK.ResourceTreeModel.ResourceTreeModel);
if (resourceTreeModel) {
this._populateApplicationCacheTree(resourceTreeModel);
}
- self.SDK.targetManager.observeModels(DOMStorageModel, /** @type {!SDK.SDKModelObserver} */ ({
+ self.SDK.targetManager.observeModels(DOMStorageModel, /** @type {!SDK.SDKModel.SDKModelObserver} */ ({
modelAdded: model => this._domStorageModelAdded(model),
modelRemoved: model => this._domStorageModelRemoved(model)
}));
this.indexedDBListTreeElement._initialize();
self.SDK.targetManager.observeModels(
- IndexedDBModel, /** @type {!SDK.SDKModelObserver} */ ({
+ IndexedDBModel, /** @type {!SDK.SDKModel.SDKModelObserver} */ ({
modelAdded: model => model.enable(),
modelRemoved: model => this.indexedDBListTreeElement.removeIndexedDBForModel(model)
}));
- const serviceWorkerCacheModel = this._target.model(SDK.ServiceWorkerCacheModel);
+ const serviceWorkerCacheModel = this._target.model(SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel);
this.cacheStorageListTreeElement._initialize(serviceWorkerCacheModel);
const backgroundServiceModel = this._target.model(BackgroundServiceModel);
if (Root.Runtime.experiments.isEnabled('backgroundServices')) {
@@ -368,7 +376,7 @@
* @param {!Common.Event} event
*/
_frameNavigated(event) {
- const frame = /** @type {!SDK.ResourceTreeFrame} */ (event.data);
+ const frame = /** @type {!SDK.ResourceTreeModel.ResourceTreeFrame} */ (event.data);
if (frame.isTopFrame()) {
this._reset();
@@ -392,10 +400,10 @@
}
/**
- * @param {!SDK.ResourceTreeFrame} frame
+ * @param {!SDK.ResourceTreeModel.ResourceTreeFrame} frame
*/
_addCookieDocument(frame) {
- const parsedURL = Common.ParsedURL.fromString(frame.url);
+ const parsedURL = Common.ParsedURL.ParsedURL.fromString(frame.url);
if (!parsedURL || (parsedURL.scheme !== 'http' && parsedURL.scheme !== 'https' && parsedURL.scheme !== 'file')) {
return;
}
@@ -467,7 +475,7 @@
}
/**
- * @param {!SDK.Resource} resource
+ * @param {!SDK.Resource.Resource} resource
* @param {number=} line
* @param {number=} column
* @return {!Promise}
@@ -518,7 +526,7 @@
}
/**
- * @param {!UI.Widget} view
+ * @param {!UI.Widget.Widget} view
*/
showFileSystem(view) {
this._innerShowView(view);
@@ -572,7 +580,7 @@
}
/**
- * @param {!SDK.ResourceTreeModel} resourceTreeModel
+ * @param {!SDK.ResourceTreeModel.ResourceTreeModel} resourceTreeModel
*/
_populateApplicationCacheTree(resourceTreeModel) {
this._applicationCacheModel = this._target.model(ApplicationCacheModel);
@@ -605,7 +613,7 @@
this._applicationCacheManifestElements[manifestURL] = manifestTreeElement;
}
- const model = this._target.model(SDK.ResourceTreeModel);
+ const model = this._target.model(SDK.ResourceTreeModel.ResourceTreeModel);
const frameTreeElement = new ApplicationCacheFrameTreeElement(this, model.frameForId(frameId), manifestURL);
manifestTreeElement.appendChild(frameTreeElement);
manifestTreeElement.expand();
@@ -694,9 +702,9 @@
/**
* @unrestricted
*/
-export class BaseStorageTreeElement extends UI.TreeElement {
+export class BaseStorageTreeElement extends UI.TreeOutline.TreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
* @param {string} title
* @param {boolean} expandable
*/
@@ -730,7 +738,7 @@
/**
* @protected
- * @param {?UI.Widget} view
+ * @param {?UI.Widget.Widget} view
*/
showView(view) {
this._storagePanel.showView(view);
@@ -739,7 +747,7 @@
export class StorageCategoryTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
* @param {string} categoryName
* @param {string} settingsKey
*/
@@ -800,7 +808,7 @@
export class BackgroundServiceTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
* @param {!Protocol.BackgroundService.ServiceName} serviceName
*/
constructor(storagePanel, serviceName) {
@@ -818,7 +826,7 @@
/** @private {?BackgroundServiceModel} */
this._model = null;
- const backgroundServiceIcon = UI.Icon.create(this._getIconType(), 'resource-tree-item');
+ const backgroundServiceIcon = UI.Icon.Icon.create(this._getIconType(), 'resource-tree-item');
this.setLeadingIcons([backgroundServiceIcon]);
}
@@ -898,7 +906,7 @@
this._sidebar = sidebar;
this._database = database;
- const icon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
+ const icon = UI.Icon.Icon.create('mediumicon-database', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
@@ -947,7 +955,7 @@
this._sidebar = sidebar;
this._database = database;
this._tableName = tableName;
- const icon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ const icon = UI.Icon.Icon.create('mediumicon-table', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
@@ -972,18 +980,18 @@
*/
export class ServiceWorkerCacheTreeElement extends StorageCategoryTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
*/
constructor(storagePanel) {
- super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage');
- const icon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
+ super(storagePanel, Common.UIString.UIString('Cache Storage'), 'CacheStorage');
+ const icon = UI.Icon.Icon.create('mediumicon-database', 'resource-tree-item');
this.setLeadingIcons([icon]);
- /** @type {?SDK.ServiceWorkerCacheModel} */
+ /** @type {?SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel} */
this._swCacheModel = null;
}
/**
- * @param {?SDK.ServiceWorkerCacheModel} model
+ * @param {?SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel} model
*/
_initialize(model) {
/** @type {!Array.<!SWCacheTreeElement>} */
@@ -995,9 +1003,11 @@
}
}
self.SDK.targetManager.addModelListener(
- SDK.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheAdded, this._cacheAdded, this);
+ SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheAdded,
+ this._cacheAdded, this);
self.SDK.targetManager.addModelListener(
- SDK.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheRemoved, this._cacheRemoved, this);
+ SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheRemoved,
+ this._cacheRemoved, this);
}
/**
@@ -1009,8 +1019,8 @@
}
_handleContextMenuEvent(event) {
- const contextMenu = new UI.ContextMenu(event);
- contextMenu.defaultSection().appendItem(Common.UIString('Refresh Caches'), this._refreshCaches.bind(this));
+ const contextMenu = new UI.ContextMenu.ContextMenu(event);
+ contextMenu.defaultSection().appendItem(Common.UIString.UIString('Refresh Caches'), this._refreshCaches.bind(this));
contextMenu.show();
}
@@ -1025,12 +1035,12 @@
*/
_cacheAdded(event) {
const cache = /** @type {!SDK.ServiceWorkerCacheModel.Cache} */ (event.data.cache);
- const model = /** @type {!SDK.ServiceWorkerCacheModel} */ (event.data.model);
+ const model = /** @type {!SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel} */ (event.data.model);
this._addCache(model, cache);
}
/**
- * @param {!SDK.ServiceWorkerCacheModel} model
+ * @param {!SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel} model
* @param {!SDK.ServiceWorkerCacheModel.Cache} cache
*/
_addCache(model, cache) {
@@ -1044,7 +1054,7 @@
*/
_cacheRemoved(event) {
const cache = /** @type {!SDK.ServiceWorkerCacheModel.Cache} */ (event.data.cache);
- const model = /** @type {!SDK.ServiceWorkerCacheModel} */ (event.data.model);
+ const model = /** @type {!SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel} */ (event.data.model);
const swCacheTreeElement = this._cacheTreeElement(model, cache);
if (!swCacheTreeElement) {
@@ -1057,7 +1067,7 @@
}
/**
- * @param {!SDK.ServiceWorkerCacheModel} model
+ * @param {!SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel} model
* @param {!SDK.ServiceWorkerCacheModel.Cache} cache
* @return {?SWCacheTreeElement}
*/
@@ -1079,8 +1089,8 @@
export class SWCacheTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
- * @param {!SDK.ServiceWorkerCacheModel} model
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
+ * @param {!SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel} model
* @param {!SDK.ServiceWorkerCacheModel.Cache} cache
*/
constructor(storagePanel, model, cache) {
@@ -1089,7 +1099,7 @@
this._cache = cache;
/** @type {?ServiceWorkerCacheView} */
this._view = null;
- const icon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ const icon = UI.Icon.Icon.create('mediumicon-table', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
@@ -1107,8 +1117,8 @@
}
_handleContextMenuEvent(event) {
- const contextMenu = new UI.ContextMenu(event);
- contextMenu.defaultSection().appendItem(Common.UIString('Delete'), this._clearCache.bind(this));
+ const contextMenu = new UI.ContextMenu.ContextMenu(event);
+ contextMenu.defaultSection().appendItem(Common.UIString.UIString('Delete'), this._clearCache.bind(this));
contextMenu.show();
}
@@ -1147,11 +1157,11 @@
*/
export class ServiceWorkersTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
*/
constructor(storagePanel) {
- super(storagePanel, Common.UIString('Service Workers'), false);
- const icon = UI.Icon.create('mediumicon-service-worker', 'resource-tree-item');
+ super(storagePanel, Common.UIString.UIString('Service Workers'), false);
+ const icon = UI.Icon.Icon.create('mediumicon-service-worker', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
@@ -1182,11 +1192,11 @@
*/
export class AppManifestTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
*/
constructor(storagePanel) {
- super(storagePanel, Common.UIString('Manifest'), false);
- const icon = UI.Icon.create('mediumicon-manifest', 'resource-tree-item');
+ super(storagePanel, Common.UIString.UIString('Manifest'), false);
+ const icon = UI.Icon.Icon.create('mediumicon-manifest', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
@@ -1217,11 +1227,11 @@
*/
export class ClearStorageTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
*/
constructor(storagePanel) {
- super(storagePanel, Common.UIString('Clear storage'), false);
- const icon = UI.Icon.create('mediumicon-clear-storage', 'resource-tree-item');
+ super(storagePanel, Common.UIString.UIString('Clear storage'), false);
+ const icon = UI.Icon.Icon.create('mediumicon-clear-storage', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
@@ -1252,11 +1262,11 @@
*/
export class IndexedDBTreeElement extends StorageCategoryTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
*/
constructor(storagePanel) {
- super(storagePanel, Common.UIString('IndexedDB'), 'IndexedDB');
- const icon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
+ super(storagePanel, Common.UIString.UIString('IndexedDB'), 'IndexedDB');
+ const icon = UI.Icon.Icon.create('mediumicon-database', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
@@ -1299,8 +1309,9 @@
}
_handleContextMenuEvent(event) {
- const contextMenu = new UI.ContextMenu(event);
- contextMenu.defaultSection().appendItem(Common.UIString('Refresh IndexedDB'), this.refreshIndexedDB.bind(this));
+ const contextMenu = new UI.ContextMenu.ContextMenu(event);
+ contextMenu.defaultSection().appendItem(
+ Common.UIString.UIString('Refresh IndexedDB'), this.refreshIndexedDB.bind(this));
contextMenu.show();
}
@@ -1404,7 +1415,7 @@
*/
export class IDBDatabaseTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
* @param {!IndexedDBModel} model
* @param {!DatabaseId} databaseId
*/
@@ -1413,7 +1424,7 @@
this._model = model;
this._databaseId = databaseId;
this._idbObjectStoreTreeElements = {};
- const icon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
+ const icon = UI.Icon.Icon.create('mediumicon-database', 'resource-tree-item');
this.setLeadingIcons([icon]);
this._model.addEventListener(IndexedDBModelEvents.DatabaseNamesRefreshed, this._refreshIndexedDB, this);
}
@@ -1431,8 +1442,9 @@
}
_handleContextMenuEvent(event) {
- const contextMenu = new UI.ContextMenu(event);
- contextMenu.defaultSection().appendItem(Common.UIString('Refresh IndexedDB'), this._refreshIndexedDB.bind(this));
+ const contextMenu = new UI.ContextMenu.ContextMenu(event);
+ contextMenu.defaultSection().appendItem(
+ Common.UIString.UIString('Refresh IndexedDB'), this._refreshIndexedDB.bind(this));
contextMenu.show();
}
@@ -1524,7 +1536,7 @@
export class IDBObjectStoreTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
* @param {!IndexedDBModel} model
* @param {!DatabaseId} databaseId
* @param {!ObjectStore} objectStore
@@ -1537,7 +1549,7 @@
this._objectStore = objectStore;
/** @type {?IDBDataView} */
this._view = null;
- const icon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ const icon = UI.Icon.Icon.create('mediumicon-table', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
@@ -1564,8 +1576,8 @@
}
_handleContextMenuEvent(event) {
- const contextMenu = new UI.ContextMenu(event);
- contextMenu.defaultSection().appendItem(Common.UIString('Clear'), this._clearObjectStore.bind(this));
+ const contextMenu = new UI.ContextMenu.ContextMenu(event);
+ contextMenu.defaultSection().appendItem(Common.UIString.UIString('Clear'), this._clearObjectStore.bind(this));
contextMenu.show();
}
@@ -1630,7 +1642,7 @@
const keyPathString = this._objectStore.keyPathString;
let tooltipString = keyPathString !== null ? ls`Key path: ${keyPathString}` : '';
if (this._objectStore.autoIncrement) {
- tooltipString += '\n' + Common.UIString('autoIncrement');
+ tooltipString += '\n' + Common.UIString.UIString('autoIncrement');
}
this.tooltip = tooltipString;
}
@@ -1676,7 +1688,7 @@
*/
export class IDBIndexTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
* @param {!IndexedDBModel} model
* @param {!DatabaseId} databaseId
* @param {!ObjectStore} objectStore
@@ -1730,10 +1742,10 @@
const keyPathString = this._index.keyPathString;
tooltipLines.push(ls`Key path: ${keyPathString}`);
if (this._index.unique) {
- tooltipLines.push(Common.UIString('unique'));
+ tooltipLines.push(Common.UIString.UIString('unique'));
}
if (this._index.multiEntry) {
- tooltipLines.push(Common.UIString('multiEntry'));
+ tooltipLines.push(Common.UIString.UIString('multiEntry'));
}
this.tooltip = tooltipLines.join('\n');
}
@@ -1766,13 +1778,15 @@
*/
export class DOMStorageTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
* @param {!DOMStorage} domStorage
*/
constructor(storagePanel, domStorage) {
- super(storagePanel, domStorage.securityOrigin ? domStorage.securityOrigin : Common.UIString('Local Files'), false);
+ super(
+ storagePanel, domStorage.securityOrigin ? domStorage.securityOrigin : Common.UIString.UIString('Local Files'),
+ false);
this._domStorage = domStorage;
- const icon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ const icon = UI.Icon.Icon.create('mediumicon-table', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
@@ -1801,24 +1815,24 @@
}
_handleContextMenuEvent(event) {
- const contextMenu = new UI.ContextMenu(event);
- contextMenu.defaultSection().appendItem(Common.UIString('Clear'), () => this._domStorage.clear());
+ const contextMenu = new UI.ContextMenu.ContextMenu(event);
+ contextMenu.defaultSection().appendItem(Common.UIString.UIString('Clear'), () => this._domStorage.clear());
contextMenu.show();
}
}
export class CookieTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
- * @param {!SDK.ResourceTreeFrame} frame
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
+ * @param {!SDK.ResourceTreeModel.ResourceTreeFrame} frame
* @param {string} cookieDomain
*/
constructor(storagePanel, frame, cookieDomain) {
- super(storagePanel, cookieDomain ? cookieDomain : Common.UIString('Local Files'), false);
+ super(storagePanel, cookieDomain ? cookieDomain : Common.UIString.UIString('Local Files'), false);
this._target = frame.resourceTreeModel().target();
this._cookieDomain = cookieDomain;
this.tooltip = ls`Cookies used by frames from ${cookieDomain}`;
- const icon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item');
+ const icon = UI.Icon.Icon.create('mediumicon-cookie', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
@@ -1838,9 +1852,9 @@
* @param {!Event} event
*/
_handleContextMenuEvent(event) {
- const contextMenu = new UI.ContextMenu(event);
+ const contextMenu = new UI.ContextMenu.ContextMenu(event);
contextMenu.defaultSection().appendItem(
- Common.UIString('Clear'), () => this._storagePanel.clearCookies(this._target, this._cookieDomain));
+ Common.UIString.UIString('Clear'), () => this._storagePanel.clearCookies(this._target, this._cookieDomain));
contextMenu.show();
}
@@ -1861,7 +1875,7 @@
*/
export class ApplicationCacheManifestTreeElement extends BaseStorageTreeElement {
constructor(storagePanel, manifestURL) {
- const title = new Common.ParsedURL(manifestURL).displayName;
+ const title = new Common.ParsedURL.ParsedURL(manifestURL).displayName;
super(storagePanel, title, false);
this.tooltip = manifestURL;
this._manifestURL = manifestURL;
@@ -1893,7 +1907,7 @@
export class ApplicationCacheFrameTreeElement extends BaseStorageTreeElement {
/**
* @param {!ApplicationPanelSidebar} sidebar
- * @param {!SDK.ResourceTreeFrame} frame
+ * @param {!SDK.ResourceTreeModel.ResourceTreeFrame} frame
* @param {string} manifestURL
*/
constructor(sidebar, frame, manifestURL) {
@@ -1903,7 +1917,7 @@
this._manifestURL = manifestURL;
this._refreshTitles(frame);
- const icon = UI.Icon.create('largeicon-navigator-folder', 'navigator-tree-item');
+ const icon = UI.Icon.Icon.create('largeicon-navigator-folder', 'navigator-tree-item');
icon.classList.add('navigator-folder-tree-item');
this.setLeadingIcons([icon]);
}
@@ -1921,14 +1935,14 @@
}
/**
- * @param {!SDK.ResourceTreeFrame} frame
+ * @param {!SDK.ResourceTreeModel.ResourceTreeFrame} frame
*/
_refreshTitles(frame) {
this.title = frame.displayName();
}
/**
- * @param {!SDK.ResourceTreeFrame} frame
+ * @param {!SDK.ResourceTreeModel.ResourceTreeFrame} frame
*/
frameNavigated(frame) {
this._refreshTitles(frame);
@@ -1949,12 +1963,12 @@
/**
* @unrestricted
*/
-export class StorageCategoryView extends UI.VBox {
+export class StorageCategoryView extends UI.Widget.VBox {
constructor() {
super();
this.element.classList.add('storage-view');
- this._emptyWidget = new UI.EmptyWidget('');
+ this._emptyWidget = new UI.EmptyWidget.EmptyWidget('');
this._linkElement = null;
this._emptyWidget.show(this.element);
}
@@ -1985,8 +1999,8 @@
export class ResourcesSection {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
- * @param {!UI.TreeElement} treeElement
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
+ * @param {!UI.TreeOutline.TreeElement} treeElement
*/
constructor(storagePanel, treeElement) {
this._panel = storagePanel;
@@ -1996,7 +2010,7 @@
function addListener(eventType, handler, target) {
self.SDK.targetManager.addModelListener(
- SDK.ResourceTreeModel, eventType, event => handler.call(target, event.data));
+ SDK.ResourceTreeModel.ResourceTreeModel, eventType, event => handler.call(target, event.data));
}
addListener(SDK.ResourceTreeModel.Events.FrameAdded, this._frameAdded, this);
addListener(SDK.ResourceTreeModel.Events.FrameNavigated, this._frameNavigated, this);
@@ -2004,7 +2018,7 @@
addListener(SDK.ResourceTreeModel.Events.ResourceAdded, this._resourceAdded, this);
const mainTarget = self.SDK.targetManager.mainTarget();
- const resourceTreeModel = mainTarget && mainTarget.model(SDK.ResourceTreeModel);
+ const resourceTreeModel = mainTarget && mainTarget.model(SDK.ResourceTreeModel.ResourceTreeModel);
const mainFrame = resourceTreeModel && resourceTreeModel.mainFrame;
if (mainFrame) {
this._frameAdded(mainFrame);
@@ -2012,8 +2026,8 @@
}
/**
- * @param {!SDK.ResourceTreeFrame} frame
- * @returns {?SDK.ResourceTreeFrame}
+ * @param {!SDK.ResourceTreeModel.ResourceTreeFrame} frame
+ * @returns {?SDK.ResourceTreeModel.ResourceTreeFrame}
*/
static _getParentFrame(frame) {
const parentFrame = frame.parentFrame;
@@ -2024,11 +2038,11 @@
if (!parentTarget) {
return null;
}
- return parentTarget.model(SDK.ResourceTreeModel).mainFrame;
+ return parentTarget.model(SDK.ResourceTreeModel.ResourceTreeModel).mainFrame;
}
/**
- * @param {?SDK.ResourceTreeFrame} frame
+ * @param {?SDK.ResourceTreeModel.ResourceTreeFrame} frame
* @return {boolean}
*/
_expandFrame(frame) {
@@ -2048,7 +2062,7 @@
}
/**
- * @param {!SDK.Resource} resource
+ * @param {!SDK.Resource.Resource} resource
* @param {number=} line
* @param {number=} column
* @return {!Promise}
@@ -2064,7 +2078,7 @@
}
/**
- * @param {!SDK.ResourceTreeFrame} frame
+ * @param {!SDK.ResourceTreeModel.ResourceTreeFrame} frame
*/
_frameAdded(frame) {
const parentFrame = ResourcesSection._getParentFrame(frame);
@@ -2078,7 +2092,7 @@
}
/**
- * @param {!SDK.ResourceTreeFrame} frame
+ * @param {!SDK.ResourceTreeModel.ResourceTreeFrame} frame
*/
_frameDetached(frame) {
const frameTreeElement = this._treeElementForFrameId.get(frame.id);
@@ -2093,7 +2107,7 @@
}
/**
- * @param {!SDK.ResourceTreeFrame} frame
+ * @param {!SDK.ResourceTreeModel.ResourceTreeFrame} frame
*/
_frameNavigated(frame) {
const frameTreeElement = this._treeElementForFrameId.get(frame.id);
@@ -2103,7 +2117,7 @@
}
/**
- * @param {!SDK.Resource} resource
+ * @param {!SDK.Resource.Resource} resource
*/
_resourceAdded(resource) {
const frameTreeElement = this._treeElementForFrameId.get(resource.frameId);
@@ -2124,7 +2138,7 @@
export class FrameTreeElement extends BaseStorageTreeElement {
/**
* @param {!ResourcesSection} section
- * @param {!SDK.ResourceTreeFrame} frame
+ * @param {!SDK.ResourceTreeModel.ResourceTreeFrame} frame
*/
constructor(section, frame) {
super(section._panel, '', false);
@@ -2137,13 +2151,13 @@
this.setExpandable(true);
this.frameNavigated(frame);
- const icon = UI.Icon.create('largeicon-navigator-frame', 'navigator-tree-item');
+ const icon = UI.Icon.Icon.create('largeicon-navigator-frame', 'navigator-tree-item');
icon.classList.add('navigator-frame-tree-item');
this.setLeadingIcons([icon]);
}
/**
- * @param {!SDK.ResourceTreeFrame} frame
+ * @param {!SDK.ResourceTreeModel.ResourceTreeFrame} frame
*/
frameNavigated(frame) {
this.invalidateChildren();
@@ -2167,7 +2181,7 @@
this._section._panel.showCategoryView(this.titleAsText(), null);
this.listItemElement.classList.remove('hovered');
- SDK.OverlayModel.hideDOMNodeHighlight();
+ SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight();
return false;
}
@@ -2177,12 +2191,12 @@
this._frame.resourceTreeModel().domModel().overlayModel().highlightFrame(this._frameId);
} else {
this.listItemElement.classList.remove('hovered');
- SDK.OverlayModel.hideDOMNodeHighlight();
+ SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight();
}
}
/**
- * @param {!SDK.Resource} resource
+ * @param {!SDK.Resource.Resource} resource
*/
appendResource(resource) {
if (!this._populated) {
@@ -2195,7 +2209,8 @@
const resourceType = resource.resourceType();
const categoryName = resourceType.name();
- let categoryElement = resourceType === Common.resourceTypes.Document ? this : this._categoryElements[categoryName];
+ let categoryElement =
+ resourceType === Common.ResourceType.resourceTypes.Document ? this : this._categoryElements[categoryName];
if (!categoryElement) {
categoryElement =
new StorageCategoryTreeElement(this._section._panel, resource.resourceType().category().title, categoryName);
@@ -2209,7 +2224,7 @@
/**
* @param {string} url
- * @return {?SDK.Resource}
+ * @return {?SDK.Resource.Resource}
*/
resourceByURL(url) {
const treeElement = this._treeElementForResource[url];
@@ -2218,7 +2233,7 @@
/**
* @override
- * @param {!UI.TreeElement} treeElement
+ * @param {!UI.TreeOutline.TreeElement} treeElement
*/
appendChild(treeElement) {
if (!this._populated) {
@@ -2281,27 +2296,27 @@
export class FrameResourceTreeElement extends BaseStorageTreeElement {
/**
- * @param {!UI.PanelWithSidebar} storagePanel
- * @param {!SDK.Resource} resource
+ * @param {!UI.Panel.PanelWithSidebar} storagePanel
+ * @param {!SDK.Resource.Resource} resource
*/
constructor(storagePanel, resource) {
super(storagePanel, resource.displayName, false);
this._panel = storagePanel;
- /** @type {!SDK.Resource} */
+ /** @type {!SDK.Resource.Resource} */
this._resource = resource;
- /** @type {?Promise<!UI.Widget>} */
+ /** @type {?Promise<!UI.Widget.Widget>} */
this._previewPromise = null;
this.tooltip = resource.url;
this._resource[FrameResourceTreeElement._symbol] = this;
- const icon = UI.Icon.create('largeicon-navigator-file', 'navigator-tree-item');
+ const icon = UI.Icon.Icon.create('largeicon-navigator-file', 'navigator-tree-item');
icon.classList.add('navigator-file-tree-item');
icon.classList.add('navigator-' + resource.resourceType().name() + '-tree-item');
this.setLeadingIcons([icon]);
}
/**
- * @param {!SDK.Resource} resource
+ * @param {!SDK.Resource.Resource} resource
*/
static forResource(resource) {
return resource[FrameResourceTreeElement._symbol];
@@ -2312,18 +2327,19 @@
}
/**
- * @return {!Promise<!UI.Widget>}
+ * @return {!Promise<!UI.Widget.Widget>}
*/
_preparePreview() {
if (this._previewPromise) {
return this._previewPromise;
}
- const viewPromise = SourceFrame.PreviewFactory.createPreview(this._resource, this._resource.mimeType);
+ const viewPromise =
+ SourceFrame.PreviewFactory.PreviewFactory.createPreview(this._resource, this._resource.mimeType);
this._previewPromise = viewPromise.then(view => {
if (view) {
return view;
}
- return new UI.EmptyWidget(this._resource.url);
+ return new UI.EmptyWidget.EmptyWidget(this._resource.url);
});
return this._previewPromise;
}
@@ -2344,7 +2360,7 @@
* @return {boolean}
*/
ondblclick(event) {
- Host.InspectorFrontendHost.openInNewTab(this._resource.url);
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(this._resource.url);
return false;
}
@@ -2369,7 +2385,7 @@
}
_handleContextMenuEvent(event) {
- const contextMenu = new UI.ContextMenu(event);
+ const contextMenu = new UI.ContextMenu.ContextMenu(event);
contextMenu.appendApplicableItems(this._resource);
contextMenu.show();
}
@@ -2381,7 +2397,7 @@
async revealResource(line, column) {
this.revealAndSelect(true);
const view = await this._panel.scheduleShowView(this._preparePreview());
- if (!(view instanceof SourceFrame.ResourceSourceFrame) || typeof line !== 'number') {
+ if (!(view instanceof SourceFrame.ResourceSourceFrame.ResourceSourceFrame) || typeof line !== 'number') {
return;
}
view.revealPosition(line, column, true);
diff --git a/front_end/resources/BackgroundServiceModel.js b/front_end/resources/BackgroundServiceModel.js
index 40e6ffa..9994f42 100644
--- a/front_end/resources/BackgroundServiceModel.js
+++ b/front_end/resources/BackgroundServiceModel.js
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as SDK from '../sdk/sdk.js';
+
/**
* @implements {Protocol.BackgroundServiceDispatcher}
* @unrestricted
*/
-export class BackgroundServiceModel extends SDK.SDKModel {
+export class BackgroundServiceModel extends SDK.SDKModel.SDKModel {
/**
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
*/
constructor(target) {
super(target);
@@ -70,7 +72,7 @@
}
}
-SDK.SDKModel.register(BackgroundServiceModel, SDK.Target.Capability.Browser, false);
+SDK.SDKModel.SDKModel.register(BackgroundServiceModel, SDK.SDKModel.Capability.Browser, false);
/** @enum {symbol} */
export const Events = {
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}
*/
diff --git a/front_end/resources/ClearStorageView.js b/front_end/resources/ClearStorageView.js
index 6692736..2669d69 100644
--- a/front_end/resources/ClearStorageView.js
+++ b/front_end/resources/ClearStorageView.js
@@ -2,15 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as Common from '../common/common.js';
+import * as ProtocolModule from '../protocol/protocol.js';
+import * as SDK from '../sdk/sdk.js';
+import * as UI from '../ui/ui.js';
+
import {ApplicationCacheModel} from './ApplicationCacheModel.js';
import {DatabaseModel} from './DatabaseModel.js';
import {DOMStorageModel} from './DOMStorageModel.js';
import {IndexedDBModel} from './IndexedDBModel.js';
/**
- * @implements {SDK.TargetManager.Observer}
+ * @implements {SDK.SDKModel.Observer}
*/
-export class ClearStorageView extends UI.ThrottledWidget {
+export class ClearStorageView extends UI.ThrottledWidget.ThrottledWidget {
constructor() {
super(true, 1000);
const types = Protocol.Storage.StorageType;
@@ -24,11 +29,11 @@
[types.Websql, 'rgb(203, 220, 56)'], // lime
]);
- this._reportView = new UI.ReportView(Common.UIString('Clear storage'));
+ this._reportView = new UI.ReportView.ReportView(Common.UIString.UIString('Clear storage'));
this._reportView.registerRequiredCSS('resources/clearStorageView.css');
this._reportView.element.classList.add('clear-storage-header');
this._reportView.show(this.contentElement);
- /** @type {?SDK.Target} */
+ /** @type {?SDK.SDKModel.Target} */
this._target = null;
/** @type {?string} */
this._securityOrigin = null;
@@ -38,10 +43,10 @@
this._settings.set(type, self.Common.settings.createSetting('clear-storage-' + type, true));
}
- const quota = this._reportView.appendSection(Common.UIString('Usage'));
+ const quota = this._reportView.appendSection(Common.UIString.UIString('Usage'));
this._quotaRow = quota.appendSelectableRow();
const learnMoreRow = quota.appendRow();
- const learnMore = UI.XLink.create(
+ const learnMore = UI.XLink.XLink.create(
'https://developers.google.com/web/tools/chrome-devtools/progressive-web-apps#opaque-responses',
ls`Learn more`);
learnMoreRow.appendChild(learnMore);
@@ -53,23 +58,23 @@
usageBreakdownRow.appendChild(this._pieChart.element);
const clearButtonSection = this._reportView.appendSection('', 'clear-storage-button').appendRow();
- this._clearButton = UI.createTextButton(ls`Clear site data`, this._clear.bind(this));
+ this._clearButton = UI.UIUtils.createTextButton(ls`Clear site data`, this._clear.bind(this));
clearButtonSection.appendChild(this._clearButton);
- const application = this._reportView.appendSection(Common.UIString('Application'));
- this._appendItem(application, Common.UIString('Unregister service workers'), 'service_workers');
+ const application = this._reportView.appendSection(Common.UIString.UIString('Application'));
+ this._appendItem(application, Common.UIString.UIString('Unregister service workers'), 'service_workers');
application.markFieldListAsGroup();
- const storage = this._reportView.appendSection(Common.UIString('Storage'));
- this._appendItem(storage, Common.UIString('Local and session storage'), 'local_storage');
- this._appendItem(storage, Common.UIString('IndexedDB'), 'indexeddb');
- this._appendItem(storage, Common.UIString('Web SQL'), 'websql');
- this._appendItem(storage, Common.UIString('Cookies'), 'cookies');
+ const storage = this._reportView.appendSection(Common.UIString.UIString('Storage'));
+ this._appendItem(storage, Common.UIString.UIString('Local and session storage'), 'local_storage');
+ this._appendItem(storage, Common.UIString.UIString('IndexedDB'), 'indexeddb');
+ this._appendItem(storage, Common.UIString.UIString('Web SQL'), 'websql');
+ this._appendItem(storage, Common.UIString.UIString('Cookies'), 'cookies');
storage.markFieldListAsGroup();
- const caches = this._reportView.appendSection(Common.UIString('Cache'));
- this._appendItem(caches, Common.UIString('Cache storage'), 'cache_storage');
- this._appendItem(caches, Common.UIString('Application cache'), 'appcache');
+ const caches = this._reportView.appendSection(Common.UIString.UIString('Cache'));
+ this._appendItem(caches, Common.UIString.UIString('Cache storage'), 'cache_storage');
+ this._appendItem(caches, Common.UIString.UIString('Application cache'), 'appcache');
caches.markFieldListAsGroup();
self.SDK.targetManager.observeTargets(this);
@@ -87,14 +92,14 @@
/**
* @override
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
*/
targetAdded(target) {
if (this._target) {
return;
}
this._target = target;
- const securityOriginManager = target.model(SDK.SecurityOriginManager);
+ const securityOriginManager = target.model(SDK.SecurityOriginManager.SecurityOriginManager);
this._updateOrigin(
securityOriginManager.mainSecurityOrigin(), securityOriginManager.unreachableMainSecurityOrigin());
securityOriginManager.addEventListener(
@@ -103,13 +108,13 @@
/**
* @override
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
*/
targetRemoved(target) {
if (this._target !== target) {
return;
}
- const securityOriginManager = target.model(SDK.SecurityOriginManager);
+ const securityOriginManager = target.model(SDK.SecurityOriginManager.SecurityOriginManager);
securityOriginManager.removeEventListener(
SDK.SecurityOriginManager.Events.MainSecurityOriginChanged, this._originChanged, this);
}
@@ -156,7 +161,7 @@
this._clearButton.disabled = true;
const label = this._clearButton.textContent;
- this._clearButton.textContent = Common.UIString('Clearing...');
+ this._clearButton.textContent = Common.UIString.UIString('Clearing...');
setTimeout(() => {
this._clearButton.disabled = false;
this._clearButton.textContent = label;
@@ -165,7 +170,7 @@
}
/**
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
* @param {string} securityOrigin
* @param {!Array<string>} selectedStorageTypes
*/
@@ -175,7 +180,7 @@
const set = new Set(selectedStorageTypes);
const hasAll = set.has(Protocol.Storage.StorageType.All);
if (set.has(Protocol.Storage.StorageType.Cookies) || hasAll) {
- const cookieModel = target.model(SDK.CookieModel);
+ const cookieModel = target.model(SDK.CookieModel.CookieModel);
if (cookieModel) {
cookieModel.clear();
}
@@ -207,7 +212,7 @@
if (set.has(Protocol.Storage.StorageType.Cache_storage) || hasAll) {
const target = self.SDK.targetManager.mainTarget();
- const model = target && target.model(SDK.ServiceWorkerCacheModel);
+ const model = target && target.model(SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel);
if (model) {
model.clearForOrigin(securityOrigin);
}
@@ -232,17 +237,17 @@
const securityOrigin = /** @type {string} */ (this._securityOrigin);
const response = await this._target.storageAgent().invoke_getUsageAndQuota({origin: securityOrigin});
- if (response[Protocol.Error]) {
- this._quotaRow.textContent = '';
+ if (response[ProtocolModule.InspectorBackend.ProtocolError]) {
+ this._quotaRow.textContet = '';
this._resetPieChart(0);
return;
}
- this._quotaRow.textContent = Common.UIString(
+ this._quotaRow.textContent = Common.UIString.UIString(
'%s used out of %s storage quota.\xA0', Number.bytesToString(response.usage),
Number.bytesToString(response.quota));
if (response.quota < 125829120) { // 120 MB
this._quotaRow.title = ls`Storage quota is limited in Incognito mode`;
- this._quotaRow.appendChild(UI.Icon.create('smallicon-info'));
+ this._quotaRow.appendChild(UI.Icon.Icon.create('smallicon-info'));
}
if (!this._quotaUsage || this._quotaUsage !== response.usage) {
@@ -277,19 +282,19 @@
_getStorageTypeName(type) {
switch (type) {
case Protocol.Storage.StorageType.File_systems:
- return Common.UIString('File System');
+ return Common.UIString.UIString('File System');
case Protocol.Storage.StorageType.Websql:
- return Common.UIString('Web SQL');
+ return Common.UIString.UIString('Web SQL');
case Protocol.Storage.StorageType.Appcache:
- return Common.UIString('Application Cache');
+ return Common.UIString.UIString('Application Cache');
case Protocol.Storage.StorageType.Indexeddb:
- return Common.UIString('IndexedDB');
+ return Common.UIString.UIString('IndexedDB');
case Protocol.Storage.StorageType.Cache_storage:
- return Common.UIString('Cache Storage');
+ return Common.UIString.UIString('Cache Storage');
case Protocol.Storage.StorageType.Service_workers:
- return Common.UIString('Service Workers');
+ return Common.UIString.UIString('Service Workers');
default:
- return Common.UIString('Other');
+ return Common.UIString.UIString('Other');
}
}
@@ -310,12 +315,12 @@
];
/**
- * @implements {UI.ActionDelegate}
+ * @implements {UI.ActionDelegate.ActionDelegate}
*/
export class ActionDelegate {
/**
* @override
- * @param {!UI.Context} context
+ * @param {!UI.Context.Context} context
* @param {string} actionId
* @return {boolean}
*/
@@ -335,7 +340,7 @@
if (!target) {
return false;
}
- const resourceTreeModel = target.model(SDK.ResourceTreeModel);
+ const resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
if (!resourceTreeModel) {
return false;
}
diff --git a/front_end/resources/CookieItemsView.js b/front_end/resources/CookieItemsView.js
index 44dee47..02464d7 100644
--- a/front_end/resources/CookieItemsView.js
+++ b/front_end/resources/CookieItemsView.js
@@ -27,15 +27,19 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
+import * as SDK from '../sdk/sdk.js';
+import * as UI from '../ui/ui.js';
+
import {StorageItemsView} from './StorageItemsView.js';
export class CookieItemsView extends StorageItemsView {
/**
- * @param {!SDK.CookieModel} model
+ * @param {!SDK.CookieModel.CookieModel} model
* @param {string} cookieDomain
*/
constructor(model, cookieDomain) {
- super(Common.UIString('Cookies'), 'cookiesPanel');
+ super(Common.UIString.UIString('Cookies'), 'cookiesPanel');
this.registerRequiredCSS('resources/cookieItemsView.css');
this.element.classList.add('storage-view');
@@ -51,48 +55,48 @@
this._cookiesTable.setMinimumSize(0, 50);
- this._splitWidget =
- new UI.SplitWidget(/* isVertical: */ false, /* secondIsSidebar: */ true, 'cookieItemsSplitViewState');
+ this._splitWidget = new UI.SplitWidget.SplitWidget(
+ /* isVertical: */ false, /* secondIsSidebar: */ true, 'cookieItemsSplitViewState');
this._splitWidget.show(this.element);
- this._previewPanel = new UI.VBox();
+ this._previewPanel = new UI.Widget.VBox();
const resizer = this._previewPanel.element.createChild('div', 'preview-panel-resizer');
this._splitWidget.setMainWidget(this._cookiesTable);
this._splitWidget.setSidebarWidget(this._previewPanel);
this._splitWidget.installResizer(resizer);
- this._onlyIssuesFilterUI = new UI.ToolbarCheckbox(ls`Only blocked`, ls`Only show blocked Cookies`, () => {
+ this._onlyIssuesFilterUI = new UI.Toolbar.ToolbarCheckbox(ls`Only blocked`, ls`Only show blocked Cookies`, () => {
this._updateWithCookies(this._allCookies);
});
this.appendToolbarItem(this._onlyIssuesFilterUI);
- this._refreshThrottler = new Common.Throttler(300);
+ this._refreshThrottler = new Common.Throttler.Throttler(300);
/** @type {!Array<!Common.EventTarget.EventDescriptor>} */
this._eventDescriptors = [];
- /** @type {?UI.Widget} */
+ /** @type {?UI.Widget.Widget} */
this._preview = null;
- /** @type {?SDK.Cookie} */
+ /** @type {?SDK.Cookie.Cookie} */
this._previewValue = null;
- /** @type {!Array<!SDK.Cookie>} */
+ /** @type {!Array<!SDK.Cookie.Cookie>} */
this._allCookies = [];
this.setCookiesDomain(model, cookieDomain);
}
/**
- * @param {!SDK.CookieModel} model
+ * @param {!SDK.CookieModel.CookieModel} model
* @param {string} domain
*/
setCookiesDomain(model, domain) {
this._model = model;
this._cookieDomain = domain;
this.refreshItems();
- Common.EventTarget.removeEventListeners(this._eventDescriptors);
- const networkManager = model.target().model(SDK.NetworkManager);
+ Common.EventTarget.EventTarget.removeEventListeners(this._eventDescriptors);
+ const networkManager = model.target().model(SDK.NetworkManager.NetworkManager);
this._eventDescriptors = [
networkManager.addEventListener(SDK.NetworkManager.Events.ResponseReceived, this._onResponseReceived, this),
networkManager.addEventListener(SDK.NetworkManager.Events.LoadingFinished, this._onLoadingFinished, this),
@@ -102,8 +106,8 @@
}
/**
- * @param {?UI.Widget} preview
- * @param {?SDK.Cookie} value
+ * @param {?UI.Widget.Widget} preview
+ * @param {?SDK.Cookie.Cookie} value
*/
_showPreview(preview, value) {
if (this._preview && this._previewValue === value) {
@@ -115,7 +119,7 @@
}
if (!preview) {
- preview = new UI.EmptyWidget(ls`Select a cookie to preview its value`);
+ preview = new UI.EmptyWidget.EmptyWidget(ls`Select a cookie to preview its value`);
}
this._previewValue = value;
@@ -137,7 +141,7 @@
value.textContent = cookie.value();
value.addEventListener('dblclick', handleDblClickOnCookieValue);
- const preview = new UI.VBox();
+ const preview = new UI.Widget.VBox();
preview.contentElement.appendChild(value);
this._showPreview(preview, cookie);
@@ -154,8 +158,8 @@
}
/**
- * @param {!SDK.Cookie} newCookie
- * @param {?SDK.Cookie} oldCookie
+ * @param {!SDK.Cookie.Cookie} newCookie
+ * @param {?SDK.Cookie.Cookie} oldCookie
* @return {!Promise<boolean>}
*/
_saveCookie(newCookie, oldCookie) {
@@ -169,7 +173,7 @@
}
/**
- * @param {!SDK.Cookie} cookie
+ * @param {!SDK.Cookie.Cookie} cookie
* @param {function()} callback
*/
_deleteCookie(cookie, callback) {
@@ -177,13 +181,13 @@
}
/**
- * @param {!Array<!SDK.Cookie>} allCookies
+ * @param {!Array<!SDK.Cookie.Cookie>} allCookies
*/
_updateWithCookies(allCookies) {
this._allCookies = allCookies;
this._totalSize = allCookies.reduce((size, cookie) => size + cookie.size(), 0);
- const parsedURL = Common.ParsedURL.fromString(this._cookieDomain);
+ const parsedURL = Common.ParsedURL.ParsedURL.fromString(this._cookieDomain);
const host = parsedURL ? parsedURL.host : '';
this._cookiesTable.setCookieDomain(host);
@@ -203,7 +207,7 @@
*/
filter(items, keyFunction) {
return super.filter(items, keyFunction)
- .filter(cookie => !this._onlyIssuesFilterUI.checked() || SDK.IssuesModel.hasIssues(cookie));
+ .filter(cookie => !this._onlyIssuesFilterUI.checked() || SDK.IssuesModel.IssuesModel.hasIssues(cookie));
}
/**
diff --git a/front_end/resources/DOMStorageItemsView.js b/front_end/resources/DOMStorageItemsView.js
index b17e715..2cdf627 100644
--- a/front_end/resources/DOMStorageItemsView.js
+++ b/front_end/resources/DOMStorageItemsView.js
@@ -24,6 +24,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
+import * as DataGrid from '../data_grid/data_grid.js';
+import * as SourceFrame from '../source_frame/source_frame.js';
+import * as UI from '../ui/ui.js';
+
import {DOMStorage} from './DOMStorageModel.js';
import {StorageItemsView} from './StorageItemsView.js';
@@ -32,17 +37,24 @@
* @param {!DOMStorage} domStorage
*/
constructor(domStorage) {
- super(Common.UIString('DOM Storage'), 'domStoragePanel');
+ super(Common.UIString.UIString('DOM Storage'), 'domStoragePanel');
this._domStorage = domStorage;
this.element.classList.add('storage-view', 'table');
const columns = /** @type {!Array<!DataGrid.ColumnDescriptor>} */ ([
- {id: 'key', title: Common.UIString('Key'), sortable: false, editable: true, longText: true, weight: 50},
- {id: 'value', title: Common.UIString('Value'), sortable: false, editable: true, longText: true, weight: 50}
+ {id: 'key', title: Common.UIString.UIString('Key'), sortable: false, editable: true, longText: true, weight: 50},
+ {
+ id: 'value',
+ title: Common.UIString.UIString('Value'),
+ sortable: false,
+ editable: true,
+ longText: true,
+ weight: 50
+ }
]);
- this._dataGrid = new DataGrid.DataGrid({
+ this._dataGrid = new DataGrid.DataGrid.DataGridImpl({
displayName: ls`DOM Storage Items`,
columns,
editCallback: this._editingCallback.bind(this),
@@ -51,16 +63,16 @@
});
this._dataGrid.addEventListener(
DataGrid.DataGrid.Events.SelectedNode,
- event => this._previewEntry(/** @type {!DataGrid.DataGridNode} */ (event.data)));
+ event => this._previewEntry(/** @type {!DataGrid.DataGrid.DataGridNode} */ (event.data)));
this._dataGrid.addEventListener(DataGrid.DataGrid.Events.DeselectedNode, event => this._previewEntry(null));
this._dataGrid.setStriped(true);
this._dataGrid.setName('DOMStorageItemsView');
- this._splitWidget =
- new UI.SplitWidget(/* isVertical: */ false, /* secondIsSidebar: */ true, 'domStorageSplitViewState');
+ this._splitWidget = new UI.SplitWidget.SplitWidget(
+ /* isVertical: */ false, /* secondIsSidebar: */ true, 'domStorageSplitViewState');
this._splitWidget.show(this.element);
- this._previewPanel = new UI.VBox();
+ this._previewPanel = new UI.Widget.VBox();
this._previewPanel.setMinimumSize(0, 50);
const resizer = this._previewPanel.element.createChild('div', 'preview-panel-resizer');
const dataGridWidget = this._dataGrid.asWidget();
@@ -69,7 +81,7 @@
this._splitWidget.setSidebarWidget(this._previewPanel);
this._splitWidget.installResizer(resizer);
- /** @type {?UI.Widget} */
+ /** @type {?UI.Widget.Widget} */
this._preview = null;
/** @type {?string} */
this._previewValue = null;
@@ -84,7 +96,7 @@
* @param {!DOMStorage} domStorage
*/
setStorage(domStorage) {
- Common.EventTarget.removeEventListeners(this._eventListeners);
+ Common.EventTarget.EventTarget.removeEventListeners(this._eventListeners);
this._domStorage = domStorage;
this._eventListeners = [
this._domStorage.addEventListener(DOMStorage.Events.DOMStorageItemsCleared, this._domStorageItemsCleared, this),
@@ -145,7 +157,7 @@
}
}
- const childNode = new DataGrid.DataGridNode({key: storageData.key, value: storageData.value}, false);
+ const childNode = new DataGrid.DataGrid.DataGridNode({key: storageData.key, value: storageData.value}, false);
rootNode.insertChild(childNode, children.length - 1);
}
@@ -191,7 +203,7 @@
for (const item of this.filter(items, filteredItems)) {
const key = item[0];
const value = item[1];
- const node = new DataGrid.DataGridNode({key: key, value: value}, false);
+ const node = new DataGrid.DataGrid.DataGridNode({key: key, value: value}, false);
node.selectable = true;
rootNode.appendChild(node);
if (!selectedNode || key === selectedKey) {
@@ -246,7 +258,7 @@
}
/**
- * @param {!DataGrid.DataGridNode} masterNode
+ * @param {!DataGrid.DataGrid.DataGridNode} masterNode
*/
_removeDupes(masterNode) {
const rootNode = this._dataGrid.rootNode();
@@ -270,7 +282,7 @@
}
/**
- * @param {?UI.Widget} preview
+ * @param {?UI.Widget.Widget} preview
* @param {?string} value
*/
_showPreview(preview, value) {
@@ -281,7 +293,7 @@
this._preview.detach();
}
if (!preview) {
- preview = new UI.EmptyWidget(Common.UIString('Select a value to preview'));
+ preview = new UI.EmptyWidget.EmptyWidget(Common.UIString.UIString('Select a value to preview'));
}
this._previewValue = value;
this._preview = preview;
@@ -289,7 +301,7 @@
}
/**
- * @param {?DataGrid.DataGridNode} entry
+ * @param {?DataGrid.DataGrid.DataGridNode} entry
*/
async _previewEntry(entry) {
const value = entry && entry.data && entry.data.value;
@@ -299,9 +311,9 @@
}
const protocol = this._domStorage.isLocalStorage ? 'localstorage' : 'sessionstorage';
const url = `${protocol}://${entry.key}`;
- const provider =
- Common.StaticContentProvider.fromString(url, Common.resourceTypes.XHR, /** @type {string} */ (value));
- const preview = await SourceFrame.PreviewFactory.createPreview(provider, 'text/plain');
+ const provider = Common.StaticContentProvider.StaticContentProvider.fromString(
+ url, Common.ResourceType.resourceTypes.XHR, /** @type {string} */ (value));
+ const preview = await SourceFrame.PreviewFactory.PreviewFactory.createPreview(provider, 'text/plain');
// Selection could've changed while the preview was loaded
if (!entry.selected) {
return;
diff --git a/front_end/resources/DOMStorageModel.js b/front_end/resources/DOMStorageModel.js
index 51d5cac..ccccaf1 100644
--- a/front_end/resources/DOMStorageModel.js
+++ b/front_end/resources/DOMStorageModel.js
@@ -27,10 +27,13 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
+import * as SDK from '../sdk/sdk.js';
+
/**
* @unrestricted
*/
-export class DOMStorage extends Common.Object {
+export class DOMStorage extends Common.ObjectWrapper.ObjectWrapper {
/**
* @param {!DOMStorageModel} model
* @param {string} securityOrigin
@@ -106,14 +109,14 @@
/**
* @unrestricted
*/
-export class DOMStorageModel extends SDK.SDKModel {
+export class DOMStorageModel extends SDK.SDKModel.SDKModel {
/**
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
*/
constructor(target) {
super(target);
- this._securityOriginManager = target.model(SDK.SecurityOriginManager);
+ this._securityOriginManager = target.model(SDK.SecurityOriginManager.SecurityOriginManager);
/** @type {!Object.<string, !DOMStorage>} */
this._storages = {};
this._agent = target.domstorageAgent();
@@ -165,7 +168,7 @@
* @param {string} securityOrigin
*/
_addOrigin(securityOrigin) {
- const parsed = new Common.ParsedURL(securityOrigin);
+ const parsed = new Common.ParsedURL.ParsedURL(securityOrigin);
// These are "opaque" origins which are not supposed to support DOM storage.
if (!parsed.isValid || parsed.scheme === 'data' || parsed.scheme === 'about' || parsed.scheme === 'javascript') {
return;
@@ -289,7 +292,7 @@
}
}
-SDK.SDKModel.register(DOMStorageModel, SDK.Target.Capability.DOM, false);
+SDK.SDKModel.SDKModel.register(DOMStorageModel, SDK.SDKModel.Capability.DOM, false);
/** @enum {symbol} */
export const Events = {
diff --git a/front_end/resources/DatabaseModel.js b/front_end/resources/DatabaseModel.js
index e045011..49985c9 100644
--- a/front_end/resources/DatabaseModel.js
+++ b/front_end/resources/DatabaseModel.js
@@ -26,6 +26,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
+import * as ProtocolModule from '../protocol/protocol.js';
+import * as SDK from '../sdk/sdk.js';
+
/**
* @unrestricted
*/
@@ -95,7 +99,7 @@
*/
async executeSql(query, onSuccess, onError) {
const response = await this._model._agent.invoke_executeSQL({'databaseId': this._id, 'query': query});
- const error = response[Protocol.Error];
+ const error = response[ProtocolModule.InspectorBackend.ProtocolError];
if (error) {
onError(error);
return;
@@ -109,9 +113,9 @@
if (sqlError.message) {
message = sqlError.message;
} else if (sqlError.code === 2) {
- message = Common.UIString('Database no longer has expected version.');
+ message = Common.UIString.UIString('Database no longer has expected version.');
} else {
- message = Common.UIString('An unexpected error %s occurred.', sqlError.code);
+ message = Common.UIString.UIString('An unexpected error %s occurred.', sqlError.code);
}
onError(message);
}
@@ -120,9 +124,9 @@
/**
* @unrestricted
*/
-export class DatabaseModel extends SDK.SDKModel {
+export class DatabaseModel extends SDK.SDKModel.SDKModel {
/**
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
*/
constructor(target) {
super(target);
@@ -170,7 +174,7 @@
}
}
-SDK.SDKModel.register(DatabaseModel, SDK.Target.Capability.DOM, false);
+SDK.SDKModel.SDKModel.register(DatabaseModel, SDK.SDKModel.Capability.DOM, false);
/** @enum {symbol} */
export const Events = {
diff --git a/front_end/resources/DatabaseQueryView.js b/front_end/resources/DatabaseQueryView.js
index 9489470..3aec1a4 100644
--- a/front_end/resources/DatabaseQueryView.js
+++ b/front_end/resources/DatabaseQueryView.js
@@ -23,10 +23,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as DataGrid from '../data_grid/data_grid.js';
+import * as UI from '../ui/ui.js';
+
/**
* @unrestricted
*/
-export class DatabaseQueryView extends UI.VBox {
+export class DatabaseQueryView extends UI.Widget.VBox {
constructor(database) {
super();
@@ -42,12 +45,12 @@
this._queryWrapper.tabIndex = -1;
this._promptContainer = this.element.createChild('div', 'database-query-prompt-container');
- this._promptContainer.appendChild(UI.Icon.create('smallicon-text-prompt', 'prompt-icon'));
+ this._promptContainer.appendChild(UI.Icon.Icon.create('smallicon-text-prompt', 'prompt-icon'));
this._promptElement = this._promptContainer.createChild('div');
this._promptElement.className = 'database-query-prompt';
this._promptElement.addEventListener('keydown', this._promptKeyDown.bind(this));
- this._prompt = new UI.TextPrompt();
+ this._prompt = new UI.TextPrompt.TextPrompt();
this._prompt.initialize(this.completions.bind(this), ' ');
this._proxyElement = this._prompt.attach(this._promptElement);
@@ -56,6 +59,10 @@
/** @type {!Array<!Element>} */
this._queryResults = [];
this._virtualSelectedIndex = -1;
+ /** @type {?Element} */
+ this._lastSelectedElement;
+ /** @type {number} */
+ this._selectionTimeout = 0;
}
_messagesClicked() {
@@ -69,7 +76,7 @@
* @param {!Event} event
*/
_onKeyDown(event) {
- if (UI.isEditing() || !this._queryResults.length || event.shiftKey) {
+ if (UI.UIUtils.isEditing() || !this._queryResults.length || event.shiftKey) {
return;
}
switch (event.key) {
@@ -230,7 +237,7 @@
}
_queryFinished(query, columnNames, values) {
- const dataGrid = DataGrid.SortableDataGrid.create(columnNames, values, ls`Database Query`);
+ const dataGrid = DataGrid.SortableDataGrid.SortableDataGrid.create(columnNames, values, ls`Database Query`);
const trimmedQuery = query.trim();
let view = null;
@@ -250,7 +257,7 @@
/**
* @param {string} query
- * @param {?UI.Widget} view
+ * @param {?UI.Widget.Widget} view
*/
_appendViewQueryResult(query, view) {
const resultElement = this._appendQueryResult(query);
@@ -270,7 +277,7 @@
_appendErrorQueryResult(query, errorText) {
const resultElement = this._appendQueryResult(query);
resultElement.classList.add('error');
- resultElement.appendChild(UI.Icon.create('smallicon-error', 'prompt-icon'));
+ resultElement.appendChild(UI.Icon.Icon.create('smallicon-error', 'prompt-icon'));
resultElement.createTextChild(errorText);
this._scrollResultIntoView();
@@ -293,7 +300,7 @@
this._queryResults.push(element);
this._updateFocusedItem();
- element.appendChild(UI.Icon.create('smallicon-user-command', 'prompt-icon'));
+ element.appendChild(UI.Icon.Icon.create('smallicon-user-command', 'prompt-icon'));
const commandTextElement = createElement('span');
commandTextElement.className = 'database-query-text';
diff --git a/front_end/resources/DatabaseTableView.js b/front_end/resources/DatabaseTableView.js
index fbe7f42..b9681bf 100644
--- a/front_end/resources/DatabaseTableView.js
+++ b/front_end/resources/DatabaseTableView.js
@@ -23,12 +23,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
+import * as DataGrid from '../data_grid/data_grid.js';
+import * as UI from '../ui/ui.js';
+
/**
* @unrestricted
*/
-export class DatabaseTableView extends UI.SimpleView {
+export class DatabaseTableView extends UI.View.SimpleView {
constructor(database, tableName) {
- super(Common.UIString('Database'));
+ super(Common.UIString.UIString('Database'));
this.database = database;
this.tableName = tableName;
@@ -37,10 +41,14 @@
this._visibleColumnsSetting = self.Common.settings.createSetting('databaseTableViewVisibleColumns', {});
- this.refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'largeicon-refresh');
- this.refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this._refreshButtonClicked, this);
- this._visibleColumnsInput = new UI.ToolbarInput(Common.UIString('Visible columns'), '', 1);
- this._visibleColumnsInput.addEventListener(UI.ToolbarInput.Event.TextChanged, this._onVisibleColumnsChanged, this);
+ this.refreshButton = new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Refresh'), 'largeicon-refresh');
+ this.refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._refreshButtonClicked, this);
+ this._visibleColumnsInput = new UI.Toolbar.ToolbarInput(Common.UIString.UIString('Visible columns'), '', 1);
+ this._visibleColumnsInput.addEventListener(
+ UI.Toolbar.ToolbarInput.Event.TextChanged, this._onVisibleColumnsChanged, this);
+
+ /** @type {?DataGrid.DataGrid.DataGridImpl} */
+ this._dataGrid;
}
/**
@@ -52,7 +60,7 @@
/**
* @override
- * @return {!Promise<!Array<!UI.ToolbarItem>>}
+ * @return {!Promise<!Array<!UI.Toolbar.ToolbarItem>>}
*/
async toolbarItems() {
return [this.refreshButton, this._visibleColumnsInput];
@@ -76,10 +84,10 @@
this.detachChildWidgets();
this.element.removeChildren();
- this._dataGrid = DataGrid.SortableDataGrid.create(columnNames, values, ls`Database`);
+ this._dataGrid = DataGrid.SortableDataGrid.SortableDataGrid.create(columnNames, values, ls`Database`);
this._visibleColumnsInput.setVisible(!!this._dataGrid);
if (!this._dataGrid) {
- this._emptyWidget = new UI.EmptyWidget(ls`The "${this.tableName}"\ntable is empty.`);
+ this._emptyWidget = new UI.EmptyWidget.EmptyWidget(ls`The "${this.tableName}"\ntable is empty.`);
this._emptyWidget.show(this.element);
return;
}
diff --git a/front_end/resources/IndexedDBModel.js b/front_end/resources/IndexedDBModel.js
index 5993cc1..cdc8a30 100644
--- a/front_end/resources/IndexedDBModel.js
+++ b/front_end/resources/IndexedDBModel.js
@@ -28,18 +28,22 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
+import * as ProtocolModule from '../protocol/protocol.js';
+import * as SDK from '../sdk/sdk.js';
+
/**
* @implements {Protocol.StorageDispatcher}
* @unrestricted
*/
-export class IndexedDBModel extends SDK.SDKModel {
+export class IndexedDBModel extends SDK.SDKModel.SDKModel {
/**
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
*/
constructor(target) {
super(target);
target.registerStorageDispatcher(this);
- this._securityOriginManager = target.model(SDK.SecurityOriginManager);
+ this._securityOriginManager = target.model(SDK.SecurityOriginManager.SecurityOriginManager);
this._indexedDBAgent = target.indexedDBAgent();
this._storageAgent = target.storageAgent();
@@ -49,7 +53,7 @@
this._databaseNamesBySecurityOrigin = {};
this._originsUpdated = new Set();
- this._throttler = new Common.Throttler(1000);
+ this._throttler = new Common.Throttler.Throttler(1000);
}
/**
@@ -267,7 +271,7 @@
* @return {boolean}
*/
_isValidSecurityOrigin(securityOrigin) {
- const parsedURL = Common.ParsedURL.fromString(securityOrigin);
+ const parsedURL = Common.ParsedURL.ParsedURL.fromString(securityOrigin);
return !!parsedURL && parsedURL.scheme.startsWith('http');
}
@@ -423,12 +427,12 @@
keyRange
});
- if (response[Protocol.Error]) {
- console.error('IndexedDBAgent error: ' + response[Protocol.Error]);
+ if (response[ProtocolModule.InspectorBackend.ProtocolError]) {
+ console.error('IndexedDBAgent error: ' + response[ProtocolModule.InspectorBackend.ProtocolError]);
return;
}
- const runtimeModel = this.target().model(SDK.RuntimeModel);
+ const runtimeModel = this.target().model(SDK.RuntimeModel.RuntimeModel);
if (!runtimeModel || !this._databaseNamesBySecurityOrigin[databaseId.securityOrigin]) {
return;
}
@@ -455,8 +459,8 @@
const response =
await this._indexedDBAgent.invoke_getMetadata({securityOrigin: databaseOrigin, databaseName, objectStoreName});
- if (response[Protocol.Error]) {
- console.error('IndexedDBAgent error: ' + response[Protocol.Error]);
+ if (response[ProtocolModule.InspectorBackend.ProtocolError]) {
+ console.error('IndexedDBAgent error: ' + response[ProtocolModule.InspectorBackend.ProtocolError]);
return null;
}
return {entriesCount: response.entriesCount, keyGeneratorValue: response.keyGeneratorValue};
@@ -515,7 +519,7 @@
}
}
-SDK.SDKModel.register(IndexedDBModel, SDK.Target.Capability.Storage, false);
+SDK.SDKModel.SDKModel.register(IndexedDBModel, SDK.SDKModel.Capability.Storage, false);
export const KeyTypes = {
NumberType: 'number',
@@ -544,9 +548,9 @@
*/
export class Entry {
/**
- * @param {!SDK.RemoteObject} key
- * @param {!SDK.RemoteObject} primaryKey
- * @param {!SDK.RemoteObject} value
+ * @param {!SDK.RemoteObject.RemoteObject} key
+ * @param {!SDK.RemoteObject.RemoteObject} primaryKey
+ * @param {!SDK.RemoteObject.RemoteObject} value
*/
constructor(key, primaryKey, value) {
this.key = key;
diff --git a/front_end/resources/IndexedDBViews.js b/front_end/resources/IndexedDBViews.js
index 574097f..acad7ca 100644
--- a/front_end/resources/IndexedDBViews.js
+++ b/front_end/resources/IndexedDBViews.js
@@ -28,12 +28,18 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
+import * as DataGrid from '../data_grid/data_grid.js';
+import * as ObjectUI from '../object_ui/object_ui.js';
+import * as SDK from '../sdk/sdk.js'; // eslint-disable-line no-unused-vars
+import * as UI from '../ui/ui.js';
+
import {Database, DatabaseId, Entry, Index, IndexedDBModel, ObjectStore} from './IndexedDBModel.js'; // eslint-disable-line no-unused-vars
/**
* @unrestricted
*/
-export class IDBDatabaseView extends UI.VBox {
+export class IDBDatabaseView extends UI.Widget.VBox {
/**
* @param {!IndexedDBModel} model
* @param {?Database} database
@@ -44,7 +50,7 @@
this._model = model;
const databaseName = database ? database.databaseId.name : ls`Loading\u2026`;
- this._reportView = new UI.ReportView(databaseName);
+ this._reportView = new UI.ReportView.ReportView(databaseName);
this._reportView.show(this.contentElement);
const bodySection = this._reportView.appendSection('');
@@ -53,11 +59,12 @@
this._objectStoreCountElement = bodySection.appendField(ls`Object stores`);
const footer = this._reportView.appendSection('').appendRow();
- this._clearButton = UI.createTextButton(ls`Delete database`, () => this._deleteDatabase(), ls`Delete database`);
+ this._clearButton =
+ UI.UIUtils.createTextButton(ls`Delete database`, () => this._deleteDatabase(), ls`Delete database`);
footer.appendChild(this._clearButton);
- this._refreshButton =
- UI.createTextButton(ls`Refresh database`, () => this._refreshDatabaseButtonClicked(), ls`Refresh database`);
+ this._refreshButton = UI.UIUtils.createTextButton(
+ ls`Refresh database`, () => this._refreshDatabaseButtonClicked(), ls`Refresh database`);
footer.appendChild(this._refreshButton);
if (database) {
@@ -90,8 +97,9 @@
}
async _deleteDatabase() {
- const ok = await UI.ConfirmDialog.show(
- Common.UIString('Please confirm delete of "%s" database.', this._database.databaseId.name), this.element);
+ const ok = await UI.UIUtils.ConfirmDialog.show(
+ Common.UIString.UIString('Please confirm delete of "%s" database.', this._database.databaseId.name),
+ this.element);
if (ok) {
this._model.deleteDatabase(this._database.databaseId);
}
@@ -101,7 +109,7 @@
/**
* @unrestricted
*/
-export class IDBDataView extends UI.SimpleView {
+export class IDBDataView extends UI.View.SimpleView {
/**
* @param {!IndexedDBModel} model
* @param {!DatabaseId} databaseId
@@ -110,7 +118,7 @@
* @param {function()} refreshObjectStoreCallback
*/
constructor(model, databaseId, objectStore, index, refreshObjectStoreCallback) {
- super(Common.UIString('IDB'));
+ super(Common.UIString.UIString('IDB'));
this.registerRequiredCSS('resources/indexedDBViews.css');
this._model = model;
@@ -120,19 +128,21 @@
this.element.classList.add('indexed-db-data-view', 'storage-view');
- this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'largeicon-refresh');
- this._refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this._refreshButtonClicked, this);
+ this._refreshButton = new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Refresh'), 'largeicon-refresh');
+ this._refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._refreshButtonClicked, this);
- this._deleteSelectedButton = new UI.ToolbarButton(Common.UIString('Delete selected'), 'largeicon-delete');
- this._deleteSelectedButton.addEventListener(UI.ToolbarButton.Events.Click, () => this._deleteButtonClicked(null));
+ this._deleteSelectedButton =
+ new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Delete selected'), 'largeicon-delete');
+ this._deleteSelectedButton.addEventListener(
+ UI.Toolbar.ToolbarButton.Events.Click, () => this._deleteButtonClicked(null));
- this._clearButton = new UI.ToolbarButton(Common.UIString('Clear object store'), 'largeicon-clear');
- this._clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._clearButtonClicked, this);
+ this._clearButton = new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Clear object store'), 'largeicon-clear');
+ this._clearButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._clearButtonClicked, this);
- this._needsRefresh =
- new UI.ToolbarItem(UI.createIconLabel(Common.UIString('Data may be stale'), 'smallicon-warning'));
+ this._needsRefresh = new UI.Toolbar.ToolbarItem(
+ UI.UIUtils.createIconLabel(Common.UIString.UIString('Data may be stale'), 'smallicon-warning'));
this._needsRefresh.setVisible(false);
- this._needsRefresh.setTitle(Common.UIString('Some entries may have been modified'));
+ this._needsRefresh.setTitle(Common.UIString.UIString('Some entries may have been modified'));
this._createEditorToolbar();
@@ -144,25 +154,29 @@
}
/**
- * @return {!DataGrid.DataGrid}
+ * @return {!DataGrid.DataGrid.DataGridImpl}
*/
_createDataGrid() {
const keyPath = this._isIndex ? this._index.keyPath : this._objectStore.keyPath;
const columns = /** @type {!Array<!DataGrid.ColumnDescriptor>} */ ([]);
- columns.push({id: 'number', title: Common.UIString('#'), sortable: false, width: '50px'});
- columns.push(
- {id: 'key', titleDOMFragment: this._keyColumnHeaderFragment(Common.UIString('Key'), keyPath), sortable: false});
+ columns.push({id: 'number', title: Common.UIString.UIString('#'), sortable: false, width: '50px'});
+ columns.push({
+ id: 'key',
+ titleDOMFragment: this._keyColumnHeaderFragment(Common.UIString.UIString('Key'), keyPath),
+ sortable: false
+ });
if (this._isIndex) {
columns.push({
id: 'primaryKey',
- titleDOMFragment: this._keyColumnHeaderFragment(Common.UIString('Primary key'), this._objectStore.keyPath),
+ titleDOMFragment:
+ this._keyColumnHeaderFragment(Common.UIString.UIString('Primary key'), this._objectStore.keyPath),
sortable: false
});
}
- columns.push({id: 'value', title: Common.UIString('Value'), sortable: false});
+ columns.push({id: 'value', title: Common.UIString.UIString('Value'), sortable: false});
- const dataGrid = new DataGrid.DataGrid({
+ const dataGrid = new DataGrid.DataGrid.DataGridImpl({
displayName: ls`Indexed DB`,
columns,
deleteCallback: this._deleteButtonClicked.bind(this),
@@ -185,7 +199,7 @@
return keyColumnHeaderFragment;
}
- keyColumnHeaderFragment.createTextChild(' (' + Common.UIString('Key path: '));
+ keyColumnHeaderFragment.createTextChild(' (' + Common.UIString.UIString('Key path: '));
if (Array.isArray(keyPath)) {
keyColumnHeaderFragment.createTextChild('[');
for (let i = 0; i < keyPath.length; ++i) {
@@ -217,25 +231,28 @@
}
_createEditorToolbar() {
- const editorToolbar = new UI.Toolbar('data-view-toolbar', this.element);
+ const editorToolbar = new UI.Toolbar.Toolbar('data-view-toolbar', this.element);
editorToolbar.appendToolbarItem(this._refreshButton);
- editorToolbar.appendToolbarItem(new UI.ToolbarSeparator());
+ editorToolbar.appendToolbarItem(new UI.Toolbar.ToolbarSeparator());
- this._pageBackButton = new UI.ToolbarButton(Common.UIString('Show previous page'), 'largeicon-play-back');
- this._pageBackButton.addEventListener(UI.ToolbarButton.Events.Click, this._pageBackButtonClicked, this);
+ this._pageBackButton =
+ new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Show previous page'), 'largeicon-play-back');
+ this._pageBackButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._pageBackButtonClicked, this);
editorToolbar.appendToolbarItem(this._pageBackButton);
- this._pageForwardButton = new UI.ToolbarButton(Common.UIString('Show next page'), 'largeicon-play');
+ this._pageForwardButton =
+ new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Show next page'), 'largeicon-play');
this._pageForwardButton.setEnabled(false);
- this._pageForwardButton.addEventListener(UI.ToolbarButton.Events.Click, this._pageForwardButtonClicked, this);
+ this._pageForwardButton.addEventListener(
+ UI.Toolbar.ToolbarButton.Events.Click, this._pageForwardButtonClicked, this);
editorToolbar.appendToolbarItem(this._pageForwardButton);
- this._keyInput = new UI.ToolbarInput(ls`Start from key`, '', 0.5);
- this._keyInput.addEventListener(UI.ToolbarInput.Event.TextChanged, this._updateData.bind(this, false));
+ this._keyInput = new UI.Toolbar.ToolbarInput(ls`Start from key`, '', 0.5);
+ this._keyInput.addEventListener(UI.Toolbar.ToolbarInput.Event.TextChanged, this._updateData.bind(this, false));
editorToolbar.appendToolbarItem(this._keyInput);
- editorToolbar.appendToolbarItem(new UI.ToolbarSeparator());
+ editorToolbar.appendToolbarItem(new UI.Toolbar.ToolbarSeparator());
editorToolbar.appendToolbarItem(this._clearButton);
editorToolbar.appendToolbarItem(this._deleteSelectedButton);
@@ -259,8 +276,8 @@
}
/**
- * @param {!UI.ContextMenu} contextMenu
- * @param {!DataGrid.DataGridNode} gridNode
+ * @param {!UI.ContextMenu.ContextMenu} contextMenu
+ * @param {!DataGrid.DataGrid.DataGridNode} gridNode
*/
_populateContextMenu(contextMenu, gridNode) {
const node = /** @type {!IDBDataGridNode} */ (gridNode);
@@ -429,7 +446,7 @@
}
/**
- * @param {?DataGrid.DataGridNode} node
+ * @param {?DataGrid.DataGrid.DataGridNode} node
*/
async _deleteButtonClicked(node) {
if (!node) {
@@ -438,7 +455,7 @@
return;
}
}
- const key = /** @type {!SDK.RemoteObject} */ (this._isIndex ? node.data.primaryKey : node.data.key);
+ const key = /** @type {!SDK.RemoteObject.RemoteObject} */ (this._isIndex ? node.data.primaryKey : node.data.key);
const keyValue = /** @type {!Array<?>|!Date|number|string} */ (key.value);
await this._model.deleteEntries(this._databaseId, this._objectStore.name, window.IDBKeyRange.only(keyValue));
this._refreshObjectStoreCallback();
@@ -459,14 +476,14 @@
/**
* @unrestricted
*/
-export class IDBDataGridNode extends DataGrid.DataGridNode {
+export class IDBDataGridNode extends DataGrid.DataGrid.DataGridNode {
/**
* @param {!Object.<string, *>} data
*/
constructor(data) {
super(data, false);
this.selectable = true;
- /** @type {?ObjectUI.ObjectPropertiesSection} */
+ /** @type {?ObjectUI.ObjectPropertiesSection.ObjectPropertiesSection} */
this.valueObjectPresentation = null;
}
@@ -476,20 +493,21 @@
*/
createCell(columnIdentifier) {
const cell = super.createCell(columnIdentifier);
- const value = /** @type {!SDK.RemoteObject} */ (this.data[columnIdentifier]);
+ const value = /** @type {!SDK.RemoteObject.RemoteObject} */ (this.data[columnIdentifier]);
switch (columnIdentifier) {
case 'value':
cell.removeChildren();
- const objectPropSection = ObjectUI.ObjectPropertiesSection.defaultObjectPropertiesSection(
- value, undefined /* linkifier */, true /* skipProto */, true /* readOnly */);
+ const objectPropSection =
+ ObjectUI.ObjectPropertiesSection.ObjectPropertiesSection.defaultObjectPropertiesSection(
+ value, undefined /* linkifier */, true /* skipProto */, true /* readOnly */);
cell.appendChild(objectPropSection.element);
this.valueObjectPresentation = objectPropSection;
break;
case 'key':
case 'primaryKey':
cell.removeChildren();
- const objectElement = ObjectUI.ObjectPropertiesSection.defaultObjectPresentation(
+ const objectElement = ObjectUI.ObjectPropertiesSection.ObjectPropertiesSection.defaultObjectPresentation(
value, undefined /* linkifier */, true /* skipProto */, true /* readOnly */);
cell.appendChild(objectElement);
break;
diff --git a/front_end/resources/ResourcesPanel.js b/front_end/resources/ResourcesPanel.js
index 7005eff..9c219a1 100644
--- a/front_end/resources/ResourcesPanel.js
+++ b/front_end/resources/ResourcesPanel.js
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as Common from '../common/common.js'; // eslint-disable-line no-unused-vars
+import * as SDK from '../sdk/sdk.js';
+import * as SourceFrame from '../source_frame/source_frame.js';
+import * as UI from '../ui/ui.js';
+
import {ApplicationPanelSidebar, StorageCategoryView} from './ApplicationPanelSidebar.js';
import {CookieItemsView} from './CookieItemsView.js';
import {DatabaseQueryView} from './DatabaseQueryView.js';
@@ -10,25 +15,25 @@
import {DOMStorage} from './DOMStorageModel.js'; // eslint-disable-line no-unused-vars
import {StorageItemsView} from './StorageItemsView.js';
-export class ResourcesPanel extends UI.PanelWithSidebar {
+export class ResourcesPanel extends UI.Panel.PanelWithSidebar {
constructor() {
super('resources');
this.registerRequiredCSS('resources/resourcesPanel.css');
this._resourcesLastSelectedItemSetting = self.Common.settings.createSetting('resourcesLastSelectedElementPath', []);
- /** @type {?UI.Widget} */
+ /** @type {?UI.Widget.Widget} */
this.visibleView = null;
- /** @type {?Promise<!UI.Widget>} */
+ /** @type {?Promise<!UI.Widget.Widget>} */
this._pendingViewPromise = null;
/** @type {?StorageCategoryView} */
this._categoryView = null;
- const mainContainer = new UI.VBox();
+ const mainContainer = new UI.Widget.VBox();
this.storageViews = mainContainer.element.createChild('div', 'vbox flex-auto');
- this._storageViewToolbar = new UI.Toolbar('resources-toolbar', mainContainer.element);
+ this._storageViewToolbar = new UI.Toolbar.Toolbar('resources-toolbar', mainContainer.element);
this.splitWidget().setMainWidget(mainContainer);
/** @type {?DOMStorageItemsView} */
@@ -37,7 +42,7 @@
/** @type {?CookieItemsView} */
this._cookieView = null;
- /** @type {?UI.EmptyWidget} */
+ /** @type {?UI.EmptyWidget.EmptyWidget} */
this._emptyWidget = null;
this._sidebar = new ApplicationPanelSidebar(this);
@@ -52,13 +57,13 @@
}
/**
- * @param {!UI.Widget} view
+ * @param {!UI.Widget.Widget} view
* @return {boolean}
*/
static _shouldCloseOnReset(view) {
const viewClassesToClose = [
- SourceFrame.ResourceSourceFrame, SourceFrame.ImageView, SourceFrame.FontView, StorageItemsView, DatabaseQueryView,
- DatabaseTableView
+ SourceFrame.ResourceSourceFrame.ResourceSourceFrame, SourceFrame.ImageView.ImageView,
+ SourceFrame.FontView.FontView, StorageItemsView, DatabaseQueryView, DatabaseTableView
];
return viewClassesToClose.some(type => view instanceof type);
}
@@ -91,7 +96,7 @@
}
/**
- * @param {?UI.Widget} view
+ * @param {?UI.Widget.Widget} view
*/
showView(view) {
this._pendingViewPromise = null;
@@ -109,7 +114,7 @@
this.visibleView = view;
this._storageViewToolbar.removeToolbarItems();
- if (view instanceof UI.SimpleView) {
+ if (view instanceof UI.View.SimpleView) {
view.toolbarItems().then(items => {
items.map(item => this._storageViewToolbar.appendToolbarItem(item));
this._storageViewToolbar.element.classList.toggle('hidden', !items.length);
@@ -118,8 +123,8 @@
}
/**
- * @param {!Promise<!UI.Widget>} viewPromise
- * @return {!Promise<?UI.Widget>}
+ * @param {!Promise<!UI.Widget.Widget>} viewPromise
+ * @return {!Promise<?UI.Widget.Widget>}
*/
async scheduleShowView(viewPromise) {
this._pendingViewPromise = viewPromise;
@@ -161,11 +166,11 @@
}
/**
- * @param {!SDK.Target} cookieFrameTarget
+ * @param {!SDK.SDKModel.Target} cookieFrameTarget
* @param {string} cookieDomain
*/
showCookies(cookieFrameTarget, cookieDomain) {
- const model = cookieFrameTarget.model(SDK.CookieModel);
+ const model = cookieFrameTarget.model(SDK.CookieModel.CookieModel);
if (!model) {
return;
}
@@ -178,11 +183,11 @@
}
/**
- * @param {!SDK.Target} target
+ * @param {!SDK.SDKModel.Target} target
* @param {string} cookieDomain
*/
clearCookies(target, cookieDomain) {
- const model = target.model(SDK.CookieModel);
+ const model = target.model(SDK.CookieModel.CookieModel);
if (!model) {
return;
}
@@ -195,7 +200,7 @@
}
/**
- * @implements {Common.Revealer}
+ * @implements {Common.Revealer.Revealer}
*/
export class ResourceRevealer {
/**
@@ -204,7 +209,7 @@
* @return {!Promise}
*/
async reveal(resource) {
- if (!(resource instanceof SDK.Resource)) {
+ if (!(resource instanceof SDK.Resource.Resource)) {
return Promise.reject(new Error('Internal error: not a resource'));
}
const sidebar = ResourcesPanel._instance()._sidebar;
diff --git a/front_end/resources/ServiceWorkerCacheViews.js b/front_end/resources/ServiceWorkerCacheViews.js
index b5aa5f2..60f716d 100644
--- a/front_end/resources/ServiceWorkerCacheViews.js
+++ b/front_end/resources/ServiceWorkerCacheViews.js
@@ -2,13 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-export class ServiceWorkerCacheView extends UI.SimpleView {
+import * as Common from '../common/common.js';
+import * as DataGrid from '../data_grid/data_grid.js';
+import * as Network from '../network/network.js';
+import * as SDK from '../sdk/sdk.js';
+import * as UI from '../ui/ui.js';
+
+export class ServiceWorkerCacheView extends UI.View.SimpleView {
/**
- * @param {!SDK.ServiceWorkerCacheModel} model
+ * @param {!SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel} model
* @param {!SDK.ServiceWorkerCacheModel.Cache} cache
*/
constructor(model, cache) {
- super(Common.UIString('Cache'));
+ super(Common.UIString.UIString('Cache'));
this.registerRequiredCSS('resources/serviceWorkerCacheViews.css');
this._model = model;
@@ -17,35 +23,37 @@
this.element.classList.add('service-worker-cache-data-view');
this.element.classList.add('storage-view');
- const editorToolbar = new UI.Toolbar('data-view-toolbar', this.element);
- this._splitWidget = new UI.SplitWidget(false, false);
+ const editorToolbar = new UI.Toolbar.Toolbar('data-view-toolbar', this.element);
+ this._splitWidget = new UI.SplitWidget.SplitWidget(false, false);
this._splitWidget.show(this.element);
- this._previewPanel = new UI.VBox();
+ this._previewPanel = new UI.Widget.VBox();
const resizer = this._previewPanel.element.createChild('div', 'cache-preview-panel-resizer');
this._splitWidget.setMainWidget(this._previewPanel);
this._splitWidget.installResizer(resizer);
- /** @type {?UI.Widget} */
+ /** @type {?UI.Widget.Widget} */
this._preview = null;
this._cache = cache;
- /** @type {?DataGrid.DataGrid} */
+ /** @type {?DataGrid.DataGrid.DataGridImpl} */
this._dataGrid = null;
- this._refreshThrottler = new Common.Throttler(300);
- this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'largeicon-refresh');
- this._refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this._refreshButtonClicked, this);
+ this._refreshThrottler = new Common.Throttler.Throttler(300);
+ this._refreshButton = new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Refresh'), 'largeicon-refresh');
+ this._refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._refreshButtonClicked, this);
editorToolbar.appendToolbarItem(this._refreshButton);
- this._deleteSelectedButton = new UI.ToolbarButton(Common.UIString('Delete Selected'), 'largeicon-delete');
- this._deleteSelectedButton.addEventListener(UI.ToolbarButton.Events.Click, () => this._deleteButtonClicked(null));
+ this._deleteSelectedButton =
+ new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Delete Selected'), 'largeicon-delete');
+ this._deleteSelectedButton.addEventListener(
+ UI.Toolbar.ToolbarButton.Events.Click, () => this._deleteButtonClicked(null));
editorToolbar.appendToolbarItem(this._deleteSelectedButton);
- const entryPathFilterBox = new UI.ToolbarInput(ls`Filter by Path`, '', 1);
+ const entryPathFilterBox = new UI.Toolbar.ToolbarInput(ls`Filter by Path`, '', 1);
editorToolbar.appendToolbarItem(entryPathFilterBox);
- const entryPathFilterThrottler = new Common.Throttler(300);
+ const entryPathFilterThrottler = new Common.Throttler.Throttler(300);
this._entryPathFilter = '';
- entryPathFilterBox.addEventListener(UI.ToolbarInput.Event.TextChanged, () => {
+ entryPathFilterBox.addEventListener(UI.Toolbar.ToolbarInput.Event.TextChanged, () => {
entryPathFilterThrottler.schedule(() => {
this._entryPathFilter = entryPathFilterBox.value();
return this._updateData(true);
@@ -87,7 +95,7 @@
}
/**
- * @param {?UI.Widget} preview
+ * @param {?UI.Widget.Widget} preview
*/
_showPreview(preview) {
if (preview && this._preview === preview) {
@@ -97,37 +105,37 @@
this._preview.detach();
}
if (!preview) {
- preview = new UI.EmptyWidget(Common.UIString('Select a cache entry above to preview'));
+ preview = new UI.EmptyWidget.EmptyWidget(Common.UIString.UIString('Select a cache entry above to preview'));
}
this._preview = preview;
this._preview.show(this._previewPanel.element);
}
/**
- * @return {!DataGrid.DataGrid}
+ * @return {!DataGrid.DataGrid.DataGridImpl}
*/
_createDataGrid() {
const columns = /** @type {!Array<!DataGrid.ColumnDescriptor>} */ ([
{id: 'number', title: '#', sortable: false, width: '3px'},
- {id: 'name', title: Common.UIString('Name'), weight: 4, sortable: true},
+ {id: 'name', title: Common.UIString.UIString('Name'), weight: 4, sortable: true},
{id: 'responseType', title: ls`Response-Type`, weight: 1, align: DataGrid.DataGrid.Align.Right, sortable: true},
- {id: 'contentType', title: Common.UIString('Content-Type'), weight: 1, sortable: true}, {
+ {id: 'contentType', title: Common.UIString.UIString('Content-Type'), weight: 1, sortable: true}, {
id: 'contentLength',
- title: Common.UIString('Content-Length'),
+ title: Common.UIString.UIString('Content-Length'),
weight: 1,
align: DataGrid.DataGrid.Align.Right,
sortable: true
},
{
id: 'responseTime',
- title: Common.UIString('Time Cached'),
+ title: Common.UIString.UIString('Time Cached'),
width: '12em',
weight: 1,
align: DataGrid.DataGrid.Align.Right,
sortable: true
}
]);
- const dataGrid = new DataGrid.DataGrid({
+ const dataGrid = new DataGrid.DataGrid.DataGridImpl({
displayName: ls`Service Worker Cache`,
columns,
deleteCallback: this._deleteButtonClicked.bind(this),
@@ -172,7 +180,7 @@
}
/**
- * @param {?DataGrid.DataGridNode} node
+ * @param {?DataGrid.DataGrid.DataGridNode} node
*/
async _deleteButtonClicked(node) {
if (!node) {
@@ -221,7 +229,7 @@
this._returnCount = returnCount;
this._updateSummaryBar();
- /** @type {!Map<string, !DataGrid.DataGridNode>} */
+ /** @type {!Map<string, !DataGrid.DataGrid.DataGridNode>} */
const oldEntries = new Map();
const rootNode = this._dataGrid.rootNode();
for (const node of rootNode.children) {
@@ -294,7 +302,7 @@
}
/**
- * @param {!SDK.NetworkRequest} request
+ * @param {!SDK.NetworkRequest.NetworkRequest} request
*/
async _previewCachedResponse(request) {
let preview = request[ServiceWorkerCacheView._previewSymbol];
@@ -311,15 +319,16 @@
/**
* @param {!Protocol.CacheStorage.DataEntry} entry
- * @return {!SDK.NetworkRequest}
+ * @return {!SDK.NetworkRequest.NetworkRequest}
*/
_createRequest(entry) {
- const request = new SDK.NetworkRequest('cache-storage-' + entry.requestURL, entry.requestURL, '', '', '', null);
+ const request =
+ new SDK.NetworkRequest.NetworkRequest('cache-storage-' + entry.requestURL, entry.requestURL, '', '', '', null);
request.requestMethod = entry.requestMethod;
request.setRequestHeaders(entry.requestHeaders);
request.statusCode = entry.responseStatus;
request.statusText = entry.responseStatusText;
- request.protocol = new Common.ParsedURL(entry.requestURL).scheme;
+ request.protocol = new Common.ParsedURL.ParsedURL(entry.requestURL).scheme;
request.responseHeaders = entry.responseHeaders;
request.setRequestHeadersText('');
request.endTime = entry.responseTime;
@@ -331,9 +340,10 @@
header = entry.responseHeaders.find(header => header.name.toLowerCase() === 'content-length');
request.resourceSize = (header && header.value) | 0;
- let resourceType = Common.ResourceType.fromMimeType(contentType);
+ let resourceType = Common.ResourceType.ResourceType.fromMimeType(contentType);
if (!resourceType) {
- resourceType = Common.ResourceType.fromURL(entry.requestURL) || Common.resourceTypes.Other;
+ resourceType =
+ Common.ResourceType.ResourceType.fromURL(entry.requestURL) || Common.ResourceType.resourceTypes.Other;
}
request.setResourceType(resourceType);
request.setContentDataProvider(this._requestContent.bind(this, request));
@@ -341,7 +351,7 @@
}
/**
- * @param {!SDK.NetworkRequest} request
+ * @param {!SDK.NetworkRequest.NetworkRequest} request
* @return {!Promise<!SDK.NetworkRequest.ContentData>}
*/
async _requestContent(request) {
@@ -360,16 +370,16 @@
ServiceWorkerCacheView._previewSymbol = Symbol('preview');
-export class DataGridNode extends DataGrid.DataGridNode {
+export class DataGridNode extends DataGrid.DataGrid.DataGridNode {
/**
* @param {number} number
- * @param {!SDK.NetworkRequest} request
+ * @param {!SDK.NetworkRequest.NetworkRequest} request
* @param {!Protocol.CacheStorage.CachedResponseType} responseType
*/
constructor(number, request, responseType) {
super(request);
this._number = number;
- const parsed = new Common.ParsedURL(request.url());
+ const parsed = new Common.ParsedURL.ParsedURL(request.url());
if (parsed.isValid) {
this._name = request.url().trimURL(parsed.domain());
} else {
@@ -406,25 +416,27 @@
} else if (columnId === 'responseTime') {
value = new Date(this._request.endTime * 1000).toLocaleString();
}
- DataGrid.DataGrid.setElementText(cell, value || '', true);
+ DataGrid.DataGrid.DataGridImpl.setElementText(cell, value || '', true);
cell.title = this._request.url();
return cell;
}
}
-export class RequestView extends UI.VBox {
+export class RequestView extends UI.Widget.VBox {
/**
- * @param {!SDK.NetworkRequest} request
+ * @param {!SDK.NetworkRequest.NetworkRequest} request
*/
constructor(request) {
super();
- this._tabbedPane = new UI.TabbedPane();
+ this._tabbedPane = new UI.TabbedPane.TabbedPane();
this._tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, this._tabSelected, this);
this._resourceViewTabSetting = self.Common.settings.createSetting('cacheStorageViewTab', 'preview');
- this._tabbedPane.appendTab('headers', Common.UIString('Headers'), new Network.RequestHeadersView(request));
- this._tabbedPane.appendTab('preview', Common.UIString('Preview'), new Network.RequestPreviewView(request));
+ this._tabbedPane.appendTab(
+ 'headers', Common.UIString.UIString('Headers'), new Network.RequestHeadersView.RequestHeadersView(request));
+ this._tabbedPane.appendTab(
+ 'preview', Common.UIString.UIString('Preview'), new Network.RequestPreviewView.RequestPreviewView(request));
this._tabbedPane.show(this.element);
}
diff --git a/front_end/resources/ServiceWorkersView.js b/front_end/resources/ServiceWorkersView.js
index 5843c90..bfb92ec 100644
--- a/front_end/resources/ServiceWorkersView.js
+++ b/front_end/resources/ServiceWorkersView.js
@@ -2,15 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as Common from '../common/common.js';
+import * as Components from '../components/components.js';
+import * as MobileThrottling from '../mobile_throttling/mobile_throttling.js';
+import * as SDK from '../sdk/sdk.js';
+import * as UI from '../ui/ui.js';
+
/**
- * @implements {SDK.SDKModelObserver<!SDK.ServiceWorkerManager>}
+ * @implements {SDK.SDKModel.SDKModelObserver<!SDK.ServiceWorkerManager.ServiceWorkerManager>}
*/
-export class ServiceWorkersView extends UI.VBox {
+export class ServiceWorkersView extends UI.Widget.VBox {
constructor() {
super(true);
this.registerRequiredCSS('resources/serviceWorkersView.css');
- this._currentWorkersView = new UI.ReportView(Common.UIString('Service Workers'));
+ this._currentWorkersView = new UI.ReportView.ReportView(Common.UIString.UIString('Service Workers'));
this._currentWorkersView.setBodyScrollable(false);
this.contentElement.classList.add('service-worker-list');
this._currentWorkersView.show(this.contentElement);
@@ -19,17 +25,17 @@
this._toolbar = this._currentWorkersView.createToolbar();
this._toolbar.makeWrappable(true /* growVertically */);
- /** @type {!Map<!SDK.ServiceWorkerRegistration, !Section>} */
+ /** @type {!Map<!SDK.ServiceWorkerManager.ServiceWorkerRegistration, !Section>} */
this._sections = new Map();
/** @type {symbol} */
this._registrationSymbol = Symbol('Resources.ServiceWorkersView');
- /** @type {?SDK.ServiceWorkerManager} */
+ /** @type {?SDK.ServiceWorkerManager.ServiceWorkerManager} */
this._manager = null;
- /** @type {?SDK.SecurityOriginManager} */
+ /** @type {?SDK.SecurityOriginManager.SecurityOriginManager} */
this._securityOriginManager = null;
- this._filterThrottler = new Common.Throttler(300);
+ this._filterThrottler = new Common.Throttler.Throttler(300);
this._otherWorkers = this.contentElement.createChild('div', 'service-workers-other-origin');
this._otherSWFilter = this._otherWorkers.createChild('div', 'service-worker-filter');
@@ -37,53 +43,54 @@
this._otherSWFilter.setAttribute('role', 'switch');
this._otherSWFilter.setAttribute('aria-checked', false);
const filterLabel = this._otherSWFilter.createChild('label', 'service-worker-filter-label');
- filterLabel.textContent = Common.UIString('Service workers from other origins');
+ filterLabel.textContent = Common.UIString.UIString('Service workers from other origins');
self.onInvokeElement(this._otherSWFilter, event => {
if (event.target === this._otherSWFilter || event.target === filterLabel) {
this._toggleFilter();
}
});
- const toolbar = new UI.Toolbar('service-worker-filter-toolbar', this._otherSWFilter);
- this._filter = new UI.ToolbarInput(ls`Filter service worker`, '', 1);
- this._filter.addEventListener(UI.ToolbarInput.Event.TextChanged, () => this._filterChanged());
+ const toolbar = new UI.Toolbar.Toolbar('service-worker-filter-toolbar', this._otherSWFilter);
+ this._filter = new UI.Toolbar.ToolbarInput(ls`Filter service worker`, '', 1);
+ this._filter.addEventListener(UI.Toolbar.ToolbarInput.Event.TextChanged, () => this._filterChanged());
toolbar.appendToolbarItem(this._filter);
- this._otherWorkersView = new UI.ReportView();
+ this._otherWorkersView = new UI.ReportView.ReportView();
this._otherWorkersView.setBodyScrollable(false);
this._otherWorkersView.show(this._otherWorkers);
this._otherWorkersView.element.classList.add('service-workers-for-other-origins');
this._updateCollapsedStyle();
- this._toolbar.appendToolbarItem(MobileThrottling.throttlingManager().createOfflineToolbarCheckbox());
+ this._toolbar.appendToolbarItem(
+ MobileThrottling.ThrottlingManager.throttlingManager().createOfflineToolbarCheckbox());
const updateOnReloadSetting = self.Common.settings.createSetting('serviceWorkerUpdateOnReload', false);
- updateOnReloadSetting.setTitle(Common.UIString('Update on reload'));
- const forceUpdate = new UI.ToolbarSettingCheckbox(
+ updateOnReloadSetting.setTitle(Common.UIString.UIString('Update on reload'));
+ const forceUpdate = new UI.Toolbar.ToolbarSettingCheckbox(
updateOnReloadSetting, ls`On page reload, force the service worker to update, and activate it`);
this._toolbar.appendToolbarItem(forceUpdate);
const bypassServiceWorkerSetting = self.Common.settings.createSetting('bypassServiceWorker', false);
- bypassServiceWorkerSetting.setTitle(Common.UIString('Bypass for network'));
- const fallbackToNetwork = new UI.ToolbarSettingCheckbox(
+ bypassServiceWorkerSetting.setTitle(Common.UIString.UIString('Bypass for network'));
+ const fallbackToNetwork = new UI.Toolbar.ToolbarSettingCheckbox(
bypassServiceWorkerSetting, ls`Bypass the service worker and load resources from the network`);
this._toolbar.appendToolbarItem(fallbackToNetwork);
- /** @type {!Map<!SDK.ServiceWorkerManager, !Array<!Common.EventTarget.EventDescriptor>>}*/
+ /** @type {!Map<!SDK.ServiceWorkerManager.ServiceWorkerManager, !Array<!Common.EventTarget.EventDescriptor>>}*/
this._eventListeners = new Map();
- self.SDK.targetManager.observeModels(SDK.ServiceWorkerManager, this);
+ self.SDK.targetManager.observeModels(SDK.ServiceWorkerManager.ServiceWorkerManager, this);
this._updateListVisibility();
}
/**
* @override
- * @param {!SDK.ServiceWorkerManager} serviceWorkerManager
+ * @param {!SDK.ServiceWorkerManager.ServiceWorkerManager} serviceWorkerManager
*/
modelAdded(serviceWorkerManager) {
if (this._manager) {
return;
}
this._manager = serviceWorkerManager;
- this._securityOriginManager = serviceWorkerManager.target().model(SDK.SecurityOriginManager);
+ this._securityOriginManager = serviceWorkerManager.target().model(SDK.SecurityOriginManager.SecurityOriginManager);
for (const registration of this._manager.registrations().values()) {
this._updateRegistration(registration);
@@ -103,14 +110,14 @@
/**
* @override
- * @param {!SDK.ServiceWorkerManager} serviceWorkerManager
+ * @param {!SDK.ServiceWorkerManager.ServiceWorkerManager} serviceWorkerManager
*/
modelRemoved(serviceWorkerManager) {
if (!this._manager || this._manager !== serviceWorkerManager) {
return;
}
- Common.EventTarget.removeEventListeners(this._eventListeners.get(serviceWorkerManager));
+ Common.EventTarget.EventTarget.removeEventListeners(this._eventListeners.get(serviceWorkerManager));
this._eventListeners.delete(serviceWorkerManager);
this._manager = null;
this._securityOriginManager = null;
@@ -118,7 +125,7 @@
/**
- * @param {!SDK.ServiceWorkerRegistration} registration
+ * @param {!SDK.ServiceWorkerManager.ServiceWorkerRegistration} registration
* @return {number}
*/
_getTimeStamp(registration) {
@@ -126,10 +133,10 @@
let timestamp = 0;
- const active = versions.get(SDK.ServiceWorkerVersion.Modes.Active);
- const installing = versions.get(SDK.ServiceWorkerVersion.Modes.Installing);
- const waiting = versions.get(SDK.ServiceWorkerVersion.Modes.Waiting);
- const redundant = versions.get(SDK.ServiceWorkerVersion.Modes.Redundant);
+ const active = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Active);
+ const installing = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Installing);
+ const waiting = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Waiting);
+ const redundant = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Redundant);
if (active) {
timestamp = active.scriptResponseTime;
@@ -192,7 +199,7 @@
* @param {!Common.Event} event
*/
_registrationUpdated(event) {
- const registration = /** @type {!SDK.ServiceWorkerRegistration} */ (event.data);
+ const registration = /** @type {!SDK.ServiceWorkerManager.ServiceWorkerRegistration} */ (event.data);
this._updateRegistration(registration);
this._gcRegistrations();
}
@@ -224,7 +231,7 @@
/**
* @param {string} origin
- * @return {!UI.ReportView}
+ * @return {!UI.ReportView.ReportView}
*/
_getReportViewForOrigin(origin) {
if (this._securityOriginManager.securityOrigins().includes(origin) ||
@@ -236,7 +243,7 @@
}
/**
- * @param {!SDK.ServiceWorkerRegistration} registration
+ * @param {!SDK.ServiceWorkerManager.ServiceWorkerRegistration} registration
* @param {boolean=} skipUpdate
*/
_updateRegistration(registration, skipUpdate) {
@@ -247,7 +254,7 @@
uiSection.setUiGroupTitle(ls`Service worker for ${title}`);
uiSection[this._registrationSymbol] = registration;
section = new Section(
- /** @type {!SDK.ServiceWorkerManager} */ (this._manager), uiSection, registration);
+ /** @type {!SDK.ServiceWorkerManager.ServiceWorkerManager} */ (this._manager), uiSection, registration);
this._sections.set(registration, section);
}
if (skipUpdate) {
@@ -261,12 +268,12 @@
* @param {!Common.Event} event
*/
_registrationDeleted(event) {
- const registration = /** @type {!SDK.ServiceWorkerRegistration} */ (event.data);
+ const registration = /** @type {!SDK.ServiceWorkerManager.ServiceWorkerRegistration} */ (event.data);
this._removeRegistrationFromList(registration);
}
/**
- * @param {!SDK.ServiceWorkerRegistration} registration
+ * @param {!SDK.ServiceWorkerManager.ServiceWorkerRegistration} registration
*/
_removeRegistrationFromList(registration) {
const section = this._sections.get(registration);
@@ -278,7 +285,7 @@
}
/**
- * @param {!SDK.ServiceWorkerRegistration} registration
+ * @param {!SDK.ServiceWorkerManager.ServiceWorkerRegistration} registration
* @return {boolean}
*/
_isRegistrationVisible(registration) {
@@ -320,9 +327,9 @@
export class Section {
/**
- * @param {!SDK.ServiceWorkerManager} manager
+ * @param {!SDK.ServiceWorkerManager.ServiceWorkerManager} manager
* @param {!UI.ReportView.Section} section
- * @param {!SDK.ServiceWorkerRegistration} registration
+ * @param {!SDK.ServiceWorkerManager.ServiceWorkerRegistration} registration
*/
constructor(manager, section, registration) {
this._manager = manager;
@@ -330,39 +337,41 @@
this._registration = registration;
/** @type {?symbol} */
this._fingerprint = null;
- this._pushNotificationDataSetting =
- self.Common.settings.createLocalSetting('pushData', Common.UIString('Test push message from DevTools.'));
+ this._pushNotificationDataSetting = self.Common.settings.createLocalSetting(
+ 'pushData', Common.UIString.UIString('Test push message from DevTools.'));
this._syncTagNameSetting = self.Common.settings.createLocalSetting('syncTagName', 'test-tag-from-devtools');
this._periodicSyncTagNameSetting =
self.Common.settings.createLocalSetting('periodicSyncTagName', 'test-tag-from-devtools');
this._toolbar = section.createToolbar();
this._toolbar.renderAsLinks();
- this._updateButton = new UI.ToolbarButton(Common.UIString('Update'), undefined, Common.UIString('Update'));
- this._updateButton.addEventListener(UI.ToolbarButton.Events.Click, this._updateButtonClicked, this);
+ this._updateButton =
+ new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Update'), undefined, Common.UIString.UIString('Update'));
+ this._updateButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._updateButtonClicked, this);
this._toolbar.appendToolbarItem(this._updateButton);
- this._deleteButton =
- new UI.ToolbarButton(Common.UIString('Unregister service worker'), undefined, Common.UIString('Unregister'));
- this._deleteButton.addEventListener(UI.ToolbarButton.Events.Click, this._unregisterButtonClicked, this);
+ this._deleteButton = new UI.Toolbar.ToolbarButton(
+ Common.UIString.UIString('Unregister service worker'), undefined, Common.UIString.UIString('Unregister'));
+ this._deleteButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._unregisterButtonClicked, this);
this._toolbar.appendToolbarItem(this._deleteButton);
// Preserve the order.
- this._sourceField = this._wrapWidget(this._section.appendField(Common.UIString('Source')));
- this._statusField = this._wrapWidget(this._section.appendField(Common.UIString('Status')));
- this._clientsField = this._wrapWidget(this._section.appendField(Common.UIString('Clients')));
+ this._sourceField = this._wrapWidget(this._section.appendField(Common.UIString.UIString('Source')));
+ this._statusField = this._wrapWidget(this._section.appendField(Common.UIString.UIString('Status')));
+ this._clientsField = this._wrapWidget(this._section.appendField(Common.UIString.UIString('Clients')));
this._createSyncNotificationField(
- Common.UIString('Push'), this._pushNotificationDataSetting.get(), Common.UIString('Push data'),
- this._push.bind(this));
+ Common.UIString.UIString('Push'), this._pushNotificationDataSetting.get(),
+ Common.UIString.UIString('Push data'), this._push.bind(this));
this._createSyncNotificationField(
- Common.UIString('Sync'), this._syncTagNameSetting.get(), Common.UIString('Sync tag'), this._sync.bind(this));
+ Common.UIString.UIString('Sync'), this._syncTagNameSetting.get(), Common.UIString.UIString('Sync tag'),
+ this._sync.bind(this));
this._createSyncNotificationField(
ls`Periodic Sync`, this._periodicSyncTagNameSetting.get(), ls`Periodic Sync tag`,
tag => this._periodicSync(tag));
- this._linkifier = new Components.Linkifier();
+ this._linkifier = new Components.Linkifier.Linkifier();
/** @type {!Map<string, !Protocol.Target.TargetInfo>} */
this._clientInfoCache = new Map();
- this._throttler = new Common.Throttler(500);
+ this._throttler = new Common.Throttler.Throttler(500);
}
/**
@@ -375,7 +384,7 @@
const form =
this._wrapWidget(this._section.appendField(label)).createChild('form', 'service-worker-editor-with-button');
const editor = form.createChild('input', 'source-code service-worker-notification-editor');
- const button = UI.createTextButton(label);
+ const button = UI.UIUtils.createTextButton(label);
button.type = 'submit';
form.appendChild(button);
@@ -399,7 +408,7 @@
/**
* @param {string} versionId
- * @return {?SDK.Target}
+ * @return {?SDK.SDKModel.Target}
*/
_targetForVersionId(versionId) {
const version = this._manager.findVersion(versionId);
@@ -423,11 +432,11 @@
}
/**
- * @param {!SDK.ServiceWorkerVersion} version
+ * @param {!SDK.ServiceWorkerManager.ServiceWorkerVersion} version
*/
_updateClientsField(version) {
this._clientsField.removeChildren();
- this._section.setFieldVisible(Common.UIString('Clients'), version.controlledClients.length);
+ this._section.setFieldVisible(Common.UIString.UIString('Clients'), version.controlledClients.length);
for (const client of version.controlledClients) {
const clientLabelText = this._clientsField.createChild('div', 'service-worker-client');
if (this._clientInfoCache.has(client)) {
@@ -439,17 +448,17 @@
}
/**
- * @param {!SDK.ServiceWorkerVersion} version
+ * @param {!SDK.ServiceWorkerManager.ServiceWorkerVersion} version
*/
_updateSourceField(version) {
this._sourceField.removeChildren();
- const fileName = Common.ParsedURL.extractName(version.scriptURL);
+ const fileName = Common.ParsedURL.ParsedURL.extractName(version.scriptURL);
const name = this._sourceField.createChild('div', 'report-field-value-filename');
- const link = Components.Linkifier.linkifyURL(version.scriptURL, {text: fileName});
+ const link = Components.Linkifier.Linkifier.linkifyURL(version.scriptURL, {text: fileName});
link.tabIndex = 0;
name.appendChild(link);
if (this._registration.errors.length) {
- const errorsLabel = UI.createIconLabel(String(this._registration.errors.length), 'smallicon-error');
+ const errorsLabel = UI.UIUtils.createIconLabel(String(this._registration.errors.length), 'smallicon-error');
errorsLabel.classList.add('link');
errorsLabel.tabIndex = 0;
UI.ARIAUtils.setAccessibleName(errorsLabel, ls`${this._registration.errors.length} registration errors`);
@@ -457,7 +466,7 @@
name.appendChild(errorsLabel);
}
this._sourceField.createChild('div', 'report-field-value-subtitle').textContent =
- Common.UIString('Received %s', new Date(version.scriptResponseTime * 1000).toLocaleString());
+ Common.UIString.UIString('Received %s', new Date(version.scriptResponseTime * 1000).toLocaleString());
}
/**
@@ -474,13 +483,13 @@
const versions = this._registration.versionsByMode();
const scopeURL = this._registration.scopeURL;
- const title = this._registration.isDeleted ? Common.UIString('%s - deleted', scopeURL) : scopeURL;
+ const title = this._registration.isDeleted ? Common.UIString.UIString('%s - deleted', scopeURL) : scopeURL;
this._section.setTitle(title);
- const active = versions.get(SDK.ServiceWorkerVersion.Modes.Active);
- const waiting = versions.get(SDK.ServiceWorkerVersion.Modes.Waiting);
- const installing = versions.get(SDK.ServiceWorkerVersion.Modes.Installing);
- const redundant = versions.get(SDK.ServiceWorkerVersion.Modes.Redundant);
+ const active = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Active);
+ const waiting = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Waiting);
+ const installing = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Installing);
+ const redundant = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Redundant);
this._statusField.removeChildren();
const versionsStack = this._statusField.createChild('div', 'service-worker-version-stack');
@@ -488,44 +497,48 @@
if (active) {
this._updateSourceField(active);
- const localizedRunningStatus = SDK.ServiceWorkerVersion.RunningStatus[active.runningStatus];
+ const localizedRunningStatus = SDK.ServiceWorkerManager.ServiceWorkerVersion.RunningStatus[active.runningStatus];
const activeEntry = this._addVersion(
versionsStack, 'service-worker-active-circle', ls`#${active.id} activated and is ${localizedRunningStatus}`);
if (active.isRunning() || active.isStarting()) {
- this._createLink(activeEntry, Common.UIString('stop'), this._stopButtonClicked.bind(this, active.id));
+ this._createLink(activeEntry, Common.UIString.UIString('stop'), this._stopButtonClicked.bind(this, active.id));
if (!this._targetForVersionId(active.id)) {
- this._createLink(activeEntry, Common.UIString('inspect'), this._inspectButtonClicked.bind(this, active.id));
+ this._createLink(
+ activeEntry, Common.UIString.UIString('inspect'), this._inspectButtonClicked.bind(this, active.id));
}
} else if (active.isStartable()) {
- this._createLink(activeEntry, Common.UIString('start'), this._startButtonClicked.bind(this));
+ this._createLink(activeEntry, Common.UIString.UIString('start'), this._startButtonClicked.bind(this));
}
this._updateClientsField(active);
} else if (redundant) {
this._updateSourceField(redundant);
this._addVersion(
- versionsStack, 'service-worker-redundant-circle', Common.UIString('#%s is redundant', redundant.id));
+ versionsStack, 'service-worker-redundant-circle', Common.UIString.UIString('#%s is redundant', redundant.id));
this._updateClientsField(redundant);
}
if (waiting) {
const waitingEntry = this._addVersion(
- versionsStack, 'service-worker-waiting-circle', Common.UIString('#%s waiting to activate', waiting.id));
- this._createLink(waitingEntry, Common.UIString('skipWaiting'), this._skipButtonClicked.bind(this));
+ versionsStack, 'service-worker-waiting-circle',
+ Common.UIString.UIString('#%s waiting to activate', waiting.id));
+ this._createLink(waitingEntry, Common.UIString.UIString('skipWaiting'), this._skipButtonClicked.bind(this));
waitingEntry.createChild('div', 'service-worker-subtitle').textContent =
- Common.UIString('Received %s', new Date(waiting.scriptResponseTime * 1000).toLocaleString());
+ Common.UIString.UIString('Received %s', new Date(waiting.scriptResponseTime * 1000).toLocaleString());
if (!this._targetForVersionId(waiting.id) && (waiting.isRunning() || waiting.isStarting())) {
- this._createLink(waitingEntry, Common.UIString('inspect'), this._inspectButtonClicked.bind(this, waiting.id));
+ this._createLink(
+ waitingEntry, Common.UIString.UIString('inspect'), this._inspectButtonClicked.bind(this, waiting.id));
}
}
if (installing) {
const installingEntry = this._addVersion(
- versionsStack, 'service-worker-installing-circle', Common.UIString('#%s trying to install', installing.id));
+ versionsStack, 'service-worker-installing-circle',
+ Common.UIString.UIString('#%s trying to install', installing.id));
installingEntry.createChild('div', 'service-worker-subtitle').textContent =
- Common.UIString('Received %s', new Date(installing.scriptResponseTime * 1000).toLocaleString());
+ Common.UIString.UIString('Received %s', new Date(installing.scriptResponseTime * 1000).toLocaleString());
if (!this._targetForVersionId(installing.id) && (installing.isRunning() || installing.isStarting())) {
this._createLink(
- installingEntry, Common.UIString('inspect'), this._inspectButtonClicked.bind(this, installing.id));
+ installingEntry, Common.UIString.UIString('inspect'), this._inspectButtonClicked.bind(this, installing.id));
}
}
return Promise.resolve();
@@ -649,8 +662,8 @@
* @return {!Element}
*/
_wrapWidget(container) {
- const shadowRoot = UI.createShadowRootWithCoreStyles(container);
- UI.appendStyle(shadowRoot, 'resources/serviceWorkersView.css');
+ const shadowRoot = UI.Utils.createShadowRootWithCoreStyles(container);
+ UI.Utils.appendStyle(shadowRoot, 'resources/serviceWorkersView.css');
const contentElement = createElement('div');
shadowRoot.appendChild(contentElement);
return contentElement;
diff --git a/front_end/resources/StorageItemsView.js b/front_end/resources/StorageItemsView.js
index 1fc4de9..0e2bb60 100644
--- a/front_end/resources/StorageItemsView.js
+++ b/front_end/resources/StorageItemsView.js
@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-export class StorageItemsView extends UI.VBox {
+import * as Common from '../common/common.js';
+import * as UI from '../ui/ui.js';
+
+export class StorageItemsView extends UI.Widget.VBox {
/**
* @param {string} title
* @param {string} filterName
@@ -12,17 +15,18 @@
/** @type {?RegExp} */
this._filterRegex = null;
- this._refreshButton = this._addButton(Common.UIString('Refresh'), 'largeicon-refresh', this.refreshItems);
+ this._refreshButton = this._addButton(Common.UIString.UIString('Refresh'), 'largeicon-refresh', this.refreshItems);
- this._mainToolbar = new UI.Toolbar('top-resources-toolbar', this.element);
+ this._mainToolbar = new UI.Toolbar.Toolbar('top-resources-toolbar', this.element);
- this._filterItem = new UI.ToolbarInput(Common.UIString('Filter'), '', 0.4);
- this._filterItem.addEventListener(UI.ToolbarInput.Event.TextChanged, this._filterChanged, this);
+ this._filterItem = new UI.Toolbar.ToolbarInput(Common.UIString.UIString('Filter'), '', 0.4);
+ this._filterItem.addEventListener(UI.Toolbar.ToolbarInput.Event.TextChanged, this._filterChanged, this);
- const toolbarSeparator = new UI.ToolbarSeparator();
- this._deleteAllButton = this._addButton(Common.UIString('Clear All'), 'largeicon-clear', this.deleteAllItems);
+ const toolbarSeparator = new UI.Toolbar.ToolbarSeparator();
+ this._deleteAllButton =
+ this._addButton(Common.UIString.UIString('Clear All'), 'largeicon-clear', this.deleteAllItems);
this._deleteSelectedButton =
- this._addButton(Common.UIString('Delete Selected'), 'largeicon-delete', this.deleteSelectedItem);
+ this._addButton(Common.UIString.UIString('Delete Selected'), 'largeicon-delete', this.deleteSelectedItem);
const toolbarItems =
[this._refreshButton, this._filterItem, toolbarSeparator, this._deleteAllButton, this._deleteSelectedButton];
@@ -33,7 +37,7 @@
/**
- * @param {!UI.ToolbarItem} item
+ * @param {!UI.Toolbar.ToolbarItem} item
*/
appendToolbarItem(item) {
this._mainToolbar.appendToolbarItem(item);
@@ -43,11 +47,11 @@
* @param {string} label
* @param {string} glyph
* @param {!Function} callback
- * @return {!UI.ToolbarButton}
+ * @return {!UI.Toolbar.ToolbarButton}
*/
_addButton(label, glyph, callback) {
- const button = new UI.ToolbarButton(label, glyph);
- button.addEventListener(UI.ToolbarButton.Events.Click, callback, this);
+ const button = new UI.Toolbar.ToolbarButton(label, glyph);
+ button.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, callback, this);
return button;
}