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

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

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 years, 1 month 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 /* 1 /*
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 /**
7 * @unrestricted
8 */
9 WebInspector.OpenResourceDialog = class extends WebInspector.FilteredUISourceCod eListDelegate {
10 /**
11 * @param {!WebInspector.SourcesView} sourcesView
12 * @param {!Map.<!WebInspector.UISourceCode, number>} defaultScores
13 * @param {!Array<string>} history
14 */
15 constructor(sourcesView, defaultScores, history) {
16 super(defaultScores, history);
17 this._sourcesView = sourcesView;
18 this.populate();
19 }
20
21 /**
22 * @param {!WebInspector.SourcesView} sourcesView
23 * @param {string} query
24 * @param {!Map.<!WebInspector.UISourceCode, number>} defaultScores
25 * @param {!Array<string>} history
26 */
27 static show(sourcesView, query, defaultScores, history) {
28 WebInspector.OpenResourceDialog._instanceForTest =
29 new WebInspector.OpenResourceDialog(sourcesView, defaultScores, history) ;
30 var filteredItemSelectionDialog =
31 new WebInspector.FilteredListWidget(WebInspector.OpenResourceDialog._ins tanceForTest);
32 filteredItemSelectionDialog.showAsDialog();
33 filteredItemSelectionDialog.setQuery(query);
34 }
35
36 /**
37 * @override
38 * @param {?WebInspector.UISourceCode} uiSourceCode
39 * @param {number=} lineNumber
40 * @param {number=} columnNumber
41 */
42 uiSourceCodeSelected(uiSourceCode, lineNumber, columnNumber) {
43 if (!uiSourceCode)
44 uiSourceCode = this._sourcesView.currentUISourceCode();
45 if (!uiSourceCode)
46 return;
47 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNumber) ;
48 }
49
50 /**
51 * @override
52 * @param {string} query
53 * @return {boolean}
54 */
55 shouldShowMatchingItems(query) {
56 return !query.startsWith(':');
57 }
58
59 /**
60 * @override
61 * @param {!WebInspector.Project} project
62 * @return {boolean}
63 */
64 filterProject(project) {
65 return !WebInspector.Project.isServiceProject(project);
66 }
67
68 /**
69 * @override
70 * @return {boolean}
71 */
72 renderAsTwoRows() {
73 return true;
74 }
75 };
76
6 77
7 /** 78 /**
8 * @constructor 79 * @unrestricted
9 * @extends {WebInspector.FilteredUISourceCodeListDelegate}
10 * @param {!WebInspector.SourcesView} sourcesView
11 * @param {!Map.<!WebInspector.UISourceCode, number>} defaultScores
12 * @param {!Array<string>} history
13 */ 80 */
14 WebInspector.OpenResourceDialog = function(sourcesView, defaultScores, history) 81 WebInspector.SelectUISourceCodeForProjectTypesDialog = class extends WebInspecto r.FilteredUISourceCodeListDelegate {
15 { 82 /**
16 WebInspector.FilteredUISourceCodeListDelegate.call(this, defaultScores, hist ory); 83 * @param {!Array.<string>} types
17 this._sourcesView = sourcesView; 84 * @param {function(?WebInspector.UISourceCode)} callback
18 this.populate(); 85 */
19 }; 86 constructor(types, callback) {
20 87 super();
21 WebInspector.OpenResourceDialog.prototype = {
22
23 /**
24 * @override
25 * @param {?WebInspector.UISourceCode} uiSourceCode
26 * @param {number=} lineNumber
27 * @param {number=} columnNumber
28 */
29 uiSourceCodeSelected: function(uiSourceCode, lineNumber, columnNumber)
30 {
31 if (!uiSourceCode)
32 uiSourceCode = this._sourcesView.currentUISourceCode();
33 if (!uiSourceCode)
34 return;
35 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNum ber);
36 },
37
38 /**
39 * @override
40 * @param {string} query
41 * @return {boolean}
42 */
43 shouldShowMatchingItems: function(query)
44 {
45 return !query.startsWith(":");
46 },
47
48 /**
49 * @override
50 * @param {!WebInspector.Project} project
51 * @return {boolean}
52 */
53 filterProject: function(project)
54 {
55 return !WebInspector.Project.isServiceProject(project);
56 },
57
58 /**
59 * @override
60 * @return {boolean}
61 */
62 renderAsTwoRows: function()
63 {
64 return true;
65 },
66
67 __proto__: WebInspector.FilteredUISourceCodeListDelegate.prototype
68 };
69
70 /**
71 * @param {!WebInspector.SourcesView} sourcesView
72 * @param {string} query
73 * @param {!Map.<!WebInspector.UISourceCode, number>} defaultScores
74 * @param {!Array<string>} history
75 */
76 WebInspector.OpenResourceDialog.show = function(sourcesView, query, defaultScore s, history)
77 {
78 WebInspector.OpenResourceDialog._instanceForTest = new WebInspector.OpenReso urceDialog(sourcesView, defaultScores, history);
79 var filteredItemSelectionDialog = new WebInspector.FilteredListWidget(WebIns pector.OpenResourceDialog._instanceForTest);
80 filteredItemSelectionDialog.showAsDialog();
81 filteredItemSelectionDialog.setQuery(query);
82 };
83
84 /**
85 * @constructor
86 * @extends {WebInspector.FilteredUISourceCodeListDelegate}
87 * @param {!Array.<string>} types
88 * @param {function(?WebInspector.UISourceCode)} callback
89 */
90 WebInspector.SelectUISourceCodeForProjectTypesDialog = function(types, callback)
91 {
92 WebInspector.FilteredUISourceCodeListDelegate.call(this);
93 this._types = types; 88 this._types = types;
94 this._callback = callback; 89 this._callback = callback;
95 this.populate(); 90 this.populate();
91 }
92
93 /**
94 * @param {string} name
95 * @param {!Array.<string>} types
96 * @param {function(?WebInspector.UISourceCode)} callback
97 */
98 static show(name, types, callback) {
99 var filteredItemSelectionDialog =
100 new WebInspector.FilteredListWidget(new WebInspector.SelectUISourceCodeF orProjectTypesDialog(types, callback));
101 filteredItemSelectionDialog.showAsDialog();
102 filteredItemSelectionDialog.setQuery(name);
103 }
104
105 /**
106 * @override
107 * @param {?WebInspector.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 {!WebInspector.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 }
96 }; 131 };
97 132
98 WebInspector.SelectUISourceCodeForProjectTypesDialog.prototype = {
99 /**
100 * @override
101 * @param {?WebInspector.UISourceCode} uiSourceCode
102 * @param {number=} lineNumber
103 * @param {number=} columnNumber
104 */
105 uiSourceCodeSelected: function(uiSourceCode, lineNumber, columnNumber)
106 {
107 this._callback(uiSourceCode);
108 },
109 133
110 /**
111 * @override
112 * @param {!WebInspector.Project} project
113 * @return {boolean}
114 */
115 filterProject: function(project)
116 {
117 return this._types.indexOf(project.type()) !== -1;
118 },
119
120 /**
121 * @override
122 * @return {boolean}
123 */
124 renderAsTwoRows: function()
125 {
126 return true;
127 },
128
129 __proto__: WebInspector.FilteredUISourceCodeListDelegate.prototype
130 };
131
132 /**
133 * @param {string} name
134 * @param {!Array.<string>} types
135 * @param {function(?WebInspector.UISourceCode)} callback
136 */
137 WebInspector.SelectUISourceCodeForProjectTypesDialog.show = function(name, types , callback)
138 {
139 var filteredItemSelectionDialog = new WebInspector.FilteredListWidget(new We bInspector.SelectUISourceCodeForProjectTypesDialog(types, callback));
140 filteredItemSelectionDialog.showAsDialog();
141 filteredItemSelectionDialog.setQuery(name);
142 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698