| Index: third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js
|
| index d823f2e54432b820199ebafea50baa5ae3f9821d..dcea4a102985a5eddc512735c34ced5ec63e2fe2 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js
|
| @@ -25,286 +25,250 @@
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
| -
|
| /**
|
| - * @constructor
|
| - * @extends {WebInspector.NavigatorView}
|
| + * @unrestricted
|
| */
|
| -WebInspector.SourcesNavigatorView = function()
|
| -{
|
| - WebInspector.NavigatorView.call(this);
|
| - WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.InspectedURLChanged, this._inspectedURLChanged, this);
|
| -};
|
| -
|
| -WebInspector.SourcesNavigatorView.prototype = {
|
| - /**
|
| - * @override
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @return {boolean}
|
| - */
|
| - accept: function(uiSourceCode)
|
| - {
|
| - if (!WebInspector.NavigatorView.prototype.accept(uiSourceCode))
|
| - return false;
|
| - return uiSourceCode.project().type() !== WebInspector.projectTypes.ContentScripts && uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets;
|
| - },
|
| +WebInspector.SourcesNavigatorView = class extends WebInspector.NavigatorView {
|
| + constructor() {
|
| + super();
|
| + WebInspector.targetManager.addEventListener(
|
| + WebInspector.TargetManager.Events.InspectedURLChanged, this._inspectedURLChanged, this);
|
| + }
|
|
|
| - /**
|
| - * @param {!WebInspector.Event} event
|
| - */
|
| - _inspectedURLChanged: function(event)
|
| - {
|
| - var mainTarget = WebInspector.targetManager.mainTarget();
|
| - if (event.data !== mainTarget)
|
| - return;
|
| - var inspectedURL = mainTarget && mainTarget.inspectedURL();
|
| - if (!inspectedURL)
|
| - return;
|
| - for (var node of this._uiSourceCodeNodes.valuesArray()) {
|
| - var uiSourceCode = node.uiSourceCode();
|
| - if (uiSourceCode.url() === inspectedURL)
|
| - this.revealUISourceCode(uiSourceCode, true);
|
| - }
|
| - },
|
| + /**
|
| + * @override
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @return {boolean}
|
| + */
|
| + accept(uiSourceCode) {
|
| + if (!super.accept(uiSourceCode))
|
| + return false;
|
| + return uiSourceCode.project().type() !== WebInspector.projectTypes.ContentScripts &&
|
| + uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets;
|
| + }
|
|
|
| - /**
|
| - * @override
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - */
|
| - uiSourceCodeAdded: function(uiSourceCode)
|
| - {
|
| - var mainTarget = WebInspector.targetManager.mainTarget();
|
| - var inspectedURL = mainTarget && mainTarget.inspectedURL();
|
| - if (!inspectedURL)
|
| - return;
|
| - if (uiSourceCode.url() === inspectedURL)
|
| - this.revealUISourceCode(uiSourceCode, true);
|
| - },
|
| + /**
|
| + * @param {!WebInspector.Event} event
|
| + */
|
| + _inspectedURLChanged(event) {
|
| + var mainTarget = WebInspector.targetManager.mainTarget();
|
| + if (event.data !== mainTarget)
|
| + return;
|
| + var inspectedURL = mainTarget && mainTarget.inspectedURL();
|
| + if (!inspectedURL)
|
| + return;
|
| + for (var node of this._uiSourceCodeNodes.valuesArray()) {
|
| + var uiSourceCode = node.uiSourceCode();
|
| + if (uiSourceCode.url() === inspectedURL)
|
| + this.revealUISourceCode(uiSourceCode, true);
|
| + }
|
| + }
|
|
|
| - /**
|
| - * @override
|
| - * @param {!Event} event
|
| - */
|
| - handleContextMenu: function(event)
|
| - {
|
| - var contextMenu = new WebInspector.ContextMenu(event);
|
| - WebInspector.NavigatorView.appendAddFolderItem(contextMenu);
|
| - contextMenu.show();
|
| - },
|
| + /**
|
| + * @override
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + */
|
| + uiSourceCodeAdded(uiSourceCode) {
|
| + var mainTarget = WebInspector.targetManager.mainTarget();
|
| + var inspectedURL = mainTarget && mainTarget.inspectedURL();
|
| + if (!inspectedURL)
|
| + return;
|
| + if (uiSourceCode.url() === inspectedURL)
|
| + this.revealUISourceCode(uiSourceCode, true);
|
| + }
|
|
|
| - __proto__: WebInspector.NavigatorView.prototype
|
| + /**
|
| + * @override
|
| + * @param {!Event} event
|
| + */
|
| + handleContextMenu(event) {
|
| + var contextMenu = new WebInspector.ContextMenu(event);
|
| + WebInspector.NavigatorView.appendAddFolderItem(contextMenu);
|
| + contextMenu.show();
|
| + }
|
| };
|
|
|
| /**
|
| - * @constructor
|
| - * @extends {WebInspector.NavigatorView}
|
| + * @unrestricted
|
| */
|
| -WebInspector.NetworkNavigatorView = function()
|
| -{
|
| - WebInspector.NavigatorView.call(this);
|
| - WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.InspectedURLChanged, this._inspectedURLChanged, this);
|
| -};
|
| -
|
| -WebInspector.NetworkNavigatorView.prototype = {
|
| - /**
|
| - * @override
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @return {boolean}
|
| - */
|
| - accept: function(uiSourceCode)
|
| - {
|
| - return uiSourceCode.project().type() === WebInspector.projectTypes.Network;
|
| - },
|
| +WebInspector.NetworkNavigatorView = class extends WebInspector.NavigatorView {
|
| + constructor() {
|
| + super();
|
| + WebInspector.targetManager.addEventListener(
|
| + WebInspector.TargetManager.Events.InspectedURLChanged, this._inspectedURLChanged, this);
|
| + }
|
|
|
| - /**
|
| - * @param {!WebInspector.Event} event
|
| - */
|
| - _inspectedURLChanged: function(event)
|
| - {
|
| - var mainTarget = WebInspector.targetManager.mainTarget();
|
| - if (event.data !== mainTarget)
|
| - return;
|
| - var inspectedURL = mainTarget && mainTarget.inspectedURL();
|
| - if (!inspectedURL)
|
| - return;
|
| - for (var node of this._uiSourceCodeNodes.valuesArray()) {
|
| - var uiSourceCode = node.uiSourceCode();
|
| - if (uiSourceCode.url() === inspectedURL)
|
| - this.revealUISourceCode(uiSourceCode, true);
|
| - }
|
| - },
|
| + /**
|
| + * @override
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @return {boolean}
|
| + */
|
| + accept(uiSourceCode) {
|
| + return uiSourceCode.project().type() === WebInspector.projectTypes.Network;
|
| + }
|
|
|
| - /**
|
| - * @override
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - */
|
| - uiSourceCodeAdded: function(uiSourceCode)
|
| - {
|
| - var mainTarget = WebInspector.targetManager.mainTarget();
|
| - var inspectedURL = mainTarget && mainTarget.inspectedURL();
|
| - if (!inspectedURL)
|
| - return;
|
| - if (uiSourceCode.url() === inspectedURL)
|
| - this.revealUISourceCode(uiSourceCode, true);
|
| - },
|
| + /**
|
| + * @param {!WebInspector.Event} event
|
| + */
|
| + _inspectedURLChanged(event) {
|
| + var mainTarget = WebInspector.targetManager.mainTarget();
|
| + if (event.data !== mainTarget)
|
| + return;
|
| + var inspectedURL = mainTarget && mainTarget.inspectedURL();
|
| + if (!inspectedURL)
|
| + return;
|
| + for (var node of this._uiSourceCodeNodes.valuesArray()) {
|
| + var uiSourceCode = node.uiSourceCode();
|
| + if (uiSourceCode.url() === inspectedURL)
|
| + this.revealUISourceCode(uiSourceCode, true);
|
| + }
|
| + }
|
|
|
| - __proto__: WebInspector.NavigatorView.prototype
|
| + /**
|
| + * @override
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + */
|
| + uiSourceCodeAdded(uiSourceCode) {
|
| + var mainTarget = WebInspector.targetManager.mainTarget();
|
| + var inspectedURL = mainTarget && mainTarget.inspectedURL();
|
| + if (!inspectedURL)
|
| + return;
|
| + if (uiSourceCode.url() === inspectedURL)
|
| + this.revealUISourceCode(uiSourceCode, true);
|
| + }
|
| };
|
|
|
| /**
|
| - * @constructor
|
| - * @extends {WebInspector.NavigatorView}
|
| + * @unrestricted
|
| */
|
| -WebInspector.FilesNavigatorView = function()
|
| -{
|
| - WebInspector.NavigatorView.call(this);
|
| -};
|
| +WebInspector.FilesNavigatorView = class extends WebInspector.NavigatorView {
|
| + constructor() {
|
| + super();
|
| + }
|
|
|
| -WebInspector.FilesNavigatorView.prototype = {
|
| - /**
|
| - * @override
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @return {boolean}
|
| - */
|
| - accept: function(uiSourceCode)
|
| - {
|
| - return uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem;
|
| - },
|
| + /**
|
| + * @override
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @return {boolean}
|
| + */
|
| + accept(uiSourceCode) {
|
| + return uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem;
|
| + }
|
|
|
| - /**
|
| - * @override
|
| - * @param {!Event} event
|
| - */
|
| - handleContextMenu: function(event)
|
| - {
|
| - var contextMenu = new WebInspector.ContextMenu(event);
|
| - WebInspector.NavigatorView.appendAddFolderItem(contextMenu);
|
| - contextMenu.show();
|
| - },
|
| -
|
| - __proto__: WebInspector.NavigatorView.prototype
|
| + /**
|
| + * @override
|
| + * @param {!Event} event
|
| + */
|
| + handleContextMenu(event) {
|
| + var contextMenu = new WebInspector.ContextMenu(event);
|
| + WebInspector.NavigatorView.appendAddFolderItem(contextMenu);
|
| + contextMenu.show();
|
| + }
|
| };
|
|
|
| /**
|
| - * @constructor
|
| - * @extends {WebInspector.NavigatorView}
|
| + * @unrestricted
|
| */
|
| -WebInspector.ContentScriptsNavigatorView = function()
|
| -{
|
| - WebInspector.NavigatorView.call(this);
|
| -};
|
| -
|
| -WebInspector.ContentScriptsNavigatorView.prototype = {
|
| - /**
|
| - * @override
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @return {boolean}
|
| - */
|
| - accept: function(uiSourceCode)
|
| - {
|
| - return uiSourceCode.project().type() === WebInspector.projectTypes.ContentScripts;
|
| - },
|
| +WebInspector.ContentScriptsNavigatorView = class extends WebInspector.NavigatorView {
|
| + constructor() {
|
| + super();
|
| + }
|
|
|
| - __proto__: WebInspector.NavigatorView.prototype
|
| + /**
|
| + * @override
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @return {boolean}
|
| + */
|
| + accept(uiSourceCode) {
|
| + return uiSourceCode.project().type() === WebInspector.projectTypes.ContentScripts;
|
| + }
|
| };
|
|
|
| /**
|
| - * @constructor
|
| - * @extends {WebInspector.NavigatorView}
|
| + * @unrestricted
|
| */
|
| -WebInspector.SnippetsNavigatorView = function()
|
| -{
|
| - WebInspector.NavigatorView.call(this);
|
| - var toolbar = new WebInspector.Toolbar("snippets-navigator-toolbar");
|
| - var newButton = new WebInspector.ToolbarButton(WebInspector.UIString("New"), "add-toolbar-item");
|
| - newButton.addEventListener("click", this._handleCreateSnippet.bind(this));
|
| +WebInspector.SnippetsNavigatorView = class extends WebInspector.NavigatorView {
|
| + constructor() {
|
| + super();
|
| + var toolbar = new WebInspector.Toolbar('snippets-navigator-toolbar');
|
| + var newButton = new WebInspector.ToolbarButton(WebInspector.UIString('New'), 'add-toolbar-item');
|
| + newButton.addEventListener('click', this._handleCreateSnippet.bind(this));
|
| toolbar.appendToolbarItem(newButton);
|
| this.element.insertBefore(toolbar.element, this.element.firstChild);
|
| -};
|
| -
|
| -WebInspector.SnippetsNavigatorView.prototype = {
|
| - /**
|
| - * @override
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @return {boolean}
|
| - */
|
| - accept: function(uiSourceCode)
|
| - {
|
| - return uiSourceCode.project().type() === WebInspector.projectTypes.Snippets;
|
| - },
|
| + }
|
|
|
| - /**
|
| - * @override
|
| - * @param {!Event} event
|
| - */
|
| - handleContextMenu: function(event)
|
| - {
|
| - var contextMenu = new WebInspector.ContextMenu(event);
|
| - contextMenu.appendItem(WebInspector.UIString("New"), this._handleCreateSnippet.bind(this));
|
| - contextMenu.show();
|
| - },
|
| + /**
|
| + * @override
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @return {boolean}
|
| + */
|
| + accept(uiSourceCode) {
|
| + return uiSourceCode.project().type() === WebInspector.projectTypes.Snippets;
|
| + }
|
|
|
| - /**
|
| - * @override
|
| - * @param {!Event} event
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - */
|
| - handleFileContextMenu: function(event, uiSourceCode)
|
| - {
|
| - var contextMenu = new WebInspector.ContextMenu(event);
|
| - contextMenu.appendItem(WebInspector.UIString("Run"), this._handleEvaluateSnippet.bind(this, uiSourceCode));
|
| - contextMenu.appendItem(WebInspector.UIString("Rename"), this.rename.bind(this, uiSourceCode));
|
| - contextMenu.appendItem(WebInspector.UIString("Remove"), this._handleRemoveSnippet.bind(this, uiSourceCode));
|
| - contextMenu.appendSeparator();
|
| - contextMenu.appendItem(WebInspector.UIString("New"), this._handleCreateSnippet.bind(this));
|
| - contextMenu.appendSeparator();
|
| - contextMenu.appendItem(WebInspector.UIString("Save as..."), this._handleSaveAs.bind(this, uiSourceCode));
|
| - contextMenu.show();
|
| - },
|
| + /**
|
| + * @override
|
| + * @param {!Event} event
|
| + */
|
| + handleContextMenu(event) {
|
| + var contextMenu = new WebInspector.ContextMenu(event);
|
| + contextMenu.appendItem(WebInspector.UIString('New'), this._handleCreateSnippet.bind(this));
|
| + contextMenu.show();
|
| + }
|
|
|
| - /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - */
|
| - _handleEvaluateSnippet: function(uiSourceCode)
|
| - {
|
| - var executionContext = WebInspector.context.flavor(WebInspector.ExecutionContext);
|
| - if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets || !executionContext)
|
| - return;
|
| - WebInspector.scriptSnippetModel.evaluateScriptSnippet(executionContext, uiSourceCode);
|
| - },
|
| + /**
|
| + * @override
|
| + * @param {!Event} event
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + */
|
| + handleFileContextMenu(event, uiSourceCode) {
|
| + var contextMenu = new WebInspector.ContextMenu(event);
|
| + contextMenu.appendItem(WebInspector.UIString('Run'), this._handleEvaluateSnippet.bind(this, uiSourceCode));
|
| + contextMenu.appendItem(WebInspector.UIString('Rename'), this.rename.bind(this, uiSourceCode));
|
| + contextMenu.appendItem(WebInspector.UIString('Remove'), this._handleRemoveSnippet.bind(this, uiSourceCode));
|
| + contextMenu.appendSeparator();
|
| + contextMenu.appendItem(WebInspector.UIString('New'), this._handleCreateSnippet.bind(this));
|
| + contextMenu.appendSeparator();
|
| + contextMenu.appendItem(WebInspector.UIString('Save as...'), this._handleSaveAs.bind(this, uiSourceCode));
|
| + contextMenu.show();
|
| + }
|
|
|
| - /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - */
|
| - _handleSaveAs: function(uiSourceCode)
|
| - {
|
| - if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets)
|
| - return;
|
| - uiSourceCode.saveAs();
|
| - },
|
| + /**
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + */
|
| + _handleEvaluateSnippet(uiSourceCode) {
|
| + var executionContext = WebInspector.context.flavor(WebInspector.ExecutionContext);
|
| + if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets || !executionContext)
|
| + return;
|
| + WebInspector.scriptSnippetModel.evaluateScriptSnippet(executionContext, uiSourceCode);
|
| + }
|
|
|
| - /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - */
|
| - _handleRemoveSnippet: function(uiSourceCode)
|
| - {
|
| - if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets)
|
| - return;
|
| - uiSourceCode.remove();
|
| - },
|
| + /**
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + */
|
| + _handleSaveAs(uiSourceCode) {
|
| + if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets)
|
| + return;
|
| + uiSourceCode.saveAs();
|
| + }
|
|
|
| - _handleCreateSnippet: function()
|
| - {
|
| - this.create(WebInspector.scriptSnippetModel.project(), "");
|
| - },
|
| + /**
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + */
|
| + _handleRemoveSnippet(uiSourceCode) {
|
| + if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets)
|
| + return;
|
| + uiSourceCode.remove();
|
| + }
|
|
|
| - /**
|
| - * @override
|
| - */
|
| - sourceDeleted: function(uiSourceCode)
|
| - {
|
| - this._handleRemoveSnippet(uiSourceCode);
|
| - },
|
| + _handleCreateSnippet() {
|
| + this.create(WebInspector.scriptSnippetModel.project(), '');
|
| + }
|
|
|
| - __proto__: WebInspector.NavigatorView.prototype
|
| + /**
|
| + * @override
|
| + */
|
| + sourceDeleted(uiSourceCode) {
|
| + this._handleRemoveSnippet(uiSourceCode);
|
| + }
|
| };
|
|
|