OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu
rrentTargetChanged, this); | 104 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu
rrentTargetChanged, this); |
105 WebInspector.context.addFlavorChangeListener(WebInspector.DebuggerModel.Call
Frame, this._callFrameChanged, this); | 105 WebInspector.context.addFlavorChangeListener(WebInspector.DebuggerModel.Call
Frame, this._callFrameChanged, this); |
106 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this
); | 106 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this
); |
107 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); | 107 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); |
108 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); | 108 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); |
109 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); | 109 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); |
110 new WebInspector.WorkspaceMappingTip(this, this._workspace); | 110 new WebInspector.WorkspaceMappingTip(this, this._workspace); |
111 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E
vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); | 111 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E
vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); |
112 WebInspector.DataSaverInfobar.maybeShowInPanel(this); | 112 WebInspector.DataSaverInfobar.maybeShowInPanel(this); |
113 WebInspector.targetManager.observeTargets(this); | 113 WebInspector.targetManager.observeTargets(this); |
114 } | 114 }; |
115 | 115 |
116 WebInspector.SourcesPanel._lastModificationTimeout = 200; | 116 WebInspector.SourcesPanel._lastModificationTimeout = 200; |
117 | 117 |
118 WebInspector.SourcesPanel.minToolbarWidth = 215; | 118 WebInspector.SourcesPanel.minToolbarWidth = 215; |
119 | 119 |
120 WebInspector.SourcesPanel.prototype = { | 120 WebInspector.SourcesPanel.prototype = { |
121 /** | 121 /** |
122 * @override | 122 * @override |
123 * @param {!WebInspector.Target} target | 123 * @param {!WebInspector.Target} target |
124 */ | 124 */ |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 var items = dataTransfer.items; | 1138 var items = dataTransfer.items; |
1139 if (!items.length) | 1139 if (!items.length) |
1140 return; | 1140 return; |
1141 var entry = items[0].webkitGetAsEntry(); | 1141 var entry = items[0].webkitGetAsEntry(); |
1142 if (!entry.isDirectory) | 1142 if (!entry.isDirectory) |
1143 return; | 1143 return; |
1144 InspectorFrontendHost.upgradeDraggedFileSystemPermissions(entry.filesyst
em); | 1144 InspectorFrontendHost.upgradeDraggedFileSystemPermissions(entry.filesyst
em); |
1145 }, | 1145 }, |
1146 | 1146 |
1147 __proto__: WebInspector.Panel.prototype | 1147 __proto__: WebInspector.Panel.prototype |
1148 } | 1148 }; |
1149 | 1149 |
1150 /** | 1150 /** |
1151 * @constructor | 1151 * @constructor |
1152 * @implements {WebInspector.Revealer} | 1152 * @implements {WebInspector.Revealer} |
1153 */ | 1153 */ |
1154 WebInspector.SourcesPanel.UILocationRevealer = function() | 1154 WebInspector.SourcesPanel.UILocationRevealer = function() |
1155 { | 1155 { |
1156 } | 1156 }; |
1157 | 1157 |
1158 WebInspector.SourcesPanel.UILocationRevealer.prototype = { | 1158 WebInspector.SourcesPanel.UILocationRevealer.prototype = { |
1159 /** | 1159 /** |
1160 * @override | 1160 * @override |
1161 * @param {!Object} uiLocation | 1161 * @param {!Object} uiLocation |
1162 * @param {boolean=} omitFocus | 1162 * @param {boolean=} omitFocus |
1163 * @return {!Promise} | 1163 * @return {!Promise} |
1164 */ | 1164 */ |
1165 reveal: function(uiLocation, omitFocus) | 1165 reveal: function(uiLocation, omitFocus) |
1166 { | 1166 { |
1167 if (!(uiLocation instanceof WebInspector.UILocation)) | 1167 if (!(uiLocation instanceof WebInspector.UILocation)) |
1168 return Promise.reject(new Error("Internal error: not a ui location")
); | 1168 return Promise.reject(new Error("Internal error: not a ui location")
); |
1169 WebInspector.SourcesPanel.instance().showUILocation(uiLocation, omitFocu
s); | 1169 WebInspector.SourcesPanel.instance().showUILocation(uiLocation, omitFocu
s); |
1170 return Promise.resolve(); | 1170 return Promise.resolve(); |
1171 } | 1171 } |
1172 } | 1172 }; |
1173 | 1173 |
1174 /** | 1174 /** |
1175 * @constructor | 1175 * @constructor |
1176 * @implements {WebInspector.Revealer} | 1176 * @implements {WebInspector.Revealer} |
1177 */ | 1177 */ |
1178 WebInspector.SourcesPanel.DebuggerLocationRevealer = function() | 1178 WebInspector.SourcesPanel.DebuggerLocationRevealer = function() |
1179 { | 1179 { |
1180 } | 1180 }; |
1181 | 1181 |
1182 WebInspector.SourcesPanel.DebuggerLocationRevealer.prototype = { | 1182 WebInspector.SourcesPanel.DebuggerLocationRevealer.prototype = { |
1183 /** | 1183 /** |
1184 * @override | 1184 * @override |
1185 * @param {!Object} rawLocation | 1185 * @param {!Object} rawLocation |
1186 * @param {boolean=} omitFocus | 1186 * @param {boolean=} omitFocus |
1187 * @return {!Promise} | 1187 * @return {!Promise} |
1188 */ | 1188 */ |
1189 reveal: function(rawLocation, omitFocus) | 1189 reveal: function(rawLocation, omitFocus) |
1190 { | 1190 { |
1191 if (!(rawLocation instanceof WebInspector.DebuggerModel.Location)) | 1191 if (!(rawLocation instanceof WebInspector.DebuggerModel.Location)) |
1192 return Promise.reject(new Error("Internal error: not a debugger loca
tion")); | 1192 return Promise.reject(new Error("Internal error: not a debugger loca
tion")); |
1193 WebInspector.SourcesPanel.instance().showUILocation(WebInspector.debugge
rWorkspaceBinding.rawLocationToUILocation(rawLocation), omitFocus); | 1193 WebInspector.SourcesPanel.instance().showUILocation(WebInspector.debugge
rWorkspaceBinding.rawLocationToUILocation(rawLocation), omitFocus); |
1194 return Promise.resolve(); | 1194 return Promise.resolve(); |
1195 } | 1195 } |
1196 } | 1196 }; |
1197 | 1197 |
1198 /** | 1198 /** |
1199 * @constructor | 1199 * @constructor |
1200 * @implements {WebInspector.Revealer} | 1200 * @implements {WebInspector.Revealer} |
1201 */ | 1201 */ |
1202 WebInspector.SourcesPanel.UISourceCodeRevealer = function() | 1202 WebInspector.SourcesPanel.UISourceCodeRevealer = function() |
1203 { | 1203 { |
1204 } | 1204 }; |
1205 | 1205 |
1206 WebInspector.SourcesPanel.UISourceCodeRevealer.prototype = { | 1206 WebInspector.SourcesPanel.UISourceCodeRevealer.prototype = { |
1207 /** | 1207 /** |
1208 * @override | 1208 * @override |
1209 * @param {!Object} uiSourceCode | 1209 * @param {!Object} uiSourceCode |
1210 * @param {boolean=} omitFocus | 1210 * @param {boolean=} omitFocus |
1211 * @return {!Promise} | 1211 * @return {!Promise} |
1212 */ | 1212 */ |
1213 reveal: function(uiSourceCode, omitFocus) | 1213 reveal: function(uiSourceCode, omitFocus) |
1214 { | 1214 { |
1215 if (!(uiSourceCode instanceof WebInspector.UISourceCode)) | 1215 if (!(uiSourceCode instanceof WebInspector.UISourceCode)) |
1216 return Promise.reject(new Error("Internal error: not a ui source cod
e")); | 1216 return Promise.reject(new Error("Internal error: not a ui source cod
e")); |
1217 WebInspector.SourcesPanel.instance().showUISourceCode(uiSourceCode, unde
fined, undefined, omitFocus); | 1217 WebInspector.SourcesPanel.instance().showUISourceCode(uiSourceCode, unde
fined, undefined, omitFocus); |
1218 return Promise.resolve(); | 1218 return Promise.resolve(); |
1219 } | 1219 } |
1220 } | 1220 }; |
1221 | 1221 |
1222 /** | 1222 /** |
1223 * @constructor | 1223 * @constructor |
1224 * @implements {WebInspector.Revealer} | 1224 * @implements {WebInspector.Revealer} |
1225 */ | 1225 */ |
1226 WebInspector.SourcesPanel.DebuggerPausedDetailsRevealer = function() | 1226 WebInspector.SourcesPanel.DebuggerPausedDetailsRevealer = function() |
1227 { | 1227 { |
1228 } | 1228 }; |
1229 | 1229 |
1230 WebInspector.SourcesPanel.DebuggerPausedDetailsRevealer.prototype = { | 1230 WebInspector.SourcesPanel.DebuggerPausedDetailsRevealer.prototype = { |
1231 /** | 1231 /** |
1232 * @override | 1232 * @override |
1233 * @param {!Object} object | 1233 * @param {!Object} object |
1234 * @return {!Promise} | 1234 * @return {!Promise} |
1235 */ | 1235 */ |
1236 reveal: function(object) | 1236 reveal: function(object) |
1237 { | 1237 { |
1238 return WebInspector.SourcesPanel.instance()._setAsCurrentPanel(); | 1238 return WebInspector.SourcesPanel.instance()._setAsCurrentPanel(); |
1239 } | 1239 } |
1240 } | 1240 }; |
1241 | 1241 |
1242 /** | 1242 /** |
1243 * @constructor | 1243 * @constructor |
1244 * @implements {WebInspector.ActionDelegate} | 1244 * @implements {WebInspector.ActionDelegate} |
1245 */ | 1245 */ |
1246 WebInspector.SourcesPanel.RevealingActionDelegate = function() {} | 1246 WebInspector.SourcesPanel.RevealingActionDelegate = function() {}; |
1247 | 1247 |
1248 WebInspector.SourcesPanel.RevealingActionDelegate.prototype = { | 1248 WebInspector.SourcesPanel.RevealingActionDelegate.prototype = { |
1249 /** | 1249 /** |
1250 * @override | 1250 * @override |
1251 * @param {!WebInspector.Context} context | 1251 * @param {!WebInspector.Context} context |
1252 * @param {string} actionId | 1252 * @param {string} actionId |
1253 * @return {boolean} | 1253 * @return {boolean} |
1254 */ | 1254 */ |
1255 handleAction: function(context, actionId) | 1255 handleAction: function(context, actionId) |
1256 { | 1256 { |
1257 var panel = WebInspector.SourcesPanel.instance(); | 1257 var panel = WebInspector.SourcesPanel.instance(); |
1258 if (!panel._ensureSourcesViewVisible()) | 1258 if (!panel._ensureSourcesViewVisible()) |
1259 return false; | 1259 return false; |
1260 switch (actionId) { | 1260 switch (actionId) { |
1261 case "debugger.toggle-pause": | 1261 case "debugger.toggle-pause": |
1262 panel._togglePause(); | 1262 panel._togglePause(); |
1263 return true; | 1263 return true; |
1264 case "sources.go-to-source": | 1264 case "sources.go-to-source": |
1265 panel.showGoToSourceDialog(); | 1265 panel.showGoToSourceDialog(); |
1266 return true; | 1266 return true; |
1267 } | 1267 } |
1268 return false; | 1268 return false; |
1269 } | 1269 } |
1270 } | 1270 }; |
1271 | 1271 |
1272 /** | 1272 /** |
1273 * @constructor | 1273 * @constructor |
1274 * @implements {WebInspector.ActionDelegate} | 1274 * @implements {WebInspector.ActionDelegate} |
1275 */ | 1275 */ |
1276 WebInspector.SourcesPanel.DebuggingActionDelegate = function() | 1276 WebInspector.SourcesPanel.DebuggingActionDelegate = function() |
1277 { | 1277 { |
1278 } | 1278 }; |
1279 | 1279 |
1280 WebInspector.SourcesPanel.DebuggingActionDelegate.prototype = { | 1280 WebInspector.SourcesPanel.DebuggingActionDelegate.prototype = { |
1281 /** | 1281 /** |
1282 * @override | 1282 * @override |
1283 * @param {!WebInspector.Context} context | 1283 * @param {!WebInspector.Context} context |
1284 * @param {string} actionId | 1284 * @param {string} actionId |
1285 * @return {boolean} | 1285 * @return {boolean} |
1286 */ | 1286 */ |
1287 handleAction: function(context, actionId) | 1287 handleAction: function(context, actionId) |
1288 { | 1288 { |
(...skipping 19 matching lines...) Expand all Loading... |
1308 if (frame) { | 1308 if (frame) { |
1309 var text = frame.textEditor.text(frame.textEditor.selection()); | 1309 var text = frame.textEditor.text(frame.textEditor.selection()); |
1310 var executionContext = WebInspector.context.flavor(WebInspector.
ExecutionContext); | 1310 var executionContext = WebInspector.context.flavor(WebInspector.
ExecutionContext); |
1311 if (executionContext) | 1311 if (executionContext) |
1312 WebInspector.ConsoleModel.evaluateCommandInConsole(execution
Context, text); | 1312 WebInspector.ConsoleModel.evaluateCommandInConsole(execution
Context, text); |
1313 } | 1313 } |
1314 return true; | 1314 return true; |
1315 } | 1315 } |
1316 return false; | 1316 return false; |
1317 } | 1317 } |
1318 } | 1318 }; |
1319 | 1319 |
1320 /** | 1320 /** |
1321 * @return {!WebInspector.SourcesPanel} | 1321 * @return {!WebInspector.SourcesPanel} |
1322 */ | 1322 */ |
1323 WebInspector.SourcesPanel.instance = function() | 1323 WebInspector.SourcesPanel.instance = function() |
1324 { | 1324 { |
1325 if (WebInspector.SourcesPanel._instance) | 1325 if (WebInspector.SourcesPanel._instance) |
1326 return WebInspector.SourcesPanel._instance; | 1326 return WebInspector.SourcesPanel._instance; |
1327 return /** @type {!WebInspector.SourcesPanel} */ (self.runtime.sharedInstanc
e(WebInspector.SourcesPanel)); | 1327 return /** @type {!WebInspector.SourcesPanel} */ (self.runtime.sharedInstanc
e(WebInspector.SourcesPanel)); |
1328 } | 1328 }; |
1329 | 1329 |
1330 /** | 1330 /** |
1331 * @param {!WebInspector.SourcesPanel} panel | 1331 * @param {!WebInspector.SourcesPanel} panel |
1332 */ | 1332 */ |
1333 WebInspector.SourcesPanel.updateResizerAndSidebarButtons = function(panel) | 1333 WebInspector.SourcesPanel.updateResizerAndSidebarButtons = function(panel) |
1334 { | 1334 { |
1335 panel._sourcesView.leftToolbar().removeToolbarItems(); | 1335 panel._sourcesView.leftToolbar().removeToolbarItems(); |
1336 panel._sourcesView.rightToolbar().removeToolbarItems(); | 1336 panel._sourcesView.rightToolbar().removeToolbarItems(); |
1337 panel._sourcesView.bottomToolbar().removeToolbarItems(); | 1337 panel._sourcesView.bottomToolbar().removeToolbarItems(); |
1338 var isInWrapper = WebInspector.SourcesPanel.WrapperView.isShowing() && !WebI
nspector.inspectorView.isDrawerMinimized(); | 1338 var isInWrapper = WebInspector.SourcesPanel.WrapperView.isShowing() && !WebI
nspector.inspectorView.isDrawerMinimized(); |
1339 if (panel._splitWidget.isVertical() || isInWrapper) | 1339 if (panel._splitWidget.isVertical() || isInWrapper) |
1340 panel._splitWidget.uninstallResizer(panel._sourcesView.toolbarContainerE
lement()); | 1340 panel._splitWidget.uninstallResizer(panel._sourcesView.toolbarContainerE
lement()); |
1341 else | 1341 else |
1342 panel._splitWidget.installResizer(panel._sourcesView.toolbarContainerEle
ment()); | 1342 panel._splitWidget.installResizer(panel._sourcesView.toolbarContainerEle
ment()); |
1343 if (!isInWrapper) { | 1343 if (!isInWrapper) { |
1344 panel._sourcesView.leftToolbar().appendToolbarItem(panel._toggleNavigato
rSidebarButton); | 1344 panel._sourcesView.leftToolbar().appendToolbarItem(panel._toggleNavigato
rSidebarButton); |
1345 if (panel._splitWidget.isVertical()) | 1345 if (panel._splitWidget.isVertical()) |
1346 panel._sourcesView.rightToolbar().appendToolbarItem(panel._toggleDeb
uggerSidebarButton); | 1346 panel._sourcesView.rightToolbar().appendToolbarItem(panel._toggleDeb
uggerSidebarButton); |
1347 else | 1347 else |
1348 panel._sourcesView.bottomToolbar().appendToolbarItem(panel._toggleDe
buggerSidebarButton); | 1348 panel._sourcesView.bottomToolbar().appendToolbarItem(panel._toggleDe
buggerSidebarButton); |
1349 } | 1349 } |
1350 } | 1350 }; |
1351 | 1351 |
1352 /** | 1352 /** |
1353 * @constructor | 1353 * @constructor |
1354 * @extends {WebInspector.VBox} | 1354 * @extends {WebInspector.VBox} |
1355 */ | 1355 */ |
1356 WebInspector.SourcesPanel.WrapperView = function() | 1356 WebInspector.SourcesPanel.WrapperView = function() |
1357 { | 1357 { |
1358 WebInspector.VBox.call(this); | 1358 WebInspector.VBox.call(this); |
1359 this.element.classList.add("sources-view-wrapper"); | 1359 this.element.classList.add("sources-view-wrapper"); |
1360 WebInspector.SourcesPanel.WrapperView._instance = this; | 1360 WebInspector.SourcesPanel.WrapperView._instance = this; |
1361 this._view = WebInspector.SourcesPanel.instance()._sourcesView; | 1361 this._view = WebInspector.SourcesPanel.instance()._sourcesView; |
1362 } | 1362 }; |
1363 | 1363 |
1364 WebInspector.SourcesPanel.WrapperView.prototype = { | 1364 WebInspector.SourcesPanel.WrapperView.prototype = { |
1365 wasShown: function() | 1365 wasShown: function() |
1366 { | 1366 { |
1367 if (!WebInspector.SourcesPanel.instance().isShowing()) | 1367 if (!WebInspector.SourcesPanel.instance().isShowing()) |
1368 this._showViewInWrapper(); | 1368 this._showViewInWrapper(); |
1369 else | 1369 else |
1370 WebInspector.inspectorView.setDrawerMinimized(true); | 1370 WebInspector.inspectorView.setDrawerMinimized(true); |
1371 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(WebInspector.So
urcesPanel.instance()); | 1371 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(WebInspector.So
urcesPanel.instance()); |
1372 }, | 1372 }, |
1373 | 1373 |
1374 willHide: function() | 1374 willHide: function() |
1375 { | 1375 { |
1376 WebInspector.inspectorView.setDrawerMinimized(false); | 1376 WebInspector.inspectorView.setDrawerMinimized(false); |
1377 setImmediate(() => WebInspector.SourcesPanel.updateResizerAndSidebarButt
ons(WebInspector.SourcesPanel.instance())); | 1377 setImmediate(() => WebInspector.SourcesPanel.updateResizerAndSidebarButt
ons(WebInspector.SourcesPanel.instance())); |
1378 }, | 1378 }, |
1379 | 1379 |
1380 _showViewInWrapper: function() | 1380 _showViewInWrapper: function() |
1381 { | 1381 { |
1382 this._view.show(this.element); | 1382 this._view.show(this.element); |
1383 }, | 1383 }, |
1384 | 1384 |
1385 __proto__: WebInspector.VBox.prototype | 1385 __proto__: WebInspector.VBox.prototype |
1386 } | 1386 }; |
1387 | 1387 |
1388 /** | 1388 /** |
1389 * @return {boolean} | 1389 * @return {boolean} |
1390 */ | 1390 */ |
1391 WebInspector.SourcesPanel.WrapperView.isShowing = function() | 1391 WebInspector.SourcesPanel.WrapperView.isShowing = function() |
1392 { | 1392 { |
1393 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou
rcesPanel.WrapperView._instance.isShowing(); | 1393 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou
rcesPanel.WrapperView._instance.isShowing(); |
1394 } | 1394 }; |
OLD | NEW |