| OLD | NEW |
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 event.returnValue = WebInspector.UIString("DevTools have unsaved changes
that will be permanently lost."); | 71 event.returnValue = WebInspector.UIString("DevTools have unsaved changes
that will be permanently lost."); |
| 72 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.ins
tance()); | 72 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.ins
tance()); |
| 73 for (var i = 0; i < unsavedSourceCodes.length; ++i) | 73 for (var i = 0; i < unsavedSourceCodes.length; ++i) |
| 74 WebInspector.Revealer.reveal(unsavedSourceCodes[i]); | 74 WebInspector.Revealer.reveal(unsavedSourceCodes[i]); |
| 75 } | 75 } |
| 76 if (!window.opener) | 76 if (!window.opener) |
| 77 window.addEventListener("beforeunload", handleBeforeUnload, true); | 77 window.addEventListener("beforeunload", handleBeforeUnload, true); |
| 78 | 78 |
| 79 this._shortcuts = {}; | 79 this._shortcuts = {}; |
| 80 this.element.addEventListener("keydown", this._handleKeyDown.bind(this), fal
se); | 80 this.element.addEventListener("keydown", this._handleKeyDown.bind(this), fal
se); |
| 81 |
| 82 this.addEventListener(WebInspector.SourcesView.Events.EditorSelected, WebIns
pector.languageService.updateInferredMime, WebInspector.languageService); |
| 81 } | 83 } |
| 82 | 84 |
| 83 WebInspector.SourcesView.Events = { | 85 WebInspector.SourcesView.Events = { |
| 84 EditorClosed: "EditorClosed", | 86 EditorClosed: "EditorClosed", |
| 85 EditorSelected: "EditorSelected", | 87 EditorSelected: "EditorSelected", |
| 86 } | 88 } |
| 87 | 89 |
| 88 /** | 90 /** |
| 89 * @param {!WebInspector.UISourceCode} uiSourceCode | 91 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 90 * @return {string} | 92 * @return {string} |
| 91 */ | 93 */ |
| 92 WebInspector.SourcesView.uiSourceCodeHighlighterType = function(uiSourceCode) | 94 WebInspector.SourcesView.uiSourceCodeHighlighterType = function(uiSourceCode) |
| 93 { | 95 { |
| 94 var networkContentType = WebInspector.NetworkProject.uiSourceCodeContentType
(uiSourceCode); | 96 var networkContentType = WebInspector.NetworkProject.uiSourceCodeContentType
(uiSourceCode); |
| 95 if (networkContentType) | 97 if (networkContentType) |
| 96 return networkContentType.canonicalMimeType(); | 98 return networkContentType.canonicalMimeType(); |
| 97 | 99 |
| 98 var mimeType = WebInspector.ResourceType.mimeTypesForExtensions[uiSourceCode
.extension().toLowerCase()]; | 100 var mimeType = WebInspector.ResourceType.mimeFromURL(uiSourceCode.uri()); |
| 99 return mimeType || uiSourceCode.contentType().canonicalMimeType(); | 101 return mimeType || uiSourceCode.contentType().canonicalMimeType(); |
| 100 } | 102 } |
| 101 | 103 |
| 102 WebInspector.SourcesView.prototype = { | 104 WebInspector.SourcesView.prototype = { |
| 103 /** | 105 /** |
| 104 * @param {function(!Array.<!WebInspector.KeyboardShortcut.Descriptor>, func
tion(!Event=):boolean)} registerShortcutDelegate | 106 * @param {function(!Array.<!WebInspector.KeyboardShortcut.Descriptor>, func
tion(!Event=):boolean)} registerShortcutDelegate |
| 105 */ | 107 */ |
| 106 registerShortcuts: function(registerShortcutDelegate) | 108 registerShortcuts: function(registerShortcutDelegate) |
| 107 { | 109 { |
| 108 /** | 110 /** |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 var sourcesView = WebInspector.context.flavor(WebInspector.SourcesView); | 818 var sourcesView = WebInspector.context.flavor(WebInspector.SourcesView); |
| 817 var currentUISourceCode = sourcesView.currentUISourceCode(); | 819 var currentUISourceCode = sourcesView.currentUISourceCode(); |
| 818 if (!currentUISourceCode) | 820 if (!currentUISourceCode) |
| 819 return; | 821 return; |
| 820 var nextUISourceCode = WebInspector.SourcesView.SwitchFileActionDelegate
._nextFile(currentUISourceCode); | 822 var nextUISourceCode = WebInspector.SourcesView.SwitchFileActionDelegate
._nextFile(currentUISourceCode); |
| 821 if (!nextUISourceCode) | 823 if (!nextUISourceCode) |
| 822 return; | 824 return; |
| 823 sourcesView.showSourceLocation(nextUISourceCode); | 825 sourcesView.showSourceLocation(nextUISourceCode); |
| 824 } | 826 } |
| 825 } | 827 } |
| OLD | NEW |