| Index: third_party/WebKit/Source/devtools/front_end/sources/WorkspaceMappingTip.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/WorkspaceMappingTip.js b/third_party/WebKit/Source/devtools/front_end/sources/WorkspaceMappingTip.js
|
| index 220b181334e855d0433b6e6290072bfd4cdb7a1d..d048d5df7f28ce9829d780743a4618bb20f2eb67 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sources/WorkspaceMappingTip.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/WorkspaceMappingTip.js
|
| @@ -4,68 +4,68 @@
|
| /**
|
| * @unrestricted
|
| */
|
| -WebInspector.WorkspaceMappingTip = class {
|
| +Sources.WorkspaceMappingTip = class {
|
| /**
|
| - * @param {!WebInspector.SourcesPanel} sourcesPanel
|
| - * @param {!WebInspector.Workspace} workspace
|
| + * @param {!Sources.SourcesPanel} sourcesPanel
|
| + * @param {!Workspace.Workspace} workspace
|
| */
|
| constructor(sourcesPanel, workspace) {
|
| this._sourcesPanel = sourcesPanel;
|
| this._workspace = workspace;
|
|
|
| this._sourcesView = this._sourcesPanel.sourcesView();
|
| - this._workspaceInfobarDisabledSetting = WebInspector.settings.createSetting('workspaceInfobarDisabled', false);
|
| + this._workspaceInfobarDisabledSetting = Common.settings.createSetting('workspaceInfobarDisabled', false);
|
| this._workspaceMappingInfobarDisabledSetting =
|
| - WebInspector.settings.createSetting('workspaceMappingInfobarDisabled', false);
|
| + Common.settings.createSetting('workspaceMappingInfobarDisabled', false);
|
|
|
| if (this._workspaceInfobarDisabledSetting.get() && this._workspaceMappingInfobarDisabledSetting.get())
|
| return;
|
| - this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSelected, this._editorSelected.bind(this));
|
| - WebInspector.persistence.addEventListener(
|
| - WebInspector.Persistence.Events.BindingCreated, this._bindingCreated, this);
|
| + this._sourcesView.addEventListener(Sources.SourcesView.Events.EditorSelected, this._editorSelected.bind(this));
|
| + Persistence.persistence.addEventListener(
|
| + Persistence.Persistence.Events.BindingCreated, this._bindingCreated, this);
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.Event} event
|
| + * @param {!Common.Event} event
|
| */
|
| _bindingCreated(event) {
|
| - var binding = /** @type {!WebInspector.PersistenceBinding} */ (event.data);
|
| - if (binding.network[WebInspector.WorkspaceMappingTip._infobarSymbol])
|
| - binding.network[WebInspector.WorkspaceMappingTip._infobarSymbol].dispose();
|
| - if (binding.fileSystem[WebInspector.WorkspaceMappingTip._infobarSymbol])
|
| - binding.fileSystem[WebInspector.WorkspaceMappingTip._infobarSymbol].dispose();
|
| + var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data);
|
| + if (binding.network[Sources.WorkspaceMappingTip._infobarSymbol])
|
| + binding.network[Sources.WorkspaceMappingTip._infobarSymbol].dispose();
|
| + if (binding.fileSystem[Sources.WorkspaceMappingTip._infobarSymbol])
|
| + binding.fileSystem[Sources.WorkspaceMappingTip._infobarSymbol].dispose();
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.Event} event
|
| + * @param {!Common.Event} event
|
| */
|
| _editorSelected(event) {
|
| - var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data);
|
| + var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
|
| if (this._editorSelectedTimer)
|
| clearTimeout(this._editorSelectedTimer);
|
| this._editorSelectedTimer = setTimeout(this._updateSuggestedMappingInfobar.bind(this, uiSourceCode), 3000);
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @param {!Workspace.UISourceCode} uiSourceCode
|
| */
|
| _updateSuggestedMappingInfobar(uiSourceCode) {
|
| var uiSourceCodeFrame = this._sourcesView.viewForFile(uiSourceCode);
|
|
|
| if (!uiSourceCodeFrame.isShowing())
|
| return;
|
| - if (uiSourceCode[WebInspector.WorkspaceMappingTip._infobarSymbol])
|
| + if (uiSourceCode[Sources.WorkspaceMappingTip._infobarSymbol])
|
| return;
|
|
|
| // First try mapping filesystem -> network.
|
| if (!this._workspaceMappingInfobarDisabledSetting.get() &&
|
| - uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem) {
|
| - if (WebInspector.persistence.binding(uiSourceCode))
|
| + uiSourceCode.project().type() === Workspace.projectTypes.FileSystem) {
|
| + if (Persistence.persistence.binding(uiSourceCode))
|
| return;
|
|
|
| - var networkProjects = this._workspace.projectsForType(WebInspector.projectTypes.Network);
|
| + var networkProjects = this._workspace.projectsForType(Workspace.projectTypes.Network);
|
| networkProjects =
|
| - networkProjects.concat(this._workspace.projectsForType(WebInspector.projectTypes.ContentScripts));
|
| + networkProjects.concat(this._workspace.projectsForType(Workspace.projectTypes.ContentScripts));
|
| for (var i = 0; i < networkProjects.length; ++i) {
|
| var name = uiSourceCode.name();
|
| var networkUiSourceCodes = networkProjects[i].uiSourceCodes();
|
| @@ -79,13 +79,13 @@ WebInspector.WorkspaceMappingTip = class {
|
| }
|
|
|
| // Then map network -> filesystem.
|
| - if (uiSourceCode.project().type() === WebInspector.projectTypes.Network ||
|
| - uiSourceCode.project().type() === WebInspector.projectTypes.ContentScripts) {
|
| + if (uiSourceCode.project().type() === Workspace.projectTypes.Network ||
|
| + uiSourceCode.project().type() === Workspace.projectTypes.ContentScripts) {
|
| // Suggest for localhost only.
|
| - if (!this._isLocalHost(uiSourceCode.url()) || WebInspector.persistence.binding(uiSourceCode))
|
| + if (!this._isLocalHost(uiSourceCode.url()) || Persistence.persistence.binding(uiSourceCode))
|
| return;
|
|
|
| - var filesystemProjects = this._workspace.projectsForType(WebInspector.projectTypes.FileSystem);
|
| + var filesystemProjects = this._workspace.projectsForType(Workspace.projectTypes.FileSystem);
|
| for (var i = 0; i < filesystemProjects.length; ++i) {
|
| var name = uiSourceCode.name();
|
| var fsUiSourceCodes = filesystemProjects[i].uiSourceCodes();
|
| @@ -111,75 +111,75 @@ WebInspector.WorkspaceMappingTip = class {
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @param {!Workspace.UISourceCode} uiSourceCode
|
| */
|
| _showWorkspaceInfobar(uiSourceCode) {
|
| - var infobar = WebInspector.Infobar.create(
|
| - WebInspector.Infobar.Type.Info,
|
| - WebInspector.UIString('Serving from the file system? Add your files into the workspace.'),
|
| + var infobar = UI.Infobar.create(
|
| + UI.Infobar.Type.Info,
|
| + Common.UIString('Serving from the file system? Add your files into the workspace.'),
|
| this._workspaceInfobarDisabledSetting);
|
| if (!infobar)
|
| return;
|
| - infobar.createDetailsRowMessage(WebInspector.UIString(
|
| + infobar.createDetailsRowMessage(Common.UIString(
|
| 'If you add files into your DevTools workspace, your changes will be persisted to disk.'));
|
| infobar.createDetailsRowMessage(
|
| - WebInspector.UIString('To add a folder into the workspace, drag and drop it into the Sources panel.'));
|
| + Common.UIString('To add a folder into the workspace, drag and drop it into the Sources panel.'));
|
| this._appendInfobar(uiSourceCode, infobar);
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @param {!Workspace.UISourceCode} uiSourceCode
|
| * @param {boolean} isNetwork
|
| */
|
| _showMappingInfobar(uiSourceCode, isNetwork) {
|
| var title;
|
| if (isNetwork)
|
| - title = WebInspector.UIString('Map network resource \'%s\' to workspace?', uiSourceCode.url());
|
| + title = Common.UIString('Map network resource \'%s\' to workspace?', uiSourceCode.url());
|
| else
|
| - title = WebInspector.UIString('Map workspace resource \'%s\' to network?', uiSourceCode.url());
|
| + title = Common.UIString('Map workspace resource \'%s\' to network?', uiSourceCode.url());
|
|
|
| - var infobar = WebInspector.Infobar.create(
|
| - WebInspector.Infobar.Type.Info, title, this._workspaceMappingInfobarDisabledSetting);
|
| + var infobar = UI.Infobar.create(
|
| + UI.Infobar.Type.Info, title, this._workspaceMappingInfobarDisabledSetting);
|
| if (!infobar)
|
| return;
|
| - infobar.createDetailsRowMessage(WebInspector.UIString(
|
| + infobar.createDetailsRowMessage(Common.UIString(
|
| 'You can map files in your workspace to the ones loaded over the network. As a result, changes made in DevTools will be persisted to disk.'));
|
| - infobar.createDetailsRowMessage(WebInspector.UIString('Use context menu to establish the mapping at any time.'));
|
| + infobar.createDetailsRowMessage(Common.UIString('Use context menu to establish the mapping at any time.'));
|
| var anchor = createElementWithClass('a', 'link');
|
| - anchor.textContent = WebInspector.UIString('Establish the mapping now...');
|
| + anchor.textContent = Common.UIString('Establish the mapping now...');
|
| anchor.addEventListener('click', this._establishTheMapping.bind(this, uiSourceCode), false);
|
| infobar.createDetailsRowMessage('').appendChild(anchor);
|
| this._appendInfobar(uiSourceCode, infobar);
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @param {!Workspace.UISourceCode} uiSourceCode
|
| * @param {?Event} event
|
| */
|
| _establishTheMapping(uiSourceCode, event) {
|
| event.consume(true);
|
| - if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem)
|
| + if (uiSourceCode.project().type() === Workspace.projectTypes.FileSystem)
|
| this._sourcesPanel.mapFileSystemToNetwork(uiSourceCode);
|
| else
|
| this._sourcesPanel.mapNetworkToFileSystem(uiSourceCode);
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @param {!WebInspector.Infobar} infobar
|
| + * @param {!Workspace.UISourceCode} uiSourceCode
|
| + * @param {!UI.Infobar} infobar
|
| */
|
| _appendInfobar(uiSourceCode, infobar) {
|
| var uiSourceCodeFrame = this._sourcesView.viewForFile(uiSourceCode);
|
|
|
| var rowElement =
|
| - infobar.createDetailsRowMessage(WebInspector.UIString('For more information on workspaces, refer to the '));
|
| - rowElement.appendChild(WebInspector.linkifyDocumentationURLAsNode(
|
| - '../setup/setup-workflow', WebInspector.UIString('workspaces documentation')));
|
| + infobar.createDetailsRowMessage(Common.UIString('For more information on workspaces, refer to the '));
|
| + rowElement.appendChild(UI.linkifyDocumentationURLAsNode(
|
| + '../setup/setup-workflow', Common.UIString('workspaces documentation')));
|
| rowElement.createTextChild('.');
|
| - uiSourceCode[WebInspector.WorkspaceMappingTip._infobarSymbol] = infobar;
|
| + uiSourceCode[Sources.WorkspaceMappingTip._infobarSymbol] = infobar;
|
| uiSourceCodeFrame.attachInfobars([infobar]);
|
| - WebInspector.runCSSAnimationOnce(infobar.element, 'source-frame-infobar-animation');
|
| + UI.runCSSAnimationOnce(infobar.element, 'source-frame-infobar-animation');
|
| }
|
| };
|
|
|
| -WebInspector.WorkspaceMappingTip._infobarSymbol = Symbol('infobar');
|
| +Sources.WorkspaceMappingTip._infobarSymbol = Symbol('infobar');
|
|
|