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

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

Issue 2679483002: DevTools: Create extensible QuickOpen control (Closed)
Patch Set: Created 3 years, 10 months 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 if (uiSourceCode.contentType().isStyleSheet()) { 595 if (uiSourceCode.contentType().isStyleSheet()) {
596 Sources.StyleSheetOutlineDialog.show(uiSourceCode, this.showSourceLocation .bind(this, uiSourceCode)); 596 Sources.StyleSheetOutlineDialog.show(uiSourceCode, this.showSourceLocation .bind(this, uiSourceCode));
597 return true; 597 return true;
598 } 598 }
599 599
600 // We don't want default browser shortcut to be executed, so pretend to hand le this event. 600 // We don't want default browser shortcut to be executed, so pretend to hand le this event.
601 return true; 601 return true;
602 } 602 }
603 603
604 /** 604 /**
605 * @param {string=} query
606 */
607 showOpenResourceDialog(query) {
608 var uiSourceCodes = this._editorContainer.historyUISourceCodes();
609 /** @type {!Map.<!Workspace.UISourceCode, number>} */
610 var defaultScores = new Map();
611 for (var i = 1; i < uiSourceCodes.length; ++i) // Skip current element
612 defaultScores.set(uiSourceCodes[i], uiSourceCodes.length - i);
613 if (!this._openResourceDialogHistory)
614 this._openResourceDialogHistory = [];
615 Sources.OpenResourceDialog.show(this, query || '', defaultScores, this._open ResourceDialogHistory);
616 }
617
618 /**
619 * @param {!Event=} event 605 * @param {!Event=} event
620 * @return {boolean} 606 * @return {boolean}
621 */ 607 */
622 _showGoToLineDialog(event) { 608 _showGoToLineDialog(event) {
pfeldman 2017/02/07 02:10:03 Extract this into an action in its own class (Sour
einbinder 2017/02/28 23:59:07 Would it use flavor(SourcesView) to check if the e
623 if (this._editorContainer.currentFile()) 609 if (this._editorContainer.currentFile())
624 this.showOpenResourceDialog(':'); 610 QuickOpen.QuickOpen.show(':');
625 return true; 611 return true;
626 } 612 }
627 613
628 /** 614 /**
629 * @return {boolean} 615 * @return {boolean}
630 */ 616 */
631 _save() { 617 _save() {
632 this._saveSourceFrame(this.currentSourceFrame()); 618 this._saveSourceFrame(this.currentSourceFrame());
633 return true; 619 return true;
634 } 620 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } 653 }
668 return false; 654 return false;
669 } 655 }
670 656
671 /** 657 /**
672 * @param {boolean} active 658 * @param {boolean} active
673 */ 659 */
674 toggleBreakpointsActiveState(active) { 660 toggleBreakpointsActiveState(active) {
675 this._editorContainer.view.element.classList.toggle('breakpoints-deactivated ', !active); 661 this._editorContainer.view.element.classList.toggle('breakpoints-deactivated ', !active);
676 } 662 }
663
664 /**
665 * @return {!Map.<!Workspace.UISourceCode, number>}
666 */
667 static defaultUISourceCodeScores() {
pfeldman 2017/02/07 02:10:03 Declare static members first
einbinder 2017/02/28 23:59:07 Done.
668 /** @type {!Map.<!Workspace.UISourceCode, number>} */
669 var defaultScores = new Map();
670 var sourcesView = UI.context.flavor(Sources.SourcesView);
pfeldman 2017/02/07 02:10:03 Don't abuse context - all setters and getters of t
einbinder 2017/02/28 23:59:07 A singleton feels weird because it operates on a v
671 if (sourcesView) {
672 var uiSourceCodes = sourcesView._editorContainer.historyUISourceCodes();
673 for (var i = 1; i < uiSourceCodes.length; ++i) // Skip current element
674 defaultScores.set(uiSourceCodes[i], uiSourceCodes.length - i);
675 }
676 return defaultScores;
677 }
677 }; 678 };
678 679
679 /** @enum {symbol} */ 680 /** @enum {symbol} */
680 Sources.SourcesView.Events = { 681 Sources.SourcesView.Events = {
681 EditorClosed: Symbol('EditorClosed'), 682 EditorClosed: Symbol('EditorClosed'),
682 EditorSelected: Symbol('EditorSelected'), 683 EditorSelected: Symbol('EditorSelected'),
683 }; 684 };
684 685
685 /** 686 /**
686 * @interface 687 * @interface
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 * @return {boolean} 767 * @return {boolean}
767 */ 768 */
768 handleAction(context, actionId) { 769 handleAction(context, actionId) {
769 var sourcesView = UI.context.flavor(Sources.SourcesView); 770 var sourcesView = UI.context.flavor(Sources.SourcesView);
770 if (!sourcesView) 771 if (!sourcesView)
771 return false; 772 return false;
772 sourcesView._editorContainer.closeAllFiles(); 773 sourcesView._editorContainer.closeAllFiles();
773 return true; 774 return true;
774 } 775 }
775 }; 776 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698