| OLD | NEW | 
|---|
|  | (Empty) | 
| 1 /* |  | 
| 2  * Copyright (c) 2012 The Chromium Authors. All rights reserved. |  | 
| 3  * Use of this source code is governed by a BSD-style license that can be |  | 
| 4  * found in the LICENSE file. |  | 
| 5  */ |  | 
| 6 |  | 
| 7 /** |  | 
| 8  * @unrestricted |  | 
| 9  */ |  | 
| 10 Sources.OpenResourceDialog = class extends Sources.FilteredUISourceCodeListProvi
     der { |  | 
| 11   /** |  | 
| 12    * @param {!Sources.SourcesView} sourcesView |  | 
| 13    * @param {!Map.<!Workspace.UISourceCode, number>} defaultScores |  | 
| 14    */ |  | 
| 15   constructor(sourcesView, defaultScores) { |  | 
| 16     super(defaultScores); |  | 
| 17     this._sourcesView = sourcesView; |  | 
| 18   } |  | 
| 19 |  | 
| 20   /** |  | 
| 21    * @param {!Sources.SourcesView} sourcesView |  | 
| 22    * @param {string} query |  | 
| 23    * @param {!Map.<!Workspace.UISourceCode, number>} defaultScores |  | 
| 24    * @param {!Array<string>} history |  | 
| 25    */ |  | 
| 26   static show(sourcesView, query, defaultScores, history) { |  | 
| 27     var dialog = new Sources.OpenResourceDialog(sourcesView, defaultScores); |  | 
| 28     if (InspectorFrontendHost.isUnderTest()) |  | 
| 29       Sources.OpenResourceDialog._instanceForTest = dialog; |  | 
| 30     var filteredItemSelectionDialog = new QuickOpen.FilteredListWidget(dialog, h
     istory); |  | 
| 31     filteredItemSelectionDialog.showAsDialog(); |  | 
| 32     filteredItemSelectionDialog.setQuery(query); |  | 
| 33   } |  | 
| 34 |  | 
| 35   /** |  | 
| 36    * @override |  | 
| 37    * @param {?Workspace.UISourceCode} uiSourceCode |  | 
| 38    * @param {number=} lineNumber |  | 
| 39    * @param {number=} columnNumber |  | 
| 40    */ |  | 
| 41   uiSourceCodeSelected(uiSourceCode, lineNumber, columnNumber) { |  | 
| 42     Host.userMetrics.actionTaken(Host.UserMetrics.Action.SelectFileFromFilePicke
     r); |  | 
| 43 |  | 
| 44     if (!uiSourceCode) |  | 
| 45       uiSourceCode = this._sourcesView.currentUISourceCode(); |  | 
| 46     if (!uiSourceCode) |  | 
| 47       return; |  | 
| 48     this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNumber)
     ; |  | 
| 49   } |  | 
| 50 |  | 
| 51   /** |  | 
| 52    * @override |  | 
| 53    * @param {string} query |  | 
| 54    * @return {boolean} |  | 
| 55    */ |  | 
| 56   shouldShowMatchingItems(query) { |  | 
| 57     return !query.startsWith(':'); |  | 
| 58   } |  | 
| 59 |  | 
| 60   /** |  | 
| 61    * @override |  | 
| 62    * @param {!Workspace.Project} project |  | 
| 63    * @return {boolean} |  | 
| 64    */ |  | 
| 65   filterProject(project) { |  | 
| 66     return !project.isServiceProject(); |  | 
| 67   } |  | 
| 68 |  | 
| 69   /** |  | 
| 70    * @override |  | 
| 71    * @return {boolean} |  | 
| 72    */ |  | 
| 73   renderAsTwoRows() { |  | 
| 74     return true; |  | 
| 75   } |  | 
| 76 }; |  | 
| 77 |  | 
| 78 |  | 
| 79 /** |  | 
| 80  * @unrestricted |  | 
| 81  */ |  | 
| 82 Sources.SelectUISourceCodeForProjectTypesDialog = class extends Sources.Filtered
     UISourceCodeListProvider { |  | 
| 83   /** |  | 
| 84    * @param {!Array.<string>} types |  | 
| 85    * @param {function(?Workspace.UISourceCode)} callback |  | 
| 86    */ |  | 
| 87   constructor(types, callback) { |  | 
| 88     super(); |  | 
| 89     this._types = types; |  | 
| 90     this._callback = callback; |  | 
| 91   } |  | 
| 92 |  | 
| 93   /** |  | 
| 94    * @param {string} name |  | 
| 95    * @param {!Array.<string>} types |  | 
| 96    * @param {function(?Workspace.UISourceCode)} callback |  | 
| 97    */ |  | 
| 98   static show(name, types, callback) { |  | 
| 99     var filteredItemSelectionDialog = |  | 
| 100         new QuickOpen.FilteredListWidget(new Sources.SelectUISourceCodeForProjec
     tTypesDialog(types, callback)); |  | 
| 101     filteredItemSelectionDialog.showAsDialog(); |  | 
| 102     filteredItemSelectionDialog.setQuery(name); |  | 
| 103   } |  | 
| 104 |  | 
| 105   /** |  | 
| 106    * @override |  | 
| 107    * @param {?Workspace.UISourceCode} uiSourceCode |  | 
| 108    * @param {number=} lineNumber |  | 
| 109    * @param {number=} columnNumber |  | 
| 110    */ |  | 
| 111   uiSourceCodeSelected(uiSourceCode, lineNumber, columnNumber) { |  | 
| 112     this._callback(uiSourceCode); |  | 
| 113   } |  | 
| 114 |  | 
| 115   /** |  | 
| 116    * @override |  | 
| 117    * @param {!Workspace.Project} project |  | 
| 118    * @return {boolean} |  | 
| 119    */ |  | 
| 120   filterProject(project) { |  | 
| 121     return this._types.indexOf(project.type()) !== -1; |  | 
| 122   } |  | 
| 123 |  | 
| 124   /** |  | 
| 125    * @override |  | 
| 126    * @return {boolean} |  | 
| 127    */ |  | 
| 128   renderAsTwoRows() { |  | 
| 129     return true; |  | 
| 130   } |  | 
| 131 }; |  | 
| OLD | NEW | 
|---|