Commit a332bbea authored by Tim van der Lippe's avatar Tim van der Lippe Committed by Commit Bot

Migrate extensions/ to ESM

Bug: 1006759
Change-Id: I55ff55840cbf00a108cb0f3630cf5b489bf3aac2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1849386Reviewed-by: default avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704574}
parent ca0e3774
...@@ -259,11 +259,6 @@ if (!external_devtools_frontend) { ...@@ -259,11 +259,6 @@ if (!external_devtools_frontend) {
"front_end/event_listeners/eventListenersView.css", "front_end/event_listeners/eventListenersView.css",
"front_end/event_listeners/EventListenersView.js", "front_end/event_listeners/EventListenersView.js",
"front_end/event_listeners/module.json", "front_end/event_listeners/module.json",
"front_end/extensions/ExtensionAPI.js",
"front_end/extensions/ExtensionPanel.js",
"front_end/extensions/ExtensionServer.js",
"front_end/extensions/ExtensionTraceProvider.js",
"front_end/extensions/ExtensionView.js",
"front_end/extensions/module.json", "front_end/extensions/module.json",
"front_end/extensions_test_runner/ExtensionsNetworkTestRunner.js", "front_end/extensions_test_runner/ExtensionsNetworkTestRunner.js",
"front_end/extensions_test_runner/ExtensionsTestRunner.js", "front_end/extensions_test_runner/ExtensionsTestRunner.js",
...@@ -820,6 +815,12 @@ if (!external_devtools_frontend) { ...@@ -820,6 +815,12 @@ if (!external_devtools_frontend) {
all_devtools_files += lighthouse_locale_files all_devtools_files += lighthouse_locale_files
all_devtools_modules = [ all_devtools_modules = [
"front_end/extensions/extensions.js",
"front_end/extensions/ExtensionAPI.js",
"front_end/extensions/ExtensionPanel.js",
"front_end/extensions/ExtensionServer.js",
"front_end/extensions/ExtensionTraceProvider.js",
"front_end/extensions/ExtensionView.js",
"front_end/browser_sdk/browser_sdk.js", "front_end/browser_sdk/browser_sdk.js",
"front_end/browser_sdk/LogManager.js", "front_end/browser_sdk/LogManager.js",
"front_end/persistence/persistence.js", "front_end/persistence/persistence.js",
...@@ -1210,6 +1211,12 @@ if (!external_devtools_frontend) { ...@@ -1210,6 +1211,12 @@ if (!external_devtools_frontend) {
] ]
copied_devtools_modules = [ copied_devtools_modules = [
"$resources_out_dir/extensions/extensions.js",
"$resources_out_dir/extensions/ExtensionAPI.js",
"$resources_out_dir/extensions/ExtensionPanel.js",
"$resources_out_dir/extensions/ExtensionServer.js",
"$resources_out_dir/extensions/ExtensionTraceProvider.js",
"$resources_out_dir/extensions/ExtensionView.js",
"$resources_out_dir/browser_sdk/browser_sdk.js", "$resources_out_dir/browser_sdk/browser_sdk.js",
"$resources_out_dir/browser_sdk/LogManager.js", "$resources_out_dir/browser_sdk/LogManager.js",
"$resources_out_dir/persistence/persistence.js", "$resources_out_dir/persistence/persistence.js",
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/* eslint-disable indent */
function defineCommonExtensionSymbols(apiPrivate) { function defineCommonExtensionSymbols(apiPrivate) {
if (!apiPrivate.panels) { if (!apiPrivate.panels) {
apiPrivate.panels = {}; apiPrivate.panels = {};
...@@ -95,7 +93,8 @@ function defineCommonExtensionSymbols(apiPrivate) { ...@@ -95,7 +93,8 @@ function defineCommonExtensionSymbols(apiPrivate) {
* @param {function(!Object, !Object)} testHook * @param {function(!Object, !Object)} testHook
* @suppressGlobalPropertiesCheck * @suppressGlobalPropertiesCheck
*/ */
function injectedExtensionAPI(extensionInfo, inspectedTabId, themeName, keysToForward, testHook, injectedScriptId) { self.injectedExtensionAPI = function(
extensionInfo, inspectedTabId, themeName, keysToForward, testHook, injectedScriptId) {
const keysToForwardSet = new Set(keysToForward); const keysToForwardSet = new Set(keysToForward);
const chrome = window.chrome || {}; const chrome = window.chrome || {};
const devtools_descriptor = Object.getOwnPropertyDescriptor(chrome, 'devtools'); const devtools_descriptor = Object.getOwnPropertyDescriptor(chrome, 'devtools');
...@@ -827,7 +826,7 @@ function injectedExtensionAPI(extensionInfo, inspectedTabId, themeName, keysToFo ...@@ -827,7 +826,7 @@ function injectedExtensionAPI(extensionInfo, inspectedTabId, themeName, keysToFo
window.webInspector = coreAPI; window.webInspector = coreAPI;
} }
testHook(extensionServer, coreAPI); testHook(extensionServer, coreAPI);
} };
/** /**
* @param {!ExtensionDescriptor} extensionInfo * @param {!ExtensionDescriptor} extensionInfo
...@@ -843,6 +842,15 @@ self.buildExtensionAPIInjectedScript = function(extensionInfo, inspectedTabId, t ...@@ -843,6 +842,15 @@ self.buildExtensionAPIInjectedScript = function(extensionInfo, inspectedTabId, t
testHook = () => {}; testHook = () => {};
} }
return '(function(injectedScriptId){ ' + defineCommonExtensionSymbols.toString() + ';' + return '(function(injectedScriptId){ ' + defineCommonExtensionSymbols.toString() + ';' +
'(' + injectedExtensionAPI.toString() + ')(' + argumentsJSON + ',' + testHook + ', injectedScriptId);' + '(' + self.injectedExtensionAPI.toString() + ')(' + argumentsJSON + ',' + testHook + ', injectedScriptId);' +
'})'; '})';
}; };
/* Legacy exported object */
self.Extensions = self.Extensions || {};
/* Legacy exported object */
Extensions = Extensions || {};
Extensions.extensionAPI = {};
defineCommonExtensionSymbols(Extensions.extensionAPI);
\ No newline at end of file
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* @implements {UI.Searchable} * @implements {UI.Searchable}
* @unrestricted * @unrestricted
*/ */
Extensions.ExtensionPanel = class extends UI.Panel { export default class ExtensionPanel extends UI.Panel {
/** /**
* @param {!Extensions.ExtensionServer} server * @param {!Extensions.ExtensionServer} server
* @param {string} panelName * @param {string} panelName
...@@ -116,12 +116,12 @@ Extensions.ExtensionPanel = class extends UI.Panel { ...@@ -116,12 +116,12 @@ Extensions.ExtensionPanel = class extends UI.Panel {
supportsRegexSearch() { supportsRegexSearch() {
return false; return false;
} }
}; }
/** /**
* @unrestricted * @unrestricted
*/ */
Extensions.ExtensionButton = class { export class ExtensionButton {
/** /**
* @param {!Extensions.ExtensionServer} server * @param {!Extensions.ExtensionServer} server
* @param {string} id * @param {string} id
...@@ -161,12 +161,12 @@ Extensions.ExtensionButton = class { ...@@ -161,12 +161,12 @@ Extensions.ExtensionButton = class {
toolbarButton() { toolbarButton() {
return this._toolbarButton; return this._toolbarButton;
} }
}; }
/** /**
* @unrestricted * @unrestricted
*/ */
Extensions.ExtensionSidebarPane = class extends UI.SimpleView { export class ExtensionSidebarPane extends UI.SimpleView {
/** /**
* @param {!Extensions.ExtensionServer} server * @param {!Extensions.ExtensionServer} server
* @param {string} panelName * @param {string} panelName
...@@ -296,4 +296,19 @@ Extensions.ExtensionSidebarPane = class extends UI.SimpleView { ...@@ -296,4 +296,19 @@ Extensions.ExtensionSidebarPane = class extends UI.SimpleView {
callback(); callback();
}); });
} }
}; }
/* Legacy exported object */
self.Extensions = self.Extensions || {};
/* Legacy exported object */
Extensions = Extensions || {};
/** @constructor */
Extensions.ExtensionPanel = ExtensionPanel;
/** @constructor */
Extensions.ExtensionButton = ExtensionButton;
/** @constructor */
Extensions.ExtensionSidebarPane = ExtensionSidebarPane;
\ No newline at end of file
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
/** /**
* @unrestricted * @unrestricted
*/ */
Extensions.ExtensionServer = class extends Common.Object { export default class ExtensionServer extends Common.Object {
/** /**
* @suppressGlobalPropertiesCheck * @suppressGlobalPropertiesCheck
*/ */
...@@ -46,7 +46,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -46,7 +46,7 @@ Extensions.ExtensionServer = class extends Common.Object {
this._requests = {}; this._requests = {};
this._lastRequestId = 0; this._lastRequestId = 0;
this._registeredExtensions = {}; this._registeredExtensions = {};
this._status = new Extensions.ExtensionStatus(); this._status = new ExtensionStatus();
/** @type {!Array<!Extensions.ExtensionSidebarPane>} */ /** @type {!Array<!Extensions.ExtensionSidebarPane>} */
this._sidebarPanes = []; this._sidebarPanes = [];
/** @type {!Array<!Extensions.ExtensionTraceProvider>} */ /** @type {!Array<!Extensions.ExtensionTraceProvider>} */
...@@ -263,7 +263,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -263,7 +263,7 @@ Extensions.ExtensionServer = class extends Common.Object {
const page = this._expandResourcePath(port._extensionOrigin, message.page); const page = this._expandResourcePath(port._extensionOrigin, message.page);
let persistentId = port._extensionOrigin + message.title; let persistentId = port._extensionOrigin + message.title;
persistentId = persistentId.replace(/\s/g, ''); persistentId = persistentId.replace(/\s/g, '');
const panelView = new Extensions.ExtensionServerPanelView( const panelView = new ExtensionServerPanelView(
persistentId, message.title, new Extensions.ExtensionPanel(this, persistentId, id, page)); persistentId, message.title, new Extensions.ExtensionPanel(this, persistentId, id, page));
this._clientObjects[id] = panelView; this._clientObjects[id] = panelView;
UI.inspectorView.addPanel(panelView); UI.inspectorView.addPanel(panelView);
...@@ -273,7 +273,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -273,7 +273,7 @@ Extensions.ExtensionServer = class extends Common.Object {
_onShowPanel(message) { _onShowPanel(message) {
let panelViewId = message.id; let panelViewId = message.id;
const panelView = this._clientObjects[message.id]; const panelView = this._clientObjects[message.id];
if (panelView && panelView instanceof Extensions.ExtensionServerPanelView) { if (panelView && panelView instanceof ExtensionServerPanelView) {
panelViewId = panelView.viewId(); panelViewId = panelView.viewId();
} }
UI.inspectorView.showPanel(panelViewId); UI.inspectorView.showPanel(panelViewId);
...@@ -281,7 +281,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -281,7 +281,7 @@ Extensions.ExtensionServer = class extends Common.Object {
_onCreateToolbarButton(message, port) { _onCreateToolbarButton(message, port) {
const panelView = this._clientObjects[message.panel]; const panelView = this._clientObjects[message.panel];
if (!panelView || !(panelView instanceof Extensions.ExtensionServerPanelView)) { if (!panelView || !(panelView instanceof ExtensionServerPanelView)) {
return this._status.E_NOTFOUND(message.panel); return this._status.E_NOTFOUND(message.panel);
} }
const button = new Extensions.ExtensionButton( const button = new Extensions.ExtensionButton(
...@@ -330,7 +330,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -330,7 +330,7 @@ Extensions.ExtensionServer = class extends Common.Object {
const sidebar = new Extensions.ExtensionSidebarPane(this, message.panel, message.title, id); const sidebar = new Extensions.ExtensionSidebarPane(this, message.panel, message.title, id);
this._sidebarPanes.push(sidebar); this._sidebarPanes.push(sidebar);
this._clientObjects[id] = sidebar; this._clientObjects[id] = sidebar;
this.dispatchEventToListeners(Extensions.ExtensionServer.Events.SidebarPaneAdded, sidebar); this.dispatchEventToListeners(Events.SidebarPaneAdded, sidebar);
return this._status.OK(); return this._status.OK();
} }
...@@ -358,7 +358,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -358,7 +358,7 @@ Extensions.ExtensionServer = class extends Common.Object {
} }
/** /**
* @this {Extensions.ExtensionServer} * @this {ExtensionServer}
*/ */
function callback(error) { function callback(error) {
const result = error ? this._status.E_FAILED(error) : this._status.OK(); const result = error ? this._status.E_FAILED(error) : this._status.OK();
...@@ -432,7 +432,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -432,7 +432,7 @@ Extensions.ExtensionServer = class extends Common.Object {
* @param {?Protocol.Error} error * @param {?Protocol.Error} error
* @param {?SDK.RemoteObject} object * @param {?SDK.RemoteObject} object
* @param {boolean} wasThrown * @param {boolean} wasThrown
* @this {Extensions.ExtensionServer} * @this {ExtensionServer}
*/ */
function callback(error, object, wasThrown) { function callback(error, object, wasThrown) {
let result; let result;
...@@ -474,7 +474,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -474,7 +474,7 @@ Extensions.ExtensionServer = class extends Common.Object {
const resources = new Map(); const resources = new Map();
/** /**
* @this {Extensions.ExtensionServer} * @this {ExtensionServer}
*/ */
function pushResourceData(contentProvider) { function pushResourceData(contentProvider) {
if (!resources.has(contentProvider.contentURL())) { if (!resources.has(contentProvider.contentURL())) {
...@@ -522,7 +522,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -522,7 +522,7 @@ Extensions.ExtensionServer = class extends Common.Object {
_onSetResourceContent(message, port) { _onSetResourceContent(message, port) {
/** /**
* @param {?Protocol.Error} error * @param {?Protocol.Error} error
* @this {Extensions.ExtensionServer} * @this {ExtensionServer}
*/ */
function callbackWrapper(error) { function callbackWrapper(error) {
const response = error ? this._status.E_FAILED(error) : this._status.OK(); const response = error ? this._status.E_FAILED(error) : this._status.OK();
...@@ -566,7 +566,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -566,7 +566,7 @@ Extensions.ExtensionServer = class extends Common.Object {
port._extensionOrigin, message.id, message.categoryName, message.categoryTooltip); port._extensionOrigin, message.id, message.categoryName, message.categoryTooltip);
this._clientObjects[message.id] = provider; this._clientObjects[message.id] = provider;
this._traceProviders.push(provider); this._traceProviders.push(provider);
this.dispatchEventToListeners(Extensions.ExtensionServer.Events.TraceProviderAdded, provider); this.dispatchEventToListeners(Events.TraceProviderAdded, provider);
} }
/** /**
...@@ -627,14 +627,14 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -627,14 +627,14 @@ Extensions.ExtensionServer = class extends Common.Object {
SDK.NetworkManager.Events.RequestFinished, this._notifyRequestFinished); SDK.NetworkManager.Events.RequestFinished, this._notifyRequestFinished);
/** /**
* @this {Extensions.ExtensionServer} * @this {ExtensionServer}
*/ */
function onElementsSubscriptionStarted() { function onElementsSubscriptionStarted() {
UI.context.addFlavorChangeListener(SDK.DOMNode, this._notifyElementsSelectionChanged, this); UI.context.addFlavorChangeListener(SDK.DOMNode, this._notifyElementsSelectionChanged, this);
} }
/** /**
* @this {Extensions.ExtensionServer} * @this {ExtensionServer}
*/ */
function onElementsSubscriptionStopped() { function onElementsSubscriptionStopped() {
UI.context.removeFlavorChangeListener(SDK.DOMNode, this._notifyElementsSelectionChanged, this); UI.context.removeFlavorChangeListener(SDK.DOMNode, this._notifyElementsSelectionChanged, this);
...@@ -709,9 +709,8 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -709,9 +709,8 @@ Extensions.ExtensionServer = class extends Common.Object {
const extensionOrigin = originMatch[1]; const extensionOrigin = originMatch[1];
if (!this._registeredExtensions[extensionOrigin]) { if (!this._registeredExtensions[extensionOrigin]) {
// See ExtensionAPI.js for details. // See ExtensionAPI.js for details.
const injectedAPI = buildExtensionAPIInjectedScript( const injectedAPI = self.buildExtensionAPIInjectedScript(
extensionInfo, this._inspectedTabId, UI.themeSupport.themeName(), extensionInfo, this._inspectedTabId, UI.themeSupport.themeName(), UI.shortcutRegistry.globalShortcutKeys(),
UI.shortcutRegistry.globalShortcutKeys(),
Extensions.extensionServer['_extensionAPITestHook']); Extensions.extensionServer['_extensionAPITestHook']);
Host.InspectorFrontendHost.setInjectedScriptForOrigin(extensionOrigin, injectedAPI); Host.InspectorFrontendHost.setInjectedScriptForOrigin(extensionOrigin, injectedAPI);
this._registeredExtensions[extensionOrigin] = {name: name}; this._registeredExtensions[extensionOrigin] = {name: name};
...@@ -798,7 +797,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -798,7 +797,7 @@ Extensions.ExtensionServer = class extends Common.Object {
_registerResourceContentCommittedHandler(handler) { _registerResourceContentCommittedHandler(handler) {
/** /**
* @this {Extensions.ExtensionServer} * @this {ExtensionServer}
*/ */
function addFirstEventListener() { function addFirstEventListener() {
Workspace.workspace.addEventListener(Workspace.Workspace.Events.WorkingCopyCommittedByUser, handler, this); Workspace.workspace.addEventListener(Workspace.Workspace.Events.WorkingCopyCommittedByUser, handler, this);
...@@ -806,7 +805,7 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -806,7 +805,7 @@ Extensions.ExtensionServer = class extends Common.Object {
} }
/** /**
* @this {Extensions.ExtensionServer} * @this {ExtensionServer}
*/ */
function removeLastEventListener() { function removeLastEventListener() {
Workspace.workspace.setHasResourceContentTrackingExtensions(false); Workspace.workspace.setHasResourceContentTrackingExtensions(false);
...@@ -947,10 +946,10 @@ Extensions.ExtensionServer = class extends Common.Object { ...@@ -947,10 +946,10 @@ Extensions.ExtensionServer = class extends Common.Object {
callback(null, result.object || null, !!result.exceptionDetails); callback(null, result.object || null, !!result.exceptionDetails);
} }
} }
}; }
/** @enum {symbol} */ /** @enum {symbol} */
Extensions.ExtensionServer.Events = { export const Events = {
SidebarPaneAdded: Symbol('SidebarPaneAdded'), SidebarPaneAdded: Symbol('SidebarPaneAdded'),
TraceProviderAdded: Symbol('TraceProviderAdded') TraceProviderAdded: Symbol('TraceProviderAdded')
}; };
...@@ -958,7 +957,7 @@ Extensions.ExtensionServer.Events = { ...@@ -958,7 +957,7 @@ Extensions.ExtensionServer.Events = {
/** /**
* @unrestricted * @unrestricted
*/ */
Extensions.ExtensionServerPanelView = class extends UI.SimpleView { export class ExtensionServerPanelView extends UI.SimpleView {
/** /**
* @param {string} name * @param {string} name
* @param {string} title * @param {string} title
...@@ -985,12 +984,12 @@ Extensions.ExtensionServerPanelView = class extends UI.SimpleView { ...@@ -985,12 +984,12 @@ Extensions.ExtensionServerPanelView = class extends UI.SimpleView {
widget() { widget() {
return /** @type {!Promise.<!UI.Widget>} */ (Promise.resolve(this._panel)); return /** @type {!Promise.<!UI.Widget>} */ (Promise.resolve(this._panel));
} }
}; }
/** /**
* @unrestricted * @unrestricted
*/ */
Extensions.ExtensionStatus = class { export class ExtensionStatus {
constructor() { constructor() {
/** /**
* @param {string} code * @param {string} code
...@@ -1016,15 +1015,30 @@ Extensions.ExtensionStatus = class { ...@@ -1016,15 +1015,30 @@ Extensions.ExtensionStatus = class {
this.E_PROTOCOLERROR = makeStatus.bind(null, 'E_PROTOCOLERROR', 'Inspector protocol error: %s'); this.E_PROTOCOLERROR = makeStatus.bind(null, 'E_PROTOCOLERROR', 'Inspector protocol error: %s');
this.E_FAILED = makeStatus.bind(null, 'E_FAILED', 'Operation failed: %s'); this.E_FAILED = makeStatus.bind(null, 'E_FAILED', 'Operation failed: %s');
} }
}; }
/* Legacy exported object */
self.Extensions = self.Extensions || {};
/* Legacy exported object */
Extensions = Extensions || {};
/** @constructor */
Extensions.ExtensionServer = ExtensionServer;
/** @enum {symbol} */
Extensions.ExtensionServer.Events = Events;
/** @constructor */
Extensions.ExtensionServerPanelView = ExtensionServerPanelView;
/** @constructor */
Extensions.ExtensionStatus = ExtensionStatus;
/** /**
* @typedef {{code: string, description: string, details: !Array.<*>}} * @typedef {{code: string, description: string, details: !Array.<*>}}
*/ */
Extensions.ExtensionStatus.Record; Extensions.ExtensionStatus.Record;
Extensions.extensionAPI = {}; /** @type {!ExtensionServer} */
defineCommonExtensionSymbols(Extensions.extensionAPI);
/** @type {!Extensions.ExtensionServer} */
Extensions.extensionServer; Extensions.extensionServer;
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/** /**
* @unrestricted * @unrestricted
*/ */
Extensions.ExtensionTraceProvider = class { export default class ExtensionTraceProvider {
/** /**
* @param {string} extensionOrigin * @param {string} extensionOrigin
* @param {string} id * @param {string} id
...@@ -20,10 +20,10 @@ Extensions.ExtensionTraceProvider = class { ...@@ -20,10 +20,10 @@ Extensions.ExtensionTraceProvider = class {
} }
/** /**
* @param {!Extensions.TracingSession} session * @param {!TracingSession} session
*/ */
start(session) { start(session) {
const sessionId = String(++Extensions.ExtensionTraceProvider._lastSessionId); const sessionId = String(++_lastSessionId);
Extensions.extensionServer.startTraceRecording(this._id, sessionId, session); Extensions.extensionServer.startTraceRecording(this._id, sessionId, session);
} }
...@@ -51,19 +51,32 @@ Extensions.ExtensionTraceProvider = class { ...@@ -51,19 +51,32 @@ Extensions.ExtensionTraceProvider = class {
persistentIdentifier() { persistentIdentifier() {
return `${this._extensionOrigin}/${this._categoryName}`; return `${this._extensionOrigin}/${this._categoryName}`;
} }
}; }
Extensions.ExtensionTraceProvider._lastSessionId = 0; export let _lastSessionId = 0;
/** /**
* @interface * @interface
*/ */
Extensions.TracingSession = function() {}; export class TracingSession {
Extensions.TracingSession.prototype = {
/** /**
* @param {string} url * @param {string} url
* @param {number} timeOffsetMicroseconds * @param {number} timeOffsetMicroseconds
*/ */
complete: function(url, timeOffsetMicroseconds) {} complete(url, timeOffsetMicroseconds) {
}; }
}
/* Legacy exported object */
self.Extensions = self.Extensions || {};
/* Legacy exported object */
Extensions = Extensions || {};
/** @constructor */
Extensions.ExtensionTraceProvider = ExtensionTraceProvider;
Extensions.ExtensionTraceProvider._lastSessionId = _lastSessionId;
/** @interface */
Extensions.TracingSession = TracingSession;
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
/** /**
* @unrestricted * @unrestricted
*/ */
Extensions.ExtensionView = class extends UI.Widget { export default class ExtensionView extends UI.Widget {
/** /**
* @param {!Extensions.ExtensionServer} server * @param {!Extensions.ExtensionServer} server
* @param {string} id * @param {string} id
...@@ -84,12 +84,12 @@ Extensions.ExtensionView = class extends UI.Widget { ...@@ -84,12 +84,12 @@ Extensions.ExtensionView = class extends UI.Widget {
this._server.notifyViewShown(this._id, this._frameIndex); this._server.notifyViewShown(this._id, this._frameIndex);
} }
} }
}; }
/** /**
* @unrestricted * @unrestricted
*/ */
Extensions.ExtensionNotifierView = class extends UI.VBox { export class ExtensionNotifierView extends UI.VBox {
/** /**
* @param {!Extensions.ExtensionServer} server * @param {!Extensions.ExtensionServer} server
* @param {string} id * @param {string} id
...@@ -114,4 +114,16 @@ Extensions.ExtensionNotifierView = class extends UI.VBox { ...@@ -114,4 +114,16 @@ Extensions.ExtensionNotifierView = class extends UI.VBox {
willHide() { willHide() {
this._server.notifyViewHidden(this._id); this._server.notifyViewHidden(this._id);
} }
}; }
/* Legacy exported object */
self.Extensions = self.Extensions || {};
/* Legacy exported object */
Extensions = Extensions || {};
/** @constructor */
Extensions.ExtensionView = ExtensionView;
/** @constructor */
Extensions.ExtensionNotifierView = ExtensionNotifierView;
\ No newline at end of file
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import './ExtensionAPI.js';
import * as ExtensionPanel from './ExtensionPanel.js';
import * as ExtensionServer from './ExtensionServer.js';
import * as ExtensionTraceProvider from './ExtensionTraceProvider.js';
import * as ExtensionView from './ExtensionView.js';
export {
ExtensionPanel,
ExtensionServer,
ExtensionTraceProvider,
ExtensionView,
};
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
"browser_sdk", "browser_sdk",
"common" "common"
], ],
"scripts": [ "scripts": [],
"modules": [
"extensions.js",
"ExtensionAPI.js", "ExtensionAPI.js",
"ExtensionTraceProvider.js", "ExtensionTraceProvider.js",
"ExtensionServer.js", "ExtensionServer.js",
......
...@@ -16,4 +16,5 @@ import './workspace/workspace.js'; ...@@ -16,4 +16,5 @@ import './workspace/workspace.js';
import './bindings/bindings.js'; import './bindings/bindings.js';
import './components/components.js'; import './components/components.js';
import './persistence/persistence.js'; import './persistence/persistence.js';
import './browser_sdk/browser_sdk.js'; import './browser_sdk/browser_sdk.js';
\ No newline at end of file import './extensions/extensions.js';
...@@ -42,7 +42,7 @@ def write_devtools_extension_api(output, input_names): ...@@ -42,7 +42,7 @@ def write_devtools_extension_api(output, input_names):
var tabId; var tabId;
var extensionInfo = {}; var extensionInfo = {};
var extensionServer; var extensionServer;
platformExtensionAPI(injectedExtensionAPI("remote-" + window.parent.frames.length)); platformExtensionAPI(self.injectedExtensionAPI("remote-" + window.parent.frames.length));
})();""") })();""")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment