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

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

Issue 2157283002: DevTools: remove WI.SourcesView._currentUISourceCode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.TabbedEditorContainerDelegate} 7 * @implements {WebInspector.TabbedEditorContainerDelegate}
8 * @implements {WebInspector.Searchable} 8 * @implements {WebInspector.Searchable}
9 * @implements {WebInspector.Replaceable} 9 * @implements {WebInspector.Replaceable}
10 * @extends {WebInspector.VBox} 10 * @extends {WebInspector.VBox}
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if (!(view instanceof WebInspector.UISourceCodeFrame)) 184 if (!(view instanceof WebInspector.UISourceCodeFrame))
185 return null; 185 return null;
186 return /** @type {!WebInspector.UISourceCodeFrame} */ (view); 186 return /** @type {!WebInspector.UISourceCodeFrame} */ (view);
187 }, 187 },
188 188
189 /** 189 /**
190 * @return {?WebInspector.UISourceCode} 190 * @return {?WebInspector.UISourceCode}
191 */ 191 */
192 currentUISourceCode: function() 192 currentUISourceCode: function()
193 { 193 {
194 return this._currentUISourceCode; 194 return this._editorContainer.currentFile();
195 }, 195 },
196 196
197 /** 197 /**
198 * @param {!Event=} event 198 * @param {!Event=} event
199 */ 199 */
200 _onCloseEditorTab: function(event) 200 _onCloseEditorTab: function(event)
201 { 201 {
202 var uiSourceCode = this.currentUISourceCode(); 202 var uiSourceCode = this._editorContainer.currentFile();
203 if (!uiSourceCode) 203 if (!uiSourceCode)
204 return false; 204 return false;
205 this._editorContainer.closeFile(uiSourceCode); 205 this._editorContainer.closeFile(uiSourceCode);
206 return true; 206 return true;
207 }, 207 },
208 208
209 /** 209 /**
210 * @param {!Event=} event 210 * @param {!Event=} event
211 */ 211 */
212 _onJumpToPreviousLocation: function(event) 212 _onJumpToPreviousLocation: function(event)
(...skipping 22 matching lines...) Expand all
235 235
236 /** 236 /**
237 * @param {!WebInspector.UISourceCode} uiSourceCode 237 * @param {!WebInspector.UISourceCode} uiSourceCode
238 */ 238 */
239 _addUISourceCode: function(uiSourceCode) 239 _addUISourceCode: function(uiSourceCode)
240 { 240 {
241 if (uiSourceCode.isFromServiceProject()) 241 if (uiSourceCode.isFromServiceProject())
242 return; 242 return;
243 this._editorContainer.addUISourceCode(uiSourceCode); 243 this._editorContainer.addUISourceCode(uiSourceCode);
244 // Replace debugger script-based uiSourceCode with a network-based one. 244 // Replace debugger script-based uiSourceCode with a network-based one.
245 var currentUISourceCode = this._currentUISourceCode; 245 var currentUISourceCode = this._editorContainer.currentFile();
246 if (!currentUISourceCode) 246 if (!currentUISourceCode)
247 return; 247 return;
248 var networkURL = WebInspector.networkMapping.networkURL(uiSourceCode); 248 var networkURL = WebInspector.networkMapping.networkURL(uiSourceCode);
249 var currentNetworkURL = WebInspector.networkMapping.networkURL(currentUI SourceCode); 249 var currentNetworkURL = WebInspector.networkMapping.networkURL(currentUI SourceCode);
250 if (currentUISourceCode.isFromServiceProject() && currentUISourceCode != = uiSourceCode && currentNetworkURL === networkURL && networkURL) { 250 if (currentUISourceCode.isFromServiceProject() && currentUISourceCode != = uiSourceCode && currentNetworkURL === networkURL && networkURL) {
251 this._editorContainer.showFile(uiSourceCode); 251 this._editorContainer.showFile(uiSourceCode);
252 this._editorContainer.removeUISourceCode(currentUISourceCode); 252 this._editorContainer.removeUISourceCode(currentUISourceCode);
253 } 253 }
254 }, 254 },
255 255
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 419
420 /** 420 /**
421 * @param {!WebInspector.Event} event 421 * @param {!WebInspector.Event} event
422 */ 422 */
423 _editorClosed: function(event) 423 _editorClosed: function(event)
424 { 424 {
425 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ); 425 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data );
426 this._historyManager.removeHistoryForSourceCode(uiSourceCode); 426 this._historyManager.removeHistoryForSourceCode(uiSourceCode);
427 427
428 var wasSelected = false; 428 var wasSelected = false;
429 if (this._currentUISourceCode === uiSourceCode) { 429 if (!this._editorContainer.currentFile())
430 delete this._currentUISourceCode;
431 wasSelected = true; 430 wasSelected = true;
432 }
433 431
434 // SourcesNavigator does not need to update on EditorClosed. 432 // SourcesNavigator does not need to update on EditorClosed.
435 this._updateScriptViewToolbarItems(); 433 this._updateScriptViewToolbarItems();
436 this._searchableView.resetSearch(); 434 this._searchableView.resetSearch();
437 435
438 var data = {}; 436 var data = {};
439 data.uiSourceCode = uiSourceCode; 437 data.uiSourceCode = uiSourceCode;
440 data.wasSelected = wasSelected; 438 data.wasSelected = wasSelected;
441 this.dispatchEventToListeners(WebInspector.SourcesView.Events.EditorClos ed, data); 439 this.dispatchEventToListeners(WebInspector.SourcesView.Events.EditorClos ed, data);
442 }, 440 },
443 441
444 /** 442 /**
445 * @param {!WebInspector.Event} event 443 * @param {!WebInspector.Event} event
446 */ 444 */
447 _editorSelected: function(event) 445 _editorSelected: function(event)
448 { 446 {
449 this._currentUISourceCode = /** @type {!WebInspector.UISourceCode} */(ev ent.data.currentFile);
450 var previousSourceFrame = event.data.previousView instanceof WebInspecto r.UISourceCodeFrame ? event.data.previousView : null; 447 var previousSourceFrame = event.data.previousView instanceof WebInspecto r.UISourceCodeFrame ? event.data.previousView : null;
451 if (previousSourceFrame) 448 if (previousSourceFrame)
452 previousSourceFrame.setSearchableView(null); 449 previousSourceFrame.setSearchableView(null);
453 var currentSourceFrame = event.data.currentView instanceof WebInspector. UISourceCodeFrame ? event.data.currentView : null; 450 var currentSourceFrame = event.data.currentView instanceof WebInspector. UISourceCodeFrame ? event.data.currentView : null;
454 if (currentSourceFrame) 451 if (currentSourceFrame)
455 currentSourceFrame.setSearchableView(this._searchableView); 452 currentSourceFrame.setSearchableView(this._searchableView);
456 453
457 this._searchableView.setReplaceable(!!currentSourceFrame && currentSourc eFrame.canEditSource()); 454 this._searchableView.setReplaceable(!!currentSourceFrame && currentSourc eFrame.canEditSource());
458 this._searchableView.refreshSearch(); 455 this._searchableView.refreshSearch();
459 this._updateScriptViewToolbarItems(); 456 this._updateScriptViewToolbarItems();
460 457
461 this.dispatchEventToListeners(WebInspector.SourcesView.Events.EditorSele cted, this._currentUISourceCode); 458 this.dispatchEventToListeners(WebInspector.SourcesView.Events.EditorSele cted, this._editorContainer.currentFile());
462 }, 459 },
463 460
464 /** 461 /**
465 * @param {!WebInspector.UISourceCode} uiSourceCode 462 * @param {!WebInspector.UISourceCode} uiSourceCode
466 */ 463 */
467 sourceRenamed: function(uiSourceCode) 464 sourceRenamed: function(uiSourceCode)
468 { 465 {
469 this._recreateSourceFrameIfNeeded(uiSourceCode); 466 this._recreateSourceFrameIfNeeded(uiSourceCode);
470 }, 467 },
471 468
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 this._openResourceDialogHistory = []; 616 this._openResourceDialogHistory = [];
620 WebInspector.OpenResourceDialog.show(this, query || "", defaultScores, t his._openResourceDialogHistory); 617 WebInspector.OpenResourceDialog.show(this, query || "", defaultScores, t his._openResourceDialogHistory);
621 }, 618 },
622 619
623 /** 620 /**
624 * @param {!Event=} event 621 * @param {!Event=} event
625 * @return {boolean} 622 * @return {boolean}
626 */ 623 */
627 _showGoToLineDialog: function(event) 624 _showGoToLineDialog: function(event)
628 { 625 {
629 if (this._currentUISourceCode) 626 if (this._editorContainer.currentFile())
630 this.showOpenResourceDialog(":"); 627 this.showOpenResourceDialog(":");
631 return true; 628 return true;
632 }, 629 },
633 630
634 /** 631 /**
635 * @return {boolean} 632 * @return {boolean}
636 */ 633 */
637 _save: function() 634 _save: function()
638 { 635 {
639 this._saveSourceFrame(this.currentSourceFrame()); 636 this._saveSourceFrame(this.currentSourceFrame());
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 */ 784 */
788 handleAction: function(context, actionId) 785 handleAction: function(context, actionId)
789 { 786 {
790 var sourcesView = WebInspector.context.flavor(WebInspector.SourcesView); 787 var sourcesView = WebInspector.context.flavor(WebInspector.SourcesView);
791 if (!sourcesView) 788 if (!sourcesView)
792 return false; 789 return false;
793 sourcesView._editorContainer.closeAllFiles(); 790 sourcesView._editorContainer.closeAllFiles();
794 return true; 791 return true;
795 } 792 }
796 } 793 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698