Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js

Issue 2551233002: DevTools: show filesystem file by default (Closed)
Patch Set: rebaseline Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @implements {Sources.TabbedEditorContainerDelegate} 5 * @implements {Sources.TabbedEditorContainerDelegate}
6 * @implements {UI.Searchable} 6 * @implements {UI.Searchable}
7 * @implements {UI.Replaceable} 7 * @implements {UI.Replaceable}
8 * @unrestricted 8 * @unrestricted
9 */ 9 */
10 Sources.SourcesView = class extends UI.VBox { 10 Sources.SourcesView = class extends UI.VBox {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 UI.viewManager.showView('sources'); 82 UI.viewManager.showView('sources');
83 for (var i = 0; i < unsavedSourceCodes.length; ++i) 83 for (var i = 0; i < unsavedSourceCodes.length; ++i)
84 Common.Revealer.reveal(unsavedSourceCodes[i]); 84 Common.Revealer.reveal(unsavedSourceCodes[i]);
85 } 85 }
86 86
87 if (!window.opener) 87 if (!window.opener)
88 window.addEventListener('beforeunload', handleBeforeUnload, true); 88 window.addEventListener('beforeunload', handleBeforeUnload, true);
89 89
90 this._shortcuts = {}; 90 this._shortcuts = {};
91 this.element.addEventListener('keydown', this._handleKeyDown.bind(this), fal se); 91 this.element.addEventListener('keydown', this._handleKeyDown.bind(this), fal se);
92
93 Persistence.persistence.addEventListener(
94 Persistence.Persistence.Events.BindingCreated, this._onBindingChanged, t his);
95 Persistence.persistence.addEventListener(
96 Persistence.Persistence.Events.BindingRemoved, this._onBindingChanged, t his);
92 } 97 }
93 98
94 /** 99 /**
95 * @param {function(!Array.<!UI.KeyboardShortcut.Descriptor>, function(!Event= ):boolean)} registerShortcutDelegate 100 * @param {function(!Array.<!UI.KeyboardShortcut.Descriptor>, function(!Event= ):boolean)} registerShortcutDelegate
96 */ 101 */
97 registerShortcuts(registerShortcutDelegate) { 102 registerShortcuts(registerShortcutDelegate) {
98 /** 103 /**
99 * @this {Sources.SourcesView} 104 * @this {Sources.SourcesView}
100 * @param {!Array.<!UI.KeyboardShortcut.Descriptor>} shortcuts 105 * @param {!Array.<!UI.KeyboardShortcut.Descriptor>} shortcuts
101 * @param {function(!Event=):boolean} handler 106 * @param {function(!Event=):boolean} handler
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 * @param {!Workspace.UISourceCode} uiSourceCode 392 * @param {!Workspace.UISourceCode} uiSourceCode
388 */ 393 */
389 _removeSourceFrame(uiSourceCode) { 394 _removeSourceFrame(uiSourceCode) {
390 var sourceView = this._sourceViewByUISourceCode.get(uiSourceCode); 395 var sourceView = this._sourceViewByUISourceCode.get(uiSourceCode);
391 this._sourceViewByUISourceCode.remove(uiSourceCode); 396 this._sourceViewByUISourceCode.remove(uiSourceCode);
392 uiSourceCode.removeEventListener(Workspace.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleChanged, this); 397 uiSourceCode.removeEventListener(Workspace.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleChanged, this);
393 if (sourceView && sourceView instanceof Sources.UISourceCodeFrame) 398 if (sourceView && sourceView instanceof Sources.UISourceCodeFrame)
394 /** @type {!Sources.UISourceCodeFrame} */ (sourceView).dispose(); 399 /** @type {!Sources.UISourceCodeFrame} */ (sourceView).dispose();
395 } 400 }
396 401
402 /**
403 * @param {!Common.Event} event
404 */
405 _onBindingChanged(event) {
406 if (!this._executionLocation)
407 return;
408 var oldBinding = /** @type {!Persistence.PersistenceBinding} */ (event.data) ;
dgozman 2016/12/06 01:14:27 binding
lushnikov 2016/12/06 02:21:05 Done.
409 var uiSourceCode = this._executionLocation.uiSourceCode;
410 if (oldBinding.network !== uiSourceCode && oldBinding.fileSystem !== uiSourc eCode)
dgozman 2016/12/06 01:14:27 binding.fileSystem doesn't ever equal to uiSourceC
lushnikov 2016/12/06 02:21:05 Done.
dgozman 2016/12/06 22:01:03 Not really :-)
lushnikov 2016/12/06 22:14:04 Now, done!
411 return;
412 this.setExecutionLocation(this._executionLocation);
413 this.showSourceLocation(
414 this._executionLocation.uiSourceCode, this._executionLocation.lineNumber , this._executionLocation.columnNumber);
415 }
416
397 clearCurrentExecutionLine() { 417 clearCurrentExecutionLine() {
398 if (this._executionSourceFrame) 418 if (this._executionSourceFrame)
399 this._executionSourceFrame.clearExecutionLine(); 419 this._executionSourceFrame.clearExecutionLine();
400 delete this._executionSourceFrame; 420 this._executionSourceFrame = null;
421 this._executionLocation = null;
401 } 422 }
402 423
403 /** 424 /**
404 * @param {!Workspace.UILocation} uiLocation 425 * @param {!Workspace.UILocation} uiLocation
405 */ 426 */
406 setExecutionLocation(uiLocation) { 427 setExecutionLocation(uiLocation) {
407 var sourceView = this._getOrCreateSourceView(uiLocation.uiSourceCode); 428 this.clearCurrentExecutionLine();
429 var persistenceLocation = this._toPersistenceLocation(uiLocation);
430 var sourceView = this._getOrCreateSourceView(persistenceLocation.uiSourceCod e);
408 if (sourceView instanceof Sources.UISourceCodeFrame) { 431 if (sourceView instanceof Sources.UISourceCodeFrame) {
409 var sourceFrame = /** @type {!Sources.UISourceCodeFrame} */ (sourceView); 432 var sourceFrame = /** @type {!Sources.UISourceCodeFrame} */ (sourceView);
410 sourceFrame.setExecutionLocation(uiLocation); 433 sourceFrame.setExecutionLocation(persistenceLocation);
411 this._executionSourceFrame = sourceFrame; 434 this._executionSourceFrame = sourceFrame;
435 this._executionLocation = uiLocation;
412 } 436 }
413 } 437 }
414 438
415 /** 439 /**
440 * @param {!Workspace.UILocation} uiLocation
441 * @return {!Workspace.UILocation}
442 */
443 _toPersistenceLocation(uiLocation) {
dgozman 2016/12/06 01:14:27 Let's inline.
lushnikov 2016/12/06 02:21:05 Done.
444 var binding = Persistence.persistence.binding(uiLocation.uiSourceCode);
445 if (!binding)
446 return uiLocation;
447 return new Workspace.UILocation(binding.fileSystem, uiLocation.lineNumber, u iLocation.columnNumber);
448 }
449
450 /**
416 * @param {!Common.Event} event 451 * @param {!Common.Event} event
417 */ 452 */
418 _editorClosed(event) { 453 _editorClosed(event) {
419 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data); 454 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
420 this._historyManager.removeHistoryForSourceCode(uiSourceCode); 455 this._historyManager.removeHistoryForSourceCode(uiSourceCode);
421 456
422 var wasSelected = false; 457 var wasSelected = false;
423 if (!this._editorContainer.currentFile()) 458 if (!this._editorContainer.currentFile())
424 wasSelected = true; 459 wasSelected = true;
425 460
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 * @return {boolean} 787 * @return {boolean}
753 */ 788 */
754 handleAction(context, actionId) { 789 handleAction(context, actionId) {
755 var sourcesView = UI.context.flavor(Sources.SourcesView); 790 var sourcesView = UI.context.flavor(Sources.SourcesView);
756 if (!sourcesView) 791 if (!sourcesView)
757 return false; 792 return false;
758 sourcesView._editorContainer.closeAllFiles(); 793 sourcesView._editorContainer.closeAllFiles();
759 return true; 794 return true;
760 } 795 }
761 }; 796 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698