| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 * @constructor | 1162 * @constructor |
| 1163 * @extends {WebInspector.BaseStorageTreeElement} | 1163 * @extends {WebInspector.BaseStorageTreeElement} |
| 1164 * @param {!WebInspector.ResourcesPanel} storagePanel | 1164 * @param {!WebInspector.ResourcesPanel} storagePanel |
| 1165 * @param {!WebInspector.Resource} resource | 1165 * @param {!WebInspector.Resource} resource |
| 1166 */ | 1166 */ |
| 1167 WebInspector.FrameResourceTreeElement = function(storagePanel, resource) | 1167 WebInspector.FrameResourceTreeElement = function(storagePanel, resource) |
| 1168 { | 1168 { |
| 1169 WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource.displa
yName, ["resource-sidebar-tree-item", "resources-type-" + resource.resourceType(
).name()]); | 1169 WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource.displa
yName, ["resource-sidebar-tree-item", "resources-type-" + resource.resourceType(
).name()]); |
| 1170 /** @type {!WebInspector.Resource} */ | 1170 /** @type {!WebInspector.Resource} */ |
| 1171 this._resource = resource; | 1171 this._resource = resource; |
| 1172 this._resource.addEventListener(WebInspector.Resource.Events.MessageAdded, t
his._consoleMessageAdded, this); | |
| 1173 this._resource.addEventListener(WebInspector.Resource.Events.MessagesCleared
, this._consoleMessagesCleared, this); | |
| 1174 this.tooltip = resource.url; | 1172 this.tooltip = resource.url; |
| 1175 this._resource[WebInspector.FrameResourceTreeElement._symbol] = this; | 1173 this._resource[WebInspector.FrameResourceTreeElement._symbol] = this; |
| 1176 } | 1174 } |
| 1177 | 1175 |
| 1178 WebInspector.FrameResourceTreeElement._symbol = Symbol("treeElement"); | 1176 WebInspector.FrameResourceTreeElement._symbol = Symbol("treeElement"); |
| 1179 | 1177 |
| 1180 WebInspector.FrameResourceTreeElement.prototype = { | 1178 WebInspector.FrameResourceTreeElement.prototype = { |
| 1181 get itemURL() | 1179 get itemURL() |
| 1182 { | 1180 { |
| 1183 return this._resource.url; | 1181 return this._resource.url; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 this._resource.populateImageSource(previewImage); | 1215 this._resource.populateImageSource(previewImage); |
| 1218 this.listItemElement.replaceChild(iconElement, this.imageElement); | 1216 this.listItemElement.replaceChild(iconElement, this.imageElement); |
| 1219 } | 1217 } |
| 1220 | 1218 |
| 1221 this._statusElement = createElementWithClass("div", "status"); | 1219 this._statusElement = createElementWithClass("div", "status"); |
| 1222 this.listItemElement.insertBefore(this._statusElement, this.titleElement
); | 1220 this.listItemElement.insertBefore(this._statusElement, this.titleElement
); |
| 1223 | 1221 |
| 1224 this.listItemElement.draggable = true; | 1222 this.listItemElement.draggable = true; |
| 1225 this.listItemElement.addEventListener("dragstart", this._ondragstart.bin
d(this), false); | 1223 this.listItemElement.addEventListener("dragstart", this._ondragstart.bin
d(this), false); |
| 1226 this.listItemElement.addEventListener("contextmenu", this._handleContext
MenuEvent.bind(this), true); | 1224 this.listItemElement.addEventListener("contextmenu", this._handleContext
MenuEvent.bind(this), true); |
| 1227 | |
| 1228 this._updateErrorsAndWarningsBubbles(); | |
| 1229 }, | 1225 }, |
| 1230 | 1226 |
| 1231 /** | 1227 /** |
| 1232 * @param {!MouseEvent} event | 1228 * @param {!MouseEvent} event |
| 1233 * @return {boolean} | 1229 * @return {boolean} |
| 1234 */ | 1230 */ |
| 1235 _ondragstart: function(event) | 1231 _ondragstart: function(event) |
| 1236 { | 1232 { |
| 1237 event.dataTransfer.setData("text/plain", this._resource.content || ""); | 1233 event.dataTransfer.setData("text/plain", this._resource.content || ""); |
| 1238 event.dataTransfer.effectAllowed = "copy"; | 1234 event.dataTransfer.effectAllowed = "copy"; |
| 1239 return true; | 1235 return true; |
| 1240 }, | 1236 }, |
| 1241 | 1237 |
| 1242 _handleContextMenuEvent: function(event) | 1238 _handleContextMenuEvent: function(event) |
| 1243 { | 1239 { |
| 1244 var contextMenu = new WebInspector.ContextMenu(event); | 1240 var contextMenu = new WebInspector.ContextMenu(event); |
| 1245 contextMenu.appendApplicableItems(this._resource); | 1241 contextMenu.appendApplicableItems(this._resource); |
| 1246 contextMenu.show(); | 1242 contextMenu.show(); |
| 1247 }, | 1243 }, |
| 1248 | 1244 |
| 1249 /** | 1245 /** |
| 1250 * @param {string} x | |
| 1251 */ | |
| 1252 _setBubbleText: function(x) | |
| 1253 { | |
| 1254 if (!this._bubbleElement) | |
| 1255 this._bubbleElement = this._statusElement.createChild("div", "bubble
-repeat-count"); | |
| 1256 this._bubbleElement.textContent = x; | |
| 1257 }, | |
| 1258 | |
| 1259 _resetBubble: function() | |
| 1260 { | |
| 1261 if (this._bubbleElement) { | |
| 1262 this._bubbleElement.textContent = ""; | |
| 1263 this._bubbleElement.classList.remove("warning"); | |
| 1264 this._bubbleElement.classList.remove("error"); | |
| 1265 } | |
| 1266 }, | |
| 1267 | |
| 1268 _updateErrorsAndWarningsBubbles: function() | |
| 1269 { | |
| 1270 if (this._storagePanel.currentQuery) | |
| 1271 return; | |
| 1272 | |
| 1273 this._resetBubble(); | |
| 1274 | |
| 1275 if (this._resource.warnings || this._resource.errors) | |
| 1276 this._setBubbleText(String(this._resource.warnings + this._resource.
errors)); | |
| 1277 | |
| 1278 if (this._resource.warnings) | |
| 1279 this._bubbleElement.classList.add("warning"); | |
| 1280 | |
| 1281 if (this._resource.errors) | |
| 1282 this._bubbleElement.classList.add("error"); | |
| 1283 }, | |
| 1284 | |
| 1285 _consoleMessagesCleared: function() | |
| 1286 { | |
| 1287 // FIXME: move to the SourceFrame. | |
| 1288 if (this._sourceView) | |
| 1289 this._sourceView.clearMessages(); | |
| 1290 | |
| 1291 this._updateErrorsAndWarningsBubbles(); | |
| 1292 }, | |
| 1293 | |
| 1294 _consoleMessageAdded: function(event) | |
| 1295 { | |
| 1296 var msg = event.data; | |
| 1297 if (this._sourceView) | |
| 1298 this._sourceView.addMessage(msg); | |
| 1299 this._updateErrorsAndWarningsBubbles(); | |
| 1300 }, | |
| 1301 | |
| 1302 /** | |
| 1303 * @return {!WebInspector.ResourceSourceFrame} | 1246 * @return {!WebInspector.ResourceSourceFrame} |
| 1304 */ | 1247 */ |
| 1305 sourceView: function() | 1248 sourceView: function() |
| 1306 { | 1249 { |
| 1307 if (!this._sourceView) { | 1250 if (!this._sourceView) { |
| 1308 var sourceFrame = new WebInspector.ResourceSourceFrame(this._resourc
e); | 1251 var sourceFrame = new WebInspector.ResourceSourceFrame(this._resourc
e); |
| 1309 sourceFrame.setHighlighterType(this._resource.canonicalMimeType()); | 1252 sourceFrame.setHighlighterType(this._resource.canonicalMimeType()); |
| 1310 this._sourceView = sourceFrame; | 1253 this._sourceView = sourceFrame; |
| 1311 if (this._resource.messages) { | |
| 1312 for (var i = 0; i < this._resource.messages.length; i++) | |
| 1313 this._sourceView.addPersistentMessage(this._resource.message
s[i]); | |
| 1314 } | |
| 1315 } | 1254 } |
| 1316 return this._sourceView; | 1255 return this._sourceView; |
| 1317 }, | 1256 }, |
| 1318 | 1257 |
| 1319 __proto__: WebInspector.BaseStorageTreeElement.prototype | 1258 __proto__: WebInspector.BaseStorageTreeElement.prototype |
| 1320 } | 1259 } |
| 1321 | 1260 |
| 1322 /** | 1261 /** |
| 1323 * @constructor | 1262 * @constructor |
| 1324 * @extends {WebInspector.BaseStorageTreeElement} | 1263 * @extends {WebInspector.BaseStorageTreeElement} |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2402 WebInspector.ResourcesPanelFactory.prototype = { | 2341 WebInspector.ResourcesPanelFactory.prototype = { |
| 2403 /** | 2342 /** |
| 2404 * @override | 2343 * @override |
| 2405 * @return {!WebInspector.Panel} | 2344 * @return {!WebInspector.Panel} |
| 2406 */ | 2345 */ |
| 2407 createPanel: function() | 2346 createPanel: function() |
| 2408 { | 2347 { |
| 2409 return WebInspector.ResourcesPanel._instance(); | 2348 return WebInspector.ResourcesPanel._instance(); |
| 2410 } | 2349 } |
| 2411 } | 2350 } |
| OLD | NEW |